Fix bug stop stopSpan when not createSpan in Spring Callback (#1572)

* Fix bug stop stopSpan when not createSpan
This commit is contained in:
caoyixiong 2018-08-22 14:30:58 +08:00 committed by 吴晟 Wu Sheng
parent 46c0e76ef9
commit 18d2d352fd
2 changed files with 16 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}