From d9f09e6af5f8e05ae3f88c728da5ebf3bdcbe1da Mon Sep 17 00:00:00 2001 From: Luca Abbati Date: Fri, 30 Aug 2019 12:23:41 +0200 Subject: [PATCH] Minor refacotrings to JaxRsAnnotationsInstrumentation.java --- .../instrumentation/jaxrs/JaxRsAnnotationsDecorator.java | 2 +- .../jaxrs/JaxRsAnnotationsInstrumentation.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java b/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java index 566eda4702..0949e11af3 100644 --- a/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java +++ b/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java @@ -59,7 +59,7 @@ public class JaxRsAnnotationsDecorator extends BaseDecorator { /** * Returns the resource name given a JaxRS annotated method. Results are cached so this method can - * be called multiple times without significantly impacting on performance. + * be called multiple times without significantly impacting performance. * * @return The result can be an empty string but will never be {@code null}. */ diff --git a/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsInstrumentation.java b/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsInstrumentation.java index 12d30fa3a4..988294bddf 100644 --- a/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsInstrumentation.java +++ b/dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsInstrumentation.java @@ -60,10 +60,10 @@ public final class JaxRsAnnotationsInstrumentation extends Instrumenter.Default @Advice.OnMethodEnter(suppress = Throwable.class) public static Scope nameSpan(@Advice.Origin final Method method) { + Tracer tracer = GlobalTracer.get(); // Rename the parent span according to the path represented by these annotations. - final Scope parent = GlobalTracer.get().scopeManager().active(); - Tracer.SpanBuilder span = GlobalTracer.get().buildSpan(JAX_ENDPOINT_OPERATION_NAME); - Scope scope = span.startActive(true); + final Scope parent = tracer.scopeManager().active(); + Scope scope = tracer.buildSpan(JAX_ENDPOINT_OPERATION_NAME).startActive(true); DECORATE.updateParent(parent, method); DECORATE.updateCurrentScope(scope, method); return DECORATE.afterStart(scope);