fix (#3057)
This commit is contained in:
parent
faec2b02b4
commit
d996d7bf4a
|
|
@ -157,6 +157,10 @@ public class ContextManager implements BootService {
|
|||
return get().awaitFinishAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
* If not sure has the active span, use this method, will be cause NPE when has no active span,
|
||||
* use ContextManager::isActive method to determine whether there has the active span.
|
||||
*/
|
||||
public static AbstractSpan activeSpan() {
|
||||
return get().activeSpan();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class BaseInterceptorMethods {
|
|||
}
|
||||
|
||||
void handleMethodException(Throwable t) {
|
||||
if (ContextManager.activeSpan() != null) {
|
||||
if (ContextManager.isActive()) {
|
||||
ContextManager.activeSpan().errorOccurred().log(t);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,8 @@ public class FilteringWebHandlerInterceptor implements InstanceMethodsAroundInte
|
|||
ServerWebExchange exchange = (ServerWebExchange) allArguments[0];
|
||||
Route route = exchange.getRequiredAttribute(GATEWAY_ROUTE_ATTR);
|
||||
|
||||
AbstractSpan span = ContextManager.activeSpan();
|
||||
if (span != null) {
|
||||
span.tag("route", route.getId());
|
||||
if (ContextManager.isActive()) {
|
||||
ContextManager.activeSpan().tag("route", route.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue