Fix the issue that Hystrix plugin case NPE (#1293)
This commit is contained in:
parent
3f7a86f98f
commit
a960272f71
|
|
@ -36,7 +36,9 @@ public class HystrixCommandGetFallbackInterceptor implements InstanceMethodsArou
|
|||
|
||||
AbstractSpan activeSpan = ContextManager.createLocalSpan(enhanceRequireObjectCache.getOperationNamePrefix() + "/Fallback");
|
||||
activeSpan.setComponent(ComponentsDefine.HYSTRIX);
|
||||
ContextManager.continued(snapshot);
|
||||
if (snapshot != null) {
|
||||
ContextManager.continued(snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ public class HystrixCommandRunInterceptor implements InstanceMethodsAroundInterc
|
|||
|
||||
AbstractSpan activeSpan = ContextManager.createLocalSpan(enhanceRequireObjectCache.getOperationNamePrefix() + "/Execution");
|
||||
activeSpan.setComponent(ComponentsDefine.HYSTRIX);
|
||||
ContextManager.continued(snapshot);
|
||||
if (snapshot != null) {
|
||||
ContextManager.continued(snapshot);
|
||||
}
|
||||
// Because of `fall back` method running in other thread. so we need capture concurrent span for tracing.
|
||||
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ public class SWExecutionHookWrapper extends HystrixCommandExecutionHook {
|
|||
public <T> void onStart(HystrixInvokable<T> commandInstance) {
|
||||
EnhancedInstance enhancedInstance = (EnhancedInstance)commandInstance;
|
||||
EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache)enhancedInstance.getSkyWalkingDynamicField();
|
||||
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
|
||||
if (ContextManager.isActive()) {
|
||||
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
|
||||
}
|
||||
actual.onStart(commandInstance);
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +168,9 @@ public class SWExecutionHookWrapper extends HystrixCommandExecutionHook {
|
|||
@Override public <T> void onStart(HystrixCommand<T> commandInstance) {
|
||||
EnhancedInstance enhancedInstance = (EnhancedInstance)commandInstance;
|
||||
EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache)enhancedInstance.getSkyWalkingDynamicField();
|
||||
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
|
||||
if (ContextManager.isActive()) {
|
||||
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
|
||||
}
|
||||
actual.onStart(commandInstance);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue