You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/02/24 08:17:43 UTC
[skywalking-java] branch main updated: Fix Spring 6 test case (#463)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push:
new 0b1af4fd18 Fix Spring 6 test case (#463)
0b1af4fd18 is described below
commit 0b1af4fd18d6c48f10dc28130503873f2c60dfda
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri Feb 24 16:17:37 2023 +0800
Fix Spring 6 test case (#463)
---
apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml | 2 +
.../pom.xml | 13 ++++--
.../ResponseExtractorFutureInstrumentation3x.java | 43 ++++++++++++++++++
.../define/RestTemplateInstrumentation3x.java | 41 +++++++++++++++++
.../sync/define/RestTemplateInstrumentation3x.java | 38 ++++++++++++++++
.../src/main/resources/skywalking-plugin.def | 6 +--
.../spring-plugins/resttemplate-4.x-plugin/pom.xml | 5 ++
.../ResponseExtractorFutureInstrumentation4x.java | 43 ++++++++++++++++++
.../define/RestTemplateInstrumentation4x.java | 41 +++++++++++++++++
.../sync/define/RestTemplateInstrumentation4x.java | 38 ++++++++++++++++
.../src/main/resources/skywalking-plugin.def | 6 +--
.../pom.xml | 6 +--
.../resttemplate/async/FutureGetInterceptor.java | 0
.../async/ResponseCallBackInterceptor.java | 0
.../resttemplate/async/RestExecuteInterceptor.java | 0
.../resttemplate/async/RestRequestInterceptor.java | 0
.../ResponseExtractorFutureInstrumentation.java | 9 +---
.../async/define/RestTemplateInstrumentation.java | 9 +---
.../helper/RestTemplateRuntimeContextHelper.java | 0
.../resttemplate/sync/RestExecuteInterceptor.java | 0
.../resttemplate/sync/RestRequestInterceptor.java | 0
.../resttemplate/sync/RestResponseInterceptor.java | 0
.../sync/define/RestTemplateInstrumentation.java | 9 +---
.../resttemplate-6.x-plugin/pom.xml | 6 +++
.../helper/RestTemplateRuntimeContextHelper.java | 53 ----------------------
.../v6x/sync/RestExecuteInterceptor.java | 2 +-
.../v6x/sync/RestRequestInterceptor.java | 2 +-
.../sync/define/RestTemplateInstrumentation.java | 7 ++-
.../setup/service-agent/java-agent/Plugin-list.md | 1 +
29 files changed, 284 insertions(+), 96 deletions(-)
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
index da106f5e68..a475473dcb 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
@@ -30,6 +30,7 @@
<modules>
<module>async-annotation-plugin</module>
<module>concurrent-util-4.x-plugin</module>
+ <module>resttemplate-3.x-plugin</module>
<module>resttemplate-4.x-plugin</module>
<module>mvc-annotation-4.x-plugin</module>
<module>spring-cloud</module>
@@ -42,6 +43,7 @@
<module>spring-kafka-2.x-plugin</module>
<module>scheduled-annotation-plugin</module>
<module>spring-webflux-5.x-webclient-plugin</module>
+ <module>resttemplate-commons</module>
</modules>
<packaging>pom</packaging>
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/pom.xml
similarity index 82%
copy from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
copy to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/pom.xml
index bcc756a8af..86ae89c480 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/pom.xml
@@ -24,14 +24,12 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>apm-resttemplate-4.3.x-plugin</artifactId>
- <packaging>jar</packaging>
+ <artifactId>apm-resttemplate-3.x-plugin</artifactId>
- <name>resttemplate-4.3.x-plugin</name>
- <url>http://maven.apache.org</url>
+ <name>resttemplate-3.x-plugin</name>
<properties>
- <spring-web.version>4.3.10.RELEASE</spring-web.version>
+ <spring-web.version>3.2.18.RELEASE</spring-web.version>
</properties>
<dependencies>
@@ -47,5 +45,10 @@
<artifactId>spring-commons</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>resttemplate-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation3x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation3x.java
new file mode 100644
index 0000000000..f8fa39b2b9
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation3x.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+import org.apache.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor;
+
+import java.net.URI;
+
+/**
+ * {@link ResponseExtractorFutureInstrumentation3x} enhance the <code>addCallback</code> method and
+ * <code>getDefault</code> method of <code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code>
+ * by
+ * <code>ResponseCallBackInterceptor</code> and
+ * <code>FutureGetInterceptor</code>.
+ * <p>
+ * {@link ResponseCallBackInterceptor} set the {@link URI} and {@link ContextSnapshot} to inherited
+ * <code>org.springframework.util.concurrent.SuccessCallback</code> and <code>org.springframework.util.concurrent.FailureCallback</code>
+ */
+public class ResponseExtractorFutureInstrumentation3x extends ResponseExtractorFutureInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation3x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation3x.java
new file mode 100644
index 0000000000..4a88b277d8
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation3x.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+
+import java.net.URI;
+
+/**
+ * {@link RestTemplateInstrumentation3x} enhance the <code>doExecute</code> method and <code>createAsyncRequest</code>
+ * method of <code>org.springframework.web.client.AsyncRestTemplate</code> by <code>RestExecuteInterceptor</code> and
+ * <code>org.springframework.http.client.RestRequestInterceptor</code>.
+ *
+ * <code>org.springframework.http.client.RestRequestInterceptor</code> set {@link URI} and {@link ContextSnapshot} to
+ * <code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code> for propagate trace context
+ * after execute <code>doExecute</code> .
+ */
+public class RestTemplateInstrumentation3x extends RestTemplateInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation3x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation3x.java
new file mode 100644
index 0000000000..8c10616d0a
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation3x.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define;
+
+/**
+ * {@link RestTemplateInstrumentation} enhance the <code>doExecute</code> method,<code>handleResponse</code> method and
+ * <code>handleResponse</code> method of <code>org.springframework.web.client.RestTemplate</code> by
+ * <code>RestExecuteInterceptor</code>,
+ * <code>RestResponseInterceptor</code> and
+ * <code>RestRequestInterceptor</code>.
+ *
+ * <code>RestResponseInterceptor</code> set context to header for
+ * propagate trace context after execute <code>createRequest</code>.
+ */
+public class RestTemplateInstrumentation3x extends RestTemplateInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/resources/skywalking-plugin.def
similarity index 73%
copy from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
copy to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/resources/skywalking-plugin.def
index 98a8a1b7cb..651bbca242 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-3.x-plugin/src/main/resources/skywalking-plugin.def
@@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation
+spring-resttemplate-3.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation3x
+spring-resttemplate-3.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation3x
+spring-resttemplate-3.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation3x
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
index bcc756a8af..071a420215 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
@@ -47,5 +47,10 @@
<artifactId>spring-commons</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>resttemplate-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java
new file mode 100644
index 0000000000..74f90fef5a
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+import org.apache.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor;
+
+import java.net.URI;
+
+/**
+ * {@link ResponseExtractorFutureInstrumentation4x} enhance the <code>addCallback</code> method and
+ * <code>getDefault</code> method of <code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code>
+ * by
+ * <code>ResponseCallBackInterceptor</code> and
+ * <code>FutureGetInterceptor</code>.
+ * <p>
+ * {@link ResponseCallBackInterceptor} set the {@link URI} and {@link ContextSnapshot} to inherited
+ * <code>org.springframework.util.concurrent.SuccessCallback</code> and <code>org.springframework.util.concurrent.FailureCallback</code>
+ */
+public class ResponseExtractorFutureInstrumentation4x extends ResponseExtractorFutureInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java
new file mode 100644
index 0000000000..9ecbdafd75
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+
+import java.net.URI;
+
+/**
+ * {@link RestTemplateInstrumentation4x} enhance the <code>doExecute</code> method and <code>createAsyncRequest</code>
+ * method of <code>org.springframework.web.client.AsyncRestTemplate</code> by <code>RestExecuteInterceptor</code> and
+ * <code>org.springframework.http.client.RestRequestInterceptor</code>.
+ *
+ * <code>org.springframework.http.client.RestRequestInterceptor</code> set {@link URI} and {@link ContextSnapshot} to
+ * <code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code> for propagate trace context
+ * after execute <code>doExecute</code> .
+ */
+public class RestTemplateInstrumentation4x extends RestTemplateInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java
new file mode 100644
index 0000000000..59817b24fa
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define;
+
+/**
+ * {@link RestTemplateInstrumentation} enhance the <code>doExecute</code> method,<code>handleResponse</code> method and
+ * <code>handleResponse</code> method of <code>org.springframework.web.client.RestTemplate</code> by
+ * <code>RestExecuteInterceptor</code>,
+ * <code>RestResponseInterceptor</code> and
+ * <code>RestRequestInterceptor</code>.
+ *
+ * <code>RestResponseInterceptor</code> set context to header for
+ * propagate trace context after execute <code>createRequest</code>.
+ */
+public class RestTemplateInstrumentation4x extends RestTemplateInstrumentation {
+ @Override
+ protected String[] witnessClasses() {
+ return new String[] {
+ "org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor"
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
index 98a8a1b7cb..909ddfb3f8 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
@@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation4x
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation4x
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation4x
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
similarity index 91%
copy from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
copy to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
index bcc756a8af..0a2feba4c3 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
@@ -24,11 +24,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>apm-resttemplate-4.3.x-plugin</artifactId>
- <packaging>jar</packaging>
+ <artifactId>resttemplate-commons</artifactId>
- <name>resttemplate-4.3.x-plugin</name>
- <url>http://maven.apache.org</url>
+ <name>resttemplate-commons</name>
<properties>
<spring-web.version>4.3.10.RELEASE</spring-web.version>
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
similarity index 93%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
index cc42085927..f9497fa925 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
@@ -41,7 +41,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* {@link ResponseCallBackInterceptor} set the {@link URI} and {@link ContextSnapshot} to inherited
* <code>org.springframework.util.concurrent.SuccessCallback</code> and <code>org.springframework.util.concurrent.FailureCallback</code>
*/
-public class ResponseExtractorFutureInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+public abstract class ResponseExtractorFutureInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ADD_CALLBACK_METHOD_NAME = "addCallback";
private static final String ADD_CALLBACK_INTERCEPTOR = "org.apache.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor";
@@ -97,11 +97,4 @@ public class ResponseExtractorFutureInstrumentation extends ClassInstanceMethods
protected ClassMatch enhanceClass() {
return NameMatch.byName(ENHANCE_CLASS);
}
-
- @Override
- protected String[] witnessClasses() {
- return new String[] {
- "org.springframework.web.context.support.ServletContextAttributeFactoryBean"
- };
- }
}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
similarity index 93%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
index c0722f8326..d7e9145248 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
@@ -39,7 +39,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* <code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code> for propagate trace context
* after execute <code>doExecute</code> .
*/
-public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+public abstract class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.springframework.web.client.AsyncRestTemplate";
private static final String DO_EXECUTE_METHOD_NAME = "doExecute";
@@ -94,11 +94,4 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug
protected ClassMatch enhanceClass() {
return NameMatch.byName(ENHANCE_CLASS);
}
-
- @Override
- protected String[] witnessClasses() {
- return new String[] {
- "org.springframework.web.context.support.ServletContextAttributeFactoryBean"
- };
- }
}
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
similarity index 100%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
similarity index 94%
rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
index 9c98b81c50..8089e2a7b7 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
@@ -38,7 +38,7 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
* <code>RestResponseInterceptor</code> set context to header for
* propagate trace context after execute <code>createRequest</code>.
*/
-public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+public abstract class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.springframework.web.client.RestTemplate";
private static final String DO_EXECUTE_METHOD_NAME = "doExecute";
@@ -111,11 +111,4 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug
protected ClassMatch enhanceClass() {
return byName(ENHANCE_CLASS);
}
-
- @Override
- protected String[] witnessClasses() {
- return new String[] {
- "org.springframework.web.context.support.ServletContextAttributeFactoryBean"
- };
- }
}
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/pom.xml b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/pom.xml
index ecad2c0244..0cd440c1bf 100644
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/pom.xml
+++ b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/pom.xml
@@ -47,5 +47,11 @@
<artifactId>spring-commons</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>resttemplate-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/helper/RestTemplateRuntimeContextHelper.java b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/helper/RestTemplateRuntimeContextHelper.java
deleted file mode 100644
index bed866a0bc..0000000000
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/helper/RestTemplateRuntimeContextHelper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.skywalking.apm.plugin.spring.resttemplate.v6x.helper;
-
-import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
-import org.apache.skywalking.apm.agent.core.context.ContextManager;
-
-public class RestTemplateRuntimeContextHelper {
-
- private static final String REST_TEMPLATE_CONTEXT_CARRIER_KEY_IN_RUNTIME_CONTEXT = "REST_TEMPLATE_CONTEXT_CARRIER";
-
- private static final String REST_TEMPLATE_URI_KEY_IN_RUNTIME_CONTEXT = "REST_TEMPLATE_URI";
-
- public static void cleanUri() {
- ContextManager.getRuntimeContext().remove(REST_TEMPLATE_URI_KEY_IN_RUNTIME_CONTEXT);
- }
-
- public static void cleanContextCarrier() {
- ContextManager.getRuntimeContext().remove(REST_TEMPLATE_CONTEXT_CARRIER_KEY_IN_RUNTIME_CONTEXT);
- }
-
- public static void addUri(String uri) {
- ContextManager.getRuntimeContext().put(REST_TEMPLATE_URI_KEY_IN_RUNTIME_CONTEXT, uri);
- }
-
- public static void addContextCarrier(ContextCarrier contextCarrier) {
- ContextManager.getRuntimeContext().put(REST_TEMPLATE_CONTEXT_CARRIER_KEY_IN_RUNTIME_CONTEXT, contextCarrier);
- }
-
- public static String getUri() {
- return (String) ContextManager.getRuntimeContext().get(REST_TEMPLATE_URI_KEY_IN_RUNTIME_CONTEXT);
- }
-
- public static ContextCarrier getContextCarrier() {
- return (ContextCarrier) ContextManager.getRuntimeContext().get(REST_TEMPLATE_CONTEXT_CARRIER_KEY_IN_RUNTIME_CONTEXT);
- }
-}
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestExecuteInterceptor.java b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestExecuteInterceptor.java
index 7b9e7398e6..b4fff55686 100644
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestExecuteInterceptor.java
+++ b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestExecuteInterceptor.java
@@ -29,7 +29,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedI
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
-import org.apache.skywalking.apm.plugin.spring.resttemplate.v6x.helper.RestTemplateRuntimeContextHelper;
+import org.apache.skywalking.apm.plugin.spring.resttemplate.helper.RestTemplateRuntimeContextHelper;
import org.springframework.http.HttpMethod;
public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor {
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestRequestInterceptor.java b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestRequestInterceptor.java
index 455b897c58..f8bbd6bac5 100644
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestRequestInterceptor.java
+++ b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/RestRequestInterceptor.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
-import org.apache.skywalking.apm.plugin.spring.resttemplate.v6x.helper.RestTemplateRuntimeContextHelper;
+import org.apache.skywalking.apm.plugin.spring.resttemplate.helper.RestTemplateRuntimeContextHelper;
import org.springframework.http.client.AbstractClientHttpRequest;
import org.springframework.http.client.ClientHttpRequest;
diff --git a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
index c9fdb3823d..2c22415b4e 100644
--- a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
+++ b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
@@ -26,6 +26,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
@@ -59,7 +60,9 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
- return named(DO_EXECUTE_METHOD_NAME);
+ return named(DO_EXECUTE_METHOD_NAME)
+ .and(takesArgument(0, named("java.net.URI")))
+ .and(takesArgument(2, named("org.springframework.http.HttpMethod")));
}
@Override
@@ -115,7 +118,7 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug
@Override
protected String[] witnessClasses() {
return new String[] {
- "org.springframework.web.client.ClientHttpResponseDecorator"
+ "org.springframework.http.client.reactive.JdkClientHttpConnector"
};
}
}
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md
index e99b67b090..aeea1528c3 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -105,6 +105,7 @@
- spring-mvc-annotation-4.x
- spring-mvc-annotation-5.x
- spring-mvc-annotation-6.x
+- spring-resttemplate-3.x
- spring-resttemplate-4.x
- spring-resttemplate-6.x
- spring-scheduled-annotation