forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#7463] Add Reactor-Netty HTTP client plugin
- Loading branch information
1 parent
e59f2b2
commit 4dadb4c
Showing
31 changed files
with
1,009 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Install | ||
``` | ||
$ mvnw -P pinpoint-reactor-netty-plugin-testweb install -Dmaven.test.skip=true | ||
``` | ||
|
||
## Run | ||
``` | ||
$ mvnw -P pinpoint-reactor-netty-plugin-testweb spring-boot:start | ||
``` | ||
You can then access here: http://localhost:18080/client/get | ||
|
||
## Stop | ||
``` | ||
$ mvnw -P pinpoint-reactor-netty-plugin-testweb spring-boot:stop | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-agent-testweb</artifactId> | ||
<version>2.2.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pinpoint-reactor-netty-plugin-testweb</artifactId> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<pinpoint.agent.jvmargument> | ||
${pinpoint.agent.default.jvmargument} | ||
-Dprofiler.reactor-netty.client.enable=true | ||
-Dprofiler.reactor-netty.client.param=true | ||
</pinpoint.agent.jvmargument> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.projectreactor.netty</groupId> | ||
<artifactId>reactor-netty</artifactId> | ||
<version>0.9.12.RELEASE</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
73 changes: 73 additions & 0 deletions
73
...ugin-testweb/src/main/java/com/pinpoint/test/plugin/ReactorNettyPluginTestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2020 NAVER Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.pinpoint.test.plugin; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Mono; | ||
import reactor.netty.ByteBufFlux; | ||
import reactor.netty.http.client.HttpClient; | ||
import reactor.netty.http.client.HttpClientResponse; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author jaehong.kim | ||
*/ | ||
@RestController | ||
public class ReactorNettyPluginTestController { | ||
|
||
@RequestMapping(value = "/client/echo", method = RequestMethod.GET) | ||
@ResponseBody | ||
public String clientEcho() { | ||
return "Welcome"; | ||
} | ||
|
||
@RequestMapping(value = "/client/get", method = RequestMethod.GET) | ||
@ResponseBody | ||
public String clientGet() { | ||
HttpClient client = HttpClient.create().port(80); | ||
String response = client.get().uri("https://www.google.com?foo=bar").responseContent().aggregate().asString().block(); | ||
return response; | ||
} | ||
|
||
@RequestMapping(value = "/client/get_local", method = RequestMethod.GET) | ||
@ResponseBody | ||
public String clientError(HttpServletRequest request) { | ||
HttpClient client = HttpClient.create().port(request.getLocalPort()); | ||
String response = client.get().uri("/client/echo").responseContent().aggregate().asString().block(); | ||
return response; | ||
} | ||
|
||
@RequestMapping(value = "/client/post", method = RequestMethod.GET) | ||
@ResponseBody | ||
public String clientPost() { | ||
HttpClient client = HttpClient.create().port(80); | ||
HttpClientResponse response = client.post().uri("https://www.google.com/").send(ByteBufFlux.fromString(Mono.just("hello"))).response().block(); | ||
return response.toString(); | ||
} | ||
|
||
@RequestMapping(value = "/client/unknown_host", method = RequestMethod.GET) | ||
@ResponseBody | ||
public String clientError() { | ||
HttpClient client = HttpClient.create().port(80); | ||
String response = client.get().uri("http://fjalkjdlfaj.com").responseContent().aggregate().asString().block(); | ||
return response; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...-plugin-testweb/src/main/java/com/pinpoint/test/plugin/ReactorNettyPluginTestStarter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2020 NAVER Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.pinpoint.test.plugin; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* @author jaehong.kim | ||
*/ | ||
@SpringBootApplication | ||
public class ReactorNettyPluginTestStarter { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ReactorNettyPluginTestStarter.class, args); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
agent-testweb/reactor-netty-plugin-testweb/src/main/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Defined in commandlineArgument of agent-test pom.xml | ||
|
||
server: | ||
port: 18080 | ||
|
||
#logging: | ||
# level: | ||
# root: info | ||
|
||
#springdoc: | ||
# swagger-ui: | ||
# path: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.