Set resource name in a way that doesn't need to reference DDSpanBuilder
MODIFY
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceAdvice.java
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceAdvice.java
@@ -2,7 +2,7 @@ package datadog.trace.instrumentation.trace_annotation;
import static datadog.trace.instrumentation.trace_annotation.TraceDecorator.DECORATE;
-import datadog.opentracing.DDTracer;
+import datadog.trace.api.DDTags;
import datadog.trace.api.Trace;
import io.opentracing.Scope;
import io.opentracing.Tracer;
@@ -23,10 +23,8 @@ public class TraceAdvice {
Tracer.SpanBuilder spanBuilder = GlobalTracer.get().buildSpan(operationName);
final String resourceName = traceAnnotation == null ? null : traceAnnotation.resourceName();
- if (resourceName != null
- && !resourceName.isEmpty()
- && spanBuilder instanceof DDTracer.DDSpanBuilder) {
- spanBuilder = ((DDTracer.DDSpanBuilder) spanBuilder).withResourceName(resourceName);
+ if (resourceName != null && !resourceName.isEmpty()) {
+ spanBuilder = spanBuilder.withTag(DDTags.RESOURCE_NAME, resourceName);
}
return DECORATE.afterStart(spanBuilder.startActive(true));

MODIFY
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceAnnotationsInstrumentation.java
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceAnnotationsInstrumentation.java
@@ -85,9 +85,7 @@ public final class TraceAnnotationsInstrumentation extends Instrumenter.Default
@Override
public String[] helperClassNames() {
return new String[] {
- "datadog.trace.agent.decorator.BaseDecorator",
- "datadog.opentracing.DDTracer$DDSpanBuilder",
- packageName + ".TraceDecorator",
+ "datadog.trace.agent.decorator.BaseDecorator", packageName + ".TraceDecorator",
};
}

MODIFY
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceConfigInstrumentation.java
dd-java-agent/instrumentation/trace-annotation/src/main/java/datadog/trace/instrumentation/trace_annotation/TraceConfigInstrumentation.java
@@ -123,9 +123,7 @@ public class TraceConfigInstrumentation implements Instrumenter {
@Override
public String[] helperClassNames() {
return new String[] {
- "datadog.trace.agent.decorator.BaseDecorator",
- "datadog.opentracing.DDTracer$DDSpanBuilder",
- packageName + ".TraceDecorator",
+ "datadog.trace.agent.decorator.BaseDecorator", packageName + ".TraceDecorator",
};
}

Set resource name in a way that doesn't need to reference DDSpanBuilder