提交 d996d7bf 编写于 作者: 于玉桔 提交者: wu-sheng

fix (#3057)

上级 faec2b02
......@@ -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());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册