no message
This commit is contained in:
parent
f5d5cd3b9b
commit
0a5dd6691c
|
|
@ -7,7 +7,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>apm-spring-concurrent-util-plugin</artifactId>
|
||||
<artifactId>apm-spring-concurrent-util-4.3.x-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>concurrent-util-4.3.x-plugin</name>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <code>onSuccess</code> method and <code>oonFailure</code>
|
||||
* that class inherited <code>org.springframework.util.concurrent.ListenableFutureCallback</code> by {@link
|
||||
* SuccessCallbackInterceptor} and {@link FailureCallbackInterceptor }.
|
||||
* that class inherited <code>org.springframework.util.concurrent.ListenableFutureCallback</code> by
|
||||
* <code>org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor</code> and
|
||||
* <code>org.skywalking.apm.plugin.spring.concurrent.FailureCallbackInterceptor</code>.
|
||||
*
|
||||
* @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<MethodDescription> getMethodsMatcher() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> 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<MethodDescription> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <code>onSuccess</code> method that class inherited
|
||||
* <code>org.springframework.util.concurrent.SuccessCallback</code> by {@link SuccessCallbackInterceptor}.
|
||||
* <code>org.springframework.util.concurrent.SuccessCallback</code> by <code>org.skywalking.apm.plugin.spring.concurrent.SuccessCallbackInterceptor</code>.
|
||||
*
|
||||
* @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() {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
<artifactId>spring-plugins</artifactId>
|
||||
<modules>
|
||||
<!--<module>concurrent-util-4.3.x-plugin</module>
|
||||
<module>resttemplate-4.3.x-plugin</module>-->
|
||||
<module>concurrent-util-4.3.x-plugin</module>
|
||||
<module>resttemplate-4.3.x-plugin</module>
|
||||
</modules>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>apm-resttemplate-plugin</artifactId>
|
||||
<artifactId>apm-resttemplate-4.3.x-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>resttemplate-4.3.x-plugin</name>
|
||||
|
|
|
|||
|
|
@ -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<Object> cacheValues = (List<Object>)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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Object>)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) {
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue