Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ public static AbstractTracerContext awaitFinishAsync(AbstractSpan span) {
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void afterMethod(Method method) {
}

void handleMethodException(Throwable t) {
if (ContextManager.activeSpan() != null) {
if (ContextManager.isActive()) {
ContextManager.activeSpan().errorOccurred().log(t);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
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());
}
}

Expand Down