dd-trace-java
dd-trace-java copied to clipboard
OpenTelemetry span builder uses span name as resource name instead of operation name.
See https://github.com/DataDog/dd-trace-java/blob/51d3ceee8d9a211160df9b0e43d233d7f115fc1a/dd-java-agent/agent-otel/otel-shim/src/main/java/datadog/opentelemetry/shim/trace/OtelTracer.java#L24
Unlike in the opentracing tracer we pass SPAN_KIND_INTERNAL as the operationName to the delegate tracer, instead of the span name passed in to spanBuilder. Then passes the spanName as the resource name.
Is there a reason for this inconsistency?
Or was the intent that SPAN_KIND_INTERNAL was mean to be the span kind, but was actually passed as the operation name?
OpenTelemetry doesn't really have an equivalent to Datadog's operation name. OpenTelemetry's span name is closest to Datadog's resource name.
@PerfectSlayer can probably provide a bit more detail.
Hi @tmccombs
As Doug said, there is no operation name concept from OTel.
So yes, it is intended to set SPAN_KIND_INTERNAL at span creation.
It is used as a maker to later check if you don’t update it (using the Datadog Tracing API).
If you don’t, we will try to compute a better operation name from heuristics at the span end:
https://github.com/DataDog/dd-trace-java/blob/4cdcb05acd79d4fb971e148a58964ebadbeb91e0/dd-java-agent/agent-otel/otel-shim/src/main/java/datadog/opentelemetry/shim/trace/OtelSpan.java#L118-L122
https://github.com/DataDog/dd-trace-java/blob/a2484381ac555276328f15d14cc8162e8c3abc5d/dd-java-agent/agent-otel/otel-shim/src/main/java/datadog/opentelemetry/shim/trace/OtelConventions.java#L121-L126
I hope that clarifies the naming behavior Best, Bruce
Ah! that explains why I was seeing the operation name as "client.request" instead of "internal".
For context, I tried migrating some code from the OpenTracing API to the OpenTelemetry API, and expected the span name to behave similarly, but the operation name changed.