Should detach span from trace filter for async; fixes #728

This commit is contained in:
Marcin Grzejszczak
2018-01-20 16:58:03 +01:00
parent 9056db494b
commit 2bd669cb2c
3 changed files with 5 additions and 12 deletions

View File

@@ -172,9 +172,9 @@ public class TraceFilter extends GenericFilterBean {
} finally {
if (isAsyncStarted(request) || request.isAsyncStarted()) {
if (log.isDebugEnabled()) {
log.debug("The span " + spanFromRequest + " will get detached by a HandleInterceptor");
log.debug("The span " + this.tracer.getCurrentSpan() + " will get detached");
}
// TODO: how to deal with response annotations and async?
this.tracer.detach(this.tracer.getCurrentSpan());
return;
}
detachOrCloseSpans(request, response, spanFromRequest, exception);

View File

@@ -68,6 +68,7 @@ public class TraceHandlerInterceptor extends HandlerInterceptorAdapter {
String spanName = spanName(handler);
boolean continueSpan = getRootSpanFromAttribute(request) != null;
Span span = continueSpan ? getRootSpanFromAttribute(request) : getTracer().createSpan(spanName);
getTracer().continueSpan(span);
if (log.isDebugEnabled()) {
log.debug("Handling span " + span);
}