Combine onControllerStart and onAbort
MODIFY
dd-java-agent/instrumentation/jax-rs-annotations-2/jax-rs-annotations-2.gradle
dd-java-agent/instrumentation/jax-rs-annotations-2/jax-rs-annotations-2.gradle
@@ -41,6 +41,7 @@ dependencies {
testCompile group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner', version: '2.9.10'
latestDepTestCompile group: 'io.dropwizard', name: 'dropwizard-testing', version: '1.+'
+
// Resteasy
testCompile group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.0.0.Final'

MODIFY
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/AbstractRequestContextInstrumentation.java
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/AbstractRequestContextInstrumentation.java
@@ -75,11 +75,11 @@ public abstract class AbstractRequestContextInstrumentation extends Instrumenter
scope.setAsyncPropagation(true);
DECORATE.afterStart(span);
- DECORATE.onAbort(span, parent, resourceClass, method);
+ DECORATE.onJaxRsSpan(span, parent, resourceClass, method);
return scope;
} else {
- DECORATE.onAbort(span, parent, resourceClass, method);
+ DECORATE.onJaxRsSpan(span, parent, resourceClass, method);
return null;
}
} else {

MODIFY
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/DefaultRequestContextInstrumentation.java
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/DefaultRequestContextInstrumentation.java
@@ -45,7 +45,7 @@ public class DefaultRequestContextInstrumentation extends AbstractRequestContext
scope.setAsyncPropagation(true);
DECORATE.afterStart(span);
- DECORATE.onAbort(span, parent, filterClass, method);
+ DECORATE.onJaxRsSpan(span, parent, filterClass, method);
return scope;
}

MODIFY
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/JaxRsAnnotationsDecorator.java
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/JaxRsAnnotationsDecorator.java
@@ -44,36 +44,10 @@ public class JaxRsAnnotationsDecorator extends BaseDecorator {
return "jax-rs-controller";
}
- public void onControllerStart(
+ public void onJaxRsSpan(
final AgentSpan span, final AgentSpan parent, final Class target, final Method method) {
- final String resourceName = getPathResourceName(target, method);
-
- decorateJaxRsSpan(span, parent, target, method, resourceName);
- }
- public void onAbort(
- final AgentSpan span, final AgentSpan parent, final Class target, final Method method) {
final String resourceName = getPathResourceName(target, method);
-
- decorateJaxRsSpan(span, parent, target, method, resourceName);
- }
-
- public void onAbort(
- final AgentSpan span,
- final AgentSpan parent,
- final Class target,
- final Method method,
- final String resourceName) {
-
- decorateJaxRsSpan(span, parent, target, method, resourceName);
- }
-
- private void decorateJaxRsSpan(
- final AgentSpan span,
- final AgentSpan parent,
- final Class target,
- final Method method,
- final String resourceName) {
updateParent(parent, resourceName);
span.setTag(DDTags.SPAN_TYPE, DDSpanTypes.HTTP_SERVER);

MODIFY
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/JaxRsAnnotationsInstrumentation.java
dd-java-agent/instrumentation/jax-rs-annotations-2/src/main/java/datadog/trace/instrumentation/jaxrs2/JaxRsAnnotationsInstrumentation.java
@@ -82,7 +82,7 @@ public final class JaxRsAnnotationsInstrumentation extends Instrumenter.Default
final AgentSpan parent = activeSpan();
final AgentSpan span = startSpan(JAX_ENDPOINT_OPERATION_NAME);
- DECORATE.onControllerStart(span, parent, target.getClass(), method);
+ DECORATE.onJaxRsSpan(span, parent, target.getClass(), method);
DECORATE.afterStart(span);
final AgentScope scope = activateSpan(span, false);

Combine onControllerStart and onAbort