Fix bug stop stopSpan when not createSpan in Spring Callback (#1572)
* Fix bug stop stopSpan when not createSpan
This commit is contained in:
parent
46c0e76ef9
commit
18d2d352fd
|
|
@ -51,12 +51,20 @@ public class FailureCallbackInterceptor implements InstanceMethodsAroundIntercep
|
|||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
|
||||
if (cacheValues == null) {
|
||||
return ret;
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
|
||||
if (cacheValues == null) {
|
||||
return;
|
||||
}
|
||||
ContextManager.activeSpan().errorOccurred().log(t);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,12 +51,20 @@ public class SuccessCallbackInterceptor implements InstanceMethodsAroundIntercep
|
|||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
|
||||
if (cacheValues == null) {
|
||||
return ret;
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
|
||||
if (cacheValues == null) {
|
||||
return;
|
||||
}
|
||||
ContextManager.activeSpan().errorOccurred().log(t);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue