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

Open Telemetry Integration Does not Adhere to Specification #4380

Open
chrisguitarguy opened this issue Jun 5, 2024 · 3 comments
Open

Open Telemetry Integration Does not Adhere to Specification #4380

chrisguitarguy opened this issue Jun 5, 2024 · 3 comments

Comments

@chrisguitarguy
Copy link

chrisguitarguy commented Jun 5, 2024

Specifically this bit

if (key === SPAN_KEY) {
return {
spanContext () {
const activeSpan = tracer.scope().active()
const context = activeSpan && activeSpan.context()
return new SpanContext(context)
}
}
}

Which causes something like this:

import { trace } from '@opentelemetry/api';

const span = trace.getActiveSpan();

To return a span that doesn't actually implement Span (see https://github.com/open-telemetry/opentelemetry-js/blob/957fa3b5e44e43f0cf07adeca8e118f27334dfc3/api/src/trace/span.ts#L33)

Instead it's just a plain object with spanContext and one cannot do something like span.setAttributes(...) that works just fine without datadog's tracer provider.

Would the DD Span implementation alredy take care of this?

spanContext () {
return new SpanContext(this._ddSpan.context())
}

@dpnova
Copy link

dpnova commented Jun 13, 2024

Agreed, there's places where the otel tracer assumes a parent trace is a DD trace too: https://github.com/DataDog/dd-trace-js/blob/master/packages/dd-trace/src/opentelemetry/tracer.js#L36

With DD_TRACE_OTEL_ENABLED this completely breaks

@andrewpuch
Copy link

I'm running into a similar issue as @dpnova where parent is null and parent._traceId throws an error.

@dpnova
Copy link

dpnova commented Jul 22, 2024

I'm running into a similar issue as @dpnova where parent is null and parent._traceId throws an error.

FWIW I left DD_TRACE_OTEL_ENABLED off and manually created the connection between the parent and child span on the boundary of my DD/OTEL traced code. Hope you get it sorted @andrewpuch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants