-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#11592] Update arcus-plugin to support arcus java client 1.13.4
- Loading branch information
1 parent
34cad8b
commit 3d7e792
Showing
11 changed files
with
321 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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>3.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pinpoint-arcus-plugin-testweb</artifactId> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<pinpoint.agent.jvmargument> | ||
${pinpoint.agent.default.jvmargument} | ||
</pinpoint.agent.jvmargument> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.navercorp.arcus</groupId> | ||
<artifactId>arcus-java-client</artifactId> | ||
<version>1.12.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-agent-testweb-commons</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
37 changes: 37 additions & 0 deletions
37
...arcus-plugin-testweb/src/main/java/com/pinpoint/test/plugin/ArcusClientConfiguration.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,37 @@ | ||
/* | ||
* Copyright 2024 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 net.spy.memcached.ArcusClient; | ||
import net.spy.memcached.ConnectionFactoryBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class ArcusClientConfiguration { | ||
|
||
@Bean | ||
public ArcusClient arcusClient() { | ||
System.setProperty("net.spy.log.LoggerImpl", "net.spy.memcached.compat.log.Log4JLogger"); | ||
System.setProperty("net.sf.ehcache.skipUpdateCheck", "true"); | ||
|
||
ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder(); | ||
builder.setFrontCacheExpireTime(10000); | ||
builder.setMaxFrontCacheElements(100); | ||
return ArcusClient.createArcusClient("", "", builder); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
...eb/arcus-plugin-testweb/src/main/java/com/pinpoint/test/plugin/ArcusPluginController.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,93 @@ | ||
/* | ||
* Copyright 2023 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 com.pinpoint.test.common.view.ApiLinkPage; | ||
import com.pinpoint.test.common.view.HrefTag; | ||
import net.spy.memcached.ArcusClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.method.HandlerMethod; | ||
import org.springframework.web.reactive.result.method.RequestMappingInfo; | ||
import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.Future; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@RestController | ||
public class ArcusPluginController { | ||
private static final String KEY = "test:hello"; | ||
private final static String ARCUS = "ARCUS"; | ||
private final static String ARCUS_FUTURE_GET = "ARCUS_FUTURE_GET"; | ||
private final static String ARCUS_EHCACHE_FUTURE_GET = "ARCUS_EHCACHE_FUTURE_GET"; | ||
|
||
private final RequestMappingHandlerMapping handlerMapping; | ||
|
||
@Autowired | ||
private ArcusClient arcusClient; | ||
|
||
@Autowired | ||
public ArcusPluginController(RequestMappingHandlerMapping handlerMapping) { | ||
this.handlerMapping = handlerMapping; | ||
} | ||
|
||
@GetMapping("/") | ||
String welcome() { | ||
Map<RequestMappingInfo, HandlerMethod> handlerMethods = this.handlerMapping.getHandlerMethods(); | ||
List<HrefTag> list = new ArrayList<>(); | ||
for (RequestMappingInfo info : handlerMethods.keySet()) { | ||
for (String path : info.getDirectPaths()) { | ||
list.add(HrefTag.of(path)); | ||
} | ||
} | ||
list.sort(Comparator.comparing(HrefTag::getPath)); | ||
return new ApiLinkPage("redis-lettuce-plugin-testweb") | ||
.addHrefTag(list) | ||
.build(); | ||
} | ||
|
||
@GetMapping("/arcus/set") | ||
public String set() throws Exception { | ||
Future<Boolean> future = arcusClient.set(KEY, 600, "Hello, Arcus!"); | ||
|
||
future.get(700L, TimeUnit.MILLISECONDS); | ||
return "OK"; | ||
} | ||
|
||
@GetMapping("/arcus/asyncGet") | ||
public String asyncGet() throws Exception { | ||
Future<Object> future = arcusClient.asyncGet(KEY); | ||
|
||
return (String) future.get(3000L, TimeUnit.MILLISECONDS); | ||
} | ||
|
||
@GetMapping("/arcus/get") | ||
public String get() { | ||
return (String) arcusClient.get(KEY); | ||
} | ||
|
||
@GetMapping("/arcus/frontcache") | ||
public String frontCache() { | ||
String value = (String) arcusClient.get(KEY); | ||
return arcusClient.getLocalCacheManager().getElement(KEY).toString(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...b/arcus-plugin-testweb/src/main/java/com/pinpoint/test/plugin/ArcusPluginTestStarter.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,28 @@ | ||
/* | ||
* 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; | ||
|
||
@SpringBootApplication | ||
public class ArcusPluginTestStarter { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ArcusPluginTestStarter.class, args); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
agent-module/agent-testweb/arcus-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,9 @@ | ||
# Defined in commandlineArgument of agent-test pom.xml | ||
|
||
server: | ||
port: 18080 | ||
|
||
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
Oops, something went wrong.