ensures Tracing ThreadLocal are cleaned (#2236)

* ensures Tracing ThreadLocal are cleaned

Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>

* adds test

Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>

Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
This commit is contained in:
Oleh Dokuka
2022-11-29 16:22:46 +02:00
committed by GitHub
parent f0f4444a37
commit a6e1dcbfcd
3 changed files with 51 additions and 1 deletions

View File

@@ -246,6 +246,8 @@ public class TraceWebFilter implements WebFilter, Ordered, ApplicationContextAwa
final Span span;
final Tracer tracer;
final ServerWebExchange exchange;
final HttpServerHandler handler;
@@ -254,6 +256,7 @@ public class TraceWebFilter implements WebFilter, Ordered, ApplicationContextAwa
MonoWebFilterTrace parent) {
this.actual = actual;
this.span = span;
this.tracer = parent.tracer;
this.context = ReactorSleuth.wrapContext(context.put(TraceContext.class, span.context()));
this.exchange = parent.exchange;
this.handler = parent.handler;
@@ -299,6 +302,7 @@ public class TraceWebFilter implements WebFilter, Ordered, ApplicationContextAwa
if (log.isDebugEnabled()) {
log.debug("Handled send of " + this.span);
}
tracer.withSpan(null);
}
private void addClassMethodTag(Object handler, Span span) {