Skip to content

Commit 0c5f7c2

Browse files
authored
Tag span metrics with 'otel.library' when we know it was created by an OTel extension (#7463)
Metrics for spans created manually via the OTel API continue to be tagged with 'otel'.
1 parent 5ae921b commit 0c5f7c2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • dd-java-agent/agent-otel/otel-shim/src/main/java/datadog/opentelemetry/shim/trace

dd-java-agent/agent-otel/otel-shim/src/main/java/datadog/opentelemetry/shim/trace/OtelTracer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
@ParametersAreNonnullByDefault
1111
class OtelTracer implements Tracer {
12-
private static final String INSTRUMENTATION_NAME = "otel";
12+
private static final String INSTRUMENTATION_NAME = otelInstrumentationName();
1313
private final AgentTracer.TracerAPI tracer;
1414
private final String instrumentationScopeName;
1515

@@ -24,4 +24,12 @@ public SpanBuilder spanBuilder(String spanName) {
2424
this.tracer.buildSpan(INSTRUMENTATION_NAME, SPAN_KIND_INTERNAL).withResourceName(spanName);
2525
return new OtelSpanBuilder(delegate);
2626
}
27+
28+
@SuppressWarnings("ConstantConditions")
29+
private static String otelInstrumentationName() {
30+
// is this the bootstrap shim for drop-in support, or the shim for manual instrumentation?
31+
return OtelTracer.class.getName().startsWith("datadog.trace.bootstrap")
32+
? "otel.library"
33+
: "otel";
34+
}
2735
}

0 commit comments

Comments
 (0)