Enable async propagation in JAX annotation span

This commit is contained in:
Tyler Benson 2019-09-17 11:35:10 -07:00
parent cfd96850e0
commit 80185f76f4
1 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.context.TraceScope;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
@ -64,6 +65,11 @@ public final class JaxRsAnnotationsInstrumentation extends Instrumenter.Default
// Rename the parent span according to the path represented by these annotations.
final Scope parent = tracer.scopeManager().active();
final Scope scope = tracer.buildSpan(JAX_ENDPOINT_OPERATION_NAME).startActive(true);
if (scope instanceof TraceScope) {
((TraceScope) scope).setAsyncPropagation(true);
}
DECORATE.onControllerStart(scope, parent, method);
return DECORATE.afterStart(scope);
}