AWS v2: use scope when span is created

This commit is contained in:
Nikolay Martynov 2019-04-04 15:49:35 -04:00
parent 480a14b170
commit 0e7418fde6
1 changed files with 4 additions and 2 deletions

View File

@ -34,8 +34,10 @@ public class TracingExecutionInterceptor implements ExecutionInterceptor {
public void beforeExecution(
final Context.BeforeExecution context, final ExecutionAttributes executionAttributes) {
final Span span = GlobalTracer.get().buildSpan("aws.command").start();
DECORATE.afterStart(span);
executionAttributes.putAttribute(SPAN_ATTRIBUTE, span);
try (final Scope scope = GlobalTracer.get().scopeManager().activate(span, false)) {
DECORATE.afterStart(span);
executionAttributes.putAttribute(SPAN_ATTRIBUTE, span);
}
}
@Override