From 750e57fc8e6cb173bcf90a3a27f33b1335dd8a9a Mon Sep 17 00:00:00 2001 From: ascrutae Date: Sun, 19 Nov 2017 17:09:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=20issue=20restemplate=20plugin=20don?= =?UTF-8?q?=E2=80=99t=20works=20fine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring/resttemplate/async}/RestRequestInterceptor.java | 5 +++-- .../async/define/RestTemplateInstrumentation.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) rename apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/{springframework/http/client => skywalking/apm/plugin/spring/resttemplate/async}/RestRequestInterceptor.java (91%) diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java similarity index 91% rename from apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java rename to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java index 66fec4888..fc4e47a72 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java @@ -16,7 +16,7 @@ * Project repository: https://github.com/OpenSkywalking/skywalking */ -package org.springframework.http.client; +package org.skywalking.apm.plugin.spring.resttemplate.async; import java.lang.reflect.Method; import org.skywalking.apm.agent.core.context.CarrierItem; @@ -24,6 +24,7 @@ import org.skywalking.apm.agent.core.context.ContextCarrier; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.springframework.http.client.AsyncClientHttpRequest; public class RestRequestInterceptor implements InstanceMethodsAroundInterceptor { @@ -36,7 +37,7 @@ public class RestRequestInterceptor implements InstanceMethodsAroundInterceptor @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { - AbstractAsyncClientHttpRequest clientHttpRequest = (AbstractAsyncClientHttpRequest)ret; + AsyncClientHttpRequest clientHttpRequest = (AsyncClientHttpRequest)ret; if (ret != null) { Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField(); ContextCarrier contextCarrier = (ContextCarrier)cacheValues[1]; diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java index 6365a0d40..540076d12 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java @@ -47,7 +47,7 @@ public class RestTemplateInstrumentation extends ClassInstanceMethodsEnhancePlug private static final String DO_EXECUTE_METHOD_NAME = "doExecute"; private static final String DO_EXECUTE_INTERCEPTOR = "org.skywalking.apm.plugin.spring.resttemplate.async.RestExecuteInterceptor"; private static final String CREATE_REQUEST_METHOD_NAME = "createAsyncRequest"; - private static final String CREATE_REQUEST_INTERCEPTOR = "org.springframework.http.client.RestRequestInterceptor"; + private static final String CREATE_REQUEST_INTERCEPTOR = "org.skywalking.apm.plugin.spring.resttemplate.async.RestRequestInterceptor"; @Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {