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

propagation.extract is not working as expected since Deno 2.1.5 #28082

Open
kawmra opened this issue Feb 12, 2025 · 2 comments
Open

propagation.extract is not working as expected since Deno 2.1.5 #28082

kawmra opened this issue Feb 12, 2025 · 2 comments
Labels

Comments

@kawmra
Copy link

kawmra commented Feb 12, 2025

Version: Deno 2.1.5

Since Deno 2.1.5, propagation.extract in OpenTelemetry has stopped functioning correctly.

In Deno 2.1.4, the following code worked as expected:

import { context, propagation, trace } from "npm:@opentelemetry/api@1";
import { W3CTraceContextPropagator } from "npm:@opentelemetry/core@1";

propagation.setGlobalPropagator(new W3CTraceContextPropagator());

const carrier = {
  traceparent: "00-00000000000000000000000000000001-0000000000000001-01",
  tracestate: undefined,
};

const newContext = propagation.extract(context.active(), carrier);
console.log(trace.getSpan(newContext)?.spanContext());

Running this code produces the following output:

{
  traceId: "00000000000000000000000000000001",
  spanId: "0000000000000001",
  traceFlags: 1,
  isRemote: true
}

However, when executing the same code in Deno 2.1.5, undefined is returned instead.

When running it in Deno 2.1.5, the OTEL_DENO=true environment variable was set.

Am I missing something?

@lucacasonato
Copy link
Member

Ack - a very temporary workaround: you can do globalThis[Symbol.for("opentelemetry.js.api.1")].propagation = new W3CTraceContextPropagator(); for now.

This is related to us automatically registering tracer / metrics / context handling for @opentelemetry/api now.

@kawmra
Copy link
Author

kawmra commented Feb 13, 2025

Thank you for your quick response!
I'll try the workaround. I'm looking forward to OTEL being officially supported 🥰

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

No branches or pull requests

2 participants