Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry span builder uses span name as resource name instead of operation name. #7556

Open
tmccombs opened this issue Sep 3, 2024 · 3 comments
Labels
inst: opentelemetry OpenTelemetry instrumentation type: question

Comments

@tmccombs
Copy link

tmccombs commented Sep 3, 2024

See

this.tracer.buildSpan(INSTRUMENTATION_NAME, SPAN_KIND_INTERNAL).withResourceName(spanName);

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?

@dougqh
Copy link
Contributor

dougqh commented Sep 4, 2024

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.

@PerfectSlayer
Copy link
Contributor

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:

public void end() {
this.recording = false;
applyNamingConvention(this.delegate);
this.delegate.finish();
}

public static void applyNamingConvention(AgentSpan span) {
// Check if span operation name is unchanged from its default value
if (span.getOperationName() == SPAN_KIND_INTERNAL) {
span.setOperationName(computeOperationName(span).toLowerCase(ROOT));
}
}

I hope that clarifies the naming behavior
Best,
Bruce

@PerfectSlayer PerfectSlayer added type: question inst: opentelemetry OpenTelemetry instrumentation labels Sep 5, 2024
@tmccombs
Copy link
Author

tmccombs commented Sep 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: opentelemetry OpenTelemetry instrumentation type: question
Projects
None yet
Development

No branches or pull requests

3 participants