opentelemetry-js: getExtractedSpanContext does not return correct result with multiple versions of @opentelemetry/core are installed

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

My tracer is v0.9.0, and a plugin is using v0.8.3

What version of Node are you using?

v13.11.0

What did you do?

My project has a tracer with v0.9.0, and is using a plugin with v0.8.3.

  1. I extracted a propagated context with propagation.extract(...), under the hood, this operation calls _getGlobalPropagator which return the v0.9.0 propagator which then calls the setExtractedSpanContext v.0.9.0 function.
  2. I called the getExtractedSpanContext function on the Context from 1, which uses the v0.8.3 version.

What did you expect to see?

I expected the getExtractedSpanContext function to return the extractedSpanContext which is set on the Context

What did you see instead?

The function falsly returns undefined.

Additional context

I think the issue is that Context.createKey is creating a regular Symbol, which means that every version in node_modules will have a unique symbol for that version, instead of creating it globally with Symbol.for(), like here

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I will open a PR to illustrate

I agree, option 1 is also the option with the least impact. (no api or behavior change)