diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/pom.xml index 2e3fd3b4f1463fabb0305b785c97cae41c274702..cc6855d02ec51936a3ce5b548e56fc4f17263ce4 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/pom.xml @@ -7,7 +7,7 @@ 4.0.0 - apm-spring-concurrent-util-plugin + apm-spring-concurrent-util-4.3.x-plugin jar concurrent-util-4.3.x-plugin diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java index 56ae40584e817f4358c16bbdcfb471f2147783f7..ed8a2205de9cfb278b1aa63c75264c04b2932e2c 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.concurrent; +import java.lang.reflect.Method; import java.net.URI; import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.ContextSnapshot; @@ -14,8 +15,8 @@ import org.skywalking.apm.network.trace.component.ComponentsDefine; public class FailureCallbackInterceptor implements InstanceMethodsAroundInterceptor { @Override - public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField(); if (cacheValues == null) { return; @@ -29,16 +30,14 @@ public class FailureCallbackInterceptor implements InstanceMethodsAroundIntercep } @Override - public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ContextManager.stopSpan(); return ret; } - @Override - public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); } - } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java index 482a88638416b01c56fa97d9d399a0eeba24628b..951a405820b3f0df75cffafdb94f3a268ac63c15 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.concurrent; +import java.lang.reflect.Method; import java.net.URI; import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.ContextSnapshot; @@ -13,8 +14,9 @@ import org.skywalking.apm.network.trace.component.ComponentsDefine; public class SuccessCallbackInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField(); if (cacheValues == null) { return; @@ -27,15 +29,15 @@ public class SuccessCallbackInterceptor implements InstanceMethodsAroundIntercep ContextManager.continued((ContextSnapshot)cacheValues[2]); } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ContextManager.stopSpan(); return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); } - } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/ListenableFutureCallbackInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/ListenableFutureCallbackInstrumentation.java index 74ebbcad7c7e204f576855f0c08c931222389892..fc1b271115349ce33339348644628ebd7ff3e527 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/ListenableFutureCallbackInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/ListenableFutureCallbackInstrumentation.java @@ -6,41 +6,44 @@ import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoin import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import org.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.skywalking.apm.plugin.spring.concurrent.FailureCallbackInterceptor; -import org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor; import static net.bytebuddy.matcher.ElementMatchers.named; import static org.skywalking.apm.plugin.spring.concurrent.match.ListenableFutureCallbackMatch.listenableFutureCallbackMatch; /** * {@link ListenableFutureCallbackInstrumentation} enhance onSuccess method and oonFailure - * that class inherited org.springframework.util.concurrent.ListenableFutureCallback by {@link - * SuccessCallbackInterceptor} and {@link FailureCallbackInterceptor }. + * that class inherited org.springframework.util.concurrent.ListenableFutureCallback by + * org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor and + * org.skywalking.apm.plugin.spring.concurrent.FailureCallbackInterceptor. * * @author zhangxin */ public class ListenableFutureCallbackInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { - @Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + @Override + protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { return new ConstructorInterceptPoint[0]; } - @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + @Override + protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() { - @Override public ElementMatcher getMethodsMatcher() { + @Override + public ElementMatcher getMethodsMatcher() { return named(SuccessCallbackInstrumentation.SUCCESS_METHOD_NAME); } - @Override public String getMethodsInterceptor() { + @Override + public String getMethodsInterceptor() { return SuccessCallbackInstrumentation.SUCCESS_CALLBACK_INTERCEPTOR; } - @Override public boolean isOverrideArgs() { + @Override + public boolean isOverrideArgs() { return false; } }, new InstanceMethodsInterceptPoint() { - @Override public ElementMatcher getMethodsMatcher() { return named(FailureCallbackInstrumentation.FAILURE_METHOD_NAME); @@ -59,7 +62,8 @@ public class ListenableFutureCallbackInstrumentation extends ClassInstanceMethod }; } - @Override protected ClassMatch enhanceClass() { + @Override + protected ClassMatch enhanceClass() { return listenableFutureCallbackMatch(); } } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/SuccessCallbackInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/SuccessCallbackInstrumentation.java index 4be5c33811e8a9c0c4d444b187dae420020cee52..51c7db24d4f52c7f527939b071ad5a3c45207cbf 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/SuccessCallbackInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/concurrent/define/SuccessCallbackInstrumentation.java @@ -6,21 +6,20 @@ import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoin import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import org.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.skywalking.apm.plugin.spring.concurrent.FailureCallbackInterceptor; -import org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor; import static net.bytebuddy.matcher.ElementMatchers.named; import static org.skywalking.apm.plugin.spring.concurrent.match.SuccessCallbackMatch.successCallbackMatch; /** * {@link SuccessCallbackInstrumentation} enhance the onSuccess method that class inherited - * org.springframework.util.concurrent.SuccessCallback by {@link SuccessCallbackInterceptor}. + * org.springframework.util.concurrent.SuccessCallback by org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor. * * @author zhangxin */ public class SuccessCallbackInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { - public static final String SUCCESS_CALLBACK_INTERCEPTOR = "org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor"; + public static final String SUCCESS_CALLBACK_INTERCEPTOR = + "org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor"; public static final String SUCCESS_METHOD_NAME = "onSuccess"; @Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml index a7558877d00abddaba55b1fcbd9596d2e4c9c6cf..4417a3e14c5b09c6d4e9f05c238be5f86e47fcfa 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml @@ -11,6 +11,8 @@ spring-plugins + concurrent-util-4.3.x-plugin resttemplate-4.3.x-plugin diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/pom.xml index 3dde8eb50b6d09362f9b369ebc2db3315198d474..f0700056a5abfad876932ea7b884da75677654d9 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/pom.xml @@ -7,7 +7,7 @@ 4.0.0 - apm-resttemplate-plugin + apm-resttemplate-4.3.x-plugin jar resttemplate-4.3.x-plugin diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java index 102ba4e3bac38db54d3cf90df6ff150bbb2631a5..d32fab57b6b5ccae59a01226eb964e6ccc9f0340 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java @@ -1,6 +1,6 @@ package org.skywalking.apm.plugin.spring.resttemplate.async; -import com.google.instrumentation.trace.Span; +import java.lang.reflect.Method; import java.net.URI; import java.util.List; import org.skywalking.apm.agent.core.context.ContextManager; @@ -10,22 +10,22 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsA import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; public class FutureGetInterceptor implements InstanceMethodsAroundInterceptor { + @Override - public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { List cacheValues = (List)objInst.getSkyWalkingDynamicField(); ContextManager.createLocalSpan("future/get:" + ((URI)cacheValues.get(0)).getPath()); } @Override - public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ContextManager.stopSpan(); return ret; } - @Override - public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.errorOccurred().log(t); diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java index ab4cc2dd8e584aed9a7b6ab4a6dfc08e19b73eac..421312ebeba860cd052b97ed1e21ae0c4b656110 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java @@ -1,13 +1,15 @@ package org.skywalking.apm.plugin.spring.resttemplate.async; +import java.lang.reflect.Method; 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; public class ResponseCallBackInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { EnhancedInstance successCallBak = (EnhancedInstance)allArguments[0]; successCallBak.setSkyWalkingDynamicField(objInst.getSkyWalkingDynamicField()); @@ -17,12 +19,13 @@ public class ResponseCallBackInterceptor implements InstanceMethodsAroundInterce } } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java index 378ad6da6da3d67630be1e782af75556775bfda2..9e4693997fc8e2ec1c3fcfa135148fe6ccd9cf66 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.resttemplate.async; +import java.lang.reflect.Method; import java.net.URI; import org.skywalking.apm.agent.core.context.ContextCarrier; import org.skywalking.apm.agent.core.context.ContextManager; @@ -15,8 +16,8 @@ import org.springframework.http.HttpMethod; public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor { @Override - public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { final URI requestURL = (URI)allArguments[0]; final HttpMethod httpMethod = (HttpMethod)allArguments[1]; final ContextCarrier contextCarrier = new ContextCarrier(); @@ -34,8 +35,8 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor } @Override - public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField(); cacheValues[3] = ContextManager.capture(); ((EnhancedInstance)ret).setSkyWalkingDynamicField(cacheValues); @@ -43,8 +44,7 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor return ret; } - @Override - public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.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.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java index 622ee4fe8587f139d10efe510c5db5829c2ab058..1cb6a20b049a73ba6b5cecc91cfef0752019a1c4 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.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.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java @@ -8,8 +8,6 @@ import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoin import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; import org.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.skywalking.apm.plugin.spring.resttemplate.async.FutureGetInterceptor; -import org.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor; import static net.bytebuddy.matcher.ElementMatchers.named; import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java index 0fb1bec8f229e4fee6f4fc4eb7a1f100f4deaf24..c0567cba2d43e49b37c135471983b7346ef77c97 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.resttemplate.sync; +import java.lang.reflect.Method; import java.net.URI; import org.skywalking.apm.agent.core.context.ContextCarrier; import org.skywalking.apm.agent.core.context.ContextManager; @@ -13,9 +14,10 @@ import org.skywalking.apm.network.trace.component.ComponentsDefine; import org.springframework.http.HttpMethod; public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { final URI requestURL = (URI)allArguments[0]; final HttpMethod httpMethod = (HttpMethod)allArguments[1]; final ContextCarrier contextCarrier = new ContextCarrier(); @@ -30,15 +32,15 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor objInst.setSkyWalkingDynamicField(contextCarrier.serialize()); } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ContextManager.stopSpan(); return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); - } } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java index ad8b709d3ff4a22748cabb8184258ad2819af10e..23e062c5b18a7c4c78e172373f352ffed138ba0b 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.resttemplate.sync; +import java.lang.reflect.Method; import org.skywalking.apm.agent.core.conf.Config; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; @@ -8,13 +9,16 @@ import org.springframework.http.client.AbstractClientHttpRequest; import org.springframework.http.client.ClientHttpRequest; public class RestRequestInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ClientHttpRequest clientHttpRequest = (ClientHttpRequest)ret; if (clientHttpRequest instanceof AbstractClientHttpRequest) { AbstractClientHttpRequest httpRequest = (AbstractClientHttpRequest)clientHttpRequest; @@ -23,7 +27,7 @@ public class RestRequestInterceptor implements InstanceMethodsAroundInterceptor return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java index f15bc56e8601a999805d98c9633c1024372682d5..80e554f52783430c22dd9f3712eff9cc137b2683 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java @@ -1,5 +1,6 @@ package org.skywalking.apm.plugin.spring.resttemplate.sync; +import java.lang.reflect.Method; import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; @@ -9,13 +10,16 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptR import org.springframework.http.client.ClientHttpResponse; public class RestResponseInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { ClientHttpResponse response = (ClientHttpResponse)allArguments[2]; int statusCode = response.getStatusCode().value(); @@ -27,7 +31,7 @@ public class RestResponseInterceptor implements InstanceMethodsAroundInterceptor return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java index 1ce1744c1e0818306a67e8f1af5db4b021531e26..17218adfb4d50b223f5f8b7315052ac325eeeb51 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.3.x-plugin/src/main/java/org/springframework/http/client/RestRequestInterceptor.java @@ -1,5 +1,6 @@ package org.springframework.http.client; +import java.lang.reflect.Method; import java.util.List; import org.skywalking.apm.agent.core.conf.Config; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; @@ -7,19 +8,22 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsA import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; public class RestRequestInterceptor implements InstanceMethodsAroundInterceptor { - @Override public void beforeMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { + + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + MethodInterceptResult result) throws Throwable { } - @Override public Object afterMethod(EnhancedInstance objInst, String methodName, Object[] allArguments, - Class[] argumentsTypes, Object ret) throws Throwable { + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, + Object ret) throws Throwable { AbstractAsyncClientHttpRequest clientHttpRequest = (AbstractAsyncClientHttpRequest)ret; clientHttpRequest.getHeaders().set(Config.Plugin.Propagation.HEADER_NAME, String.valueOf(((List)objInst.getSkyWalkingDynamicField()).get(1))); return ret; } - @Override public void handleMethodException(EnhancedInstance objInst, String methodName, Object[] allArguments, + @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { }