Skip to content

feat(opentelemetry): add support for OTEL v2#2142

Open
chris-olszewski wants to merge 2 commits into
mainfrom
olszewski/feat_otel_v2-clean
Open

feat(opentelemetry): add support for OTEL v2#2142
chris-olszewski wants to merge 2 commits into
mainfrom
olszewski/feat_otel_v2-clean

Conversation

@chris-olszewski

@chris-olszewski chris-olszewski commented Jun 26, 2026

Copy link
Copy Markdown
Member

What was changed

Add a new package that supports OTEL v2 interceptors.

Key changes:

  • Package targets v2 of all OTEL packages it consumes
  • Removed spanExporter support
  • Removed deprecated OpenTelemetryWorkflowClientCallsInterceptor alias
  • Provide our own IdGenerator that consumes a named random stream to make span ID generation deterministic and preventing it from affecting randomness in workflow.

Reviewers should primarily focus on reviewing the second commit as it is the diff between v1 and v2 of this package. The first commit is a straight copy of the v1 package into the v2 directory.

Replacing #1951

Why?

We are adding a new package instead of bumping the dependency on the old one for a few reasons:

  • We do not want to perform a major semver bump on just one of our packages, it confuses our versioning story.
  • We do not want to attempt to support both OTEL major versions in the same code as that becomes extremely hacky and hard to read.
  • We want to correct mistakes in the first OTEL package: removing deprecated functionality and moving to use named random streams so adding these interceptors to a worker no longer can trigger NDE if attempting to replay a workflow started without them.

Quick note on James comment from previous PR

Btw, we now have a preloadedModules bundler option, which may help reduce the overhead associated with per-workflow loading of the OpenTelemetry library.

I don't think this is viable here as registering the tracer provider/context manager in workflow/index.ts mutates the loaded frozen OTEL module.

Checklist

  1. Closes [Feature Request] Add support for opentelemetry v2 #1658

  2. How was this tested:
    Most tests were directly kept. Replay tests had to be dropped as we changed how we used randomness so histories are incompatible. Added history replay tests for this package as regression tests for future changes to this package.

  3. Any docs updates needed?
    Once this moves out of experimental, docs page should update to suggest using this package instead of v1.

@chris-olszewski chris-olszewski force-pushed the olszewski/feat_otel_v2-clean branch from 41ba080 to 0b0f807 Compare June 26, 2026 15:55
@chris-olszewski chris-olszewski force-pushed the olszewski/feat_otel_v2-clean branch from 0b0f807 to 4f3a879 Compare June 26, 2026 16:03
@chris-olszewski chris-olszewski marked this pull request as ready for review June 26, 2026 16:22
@chris-olszewski chris-olszewski requested a review from a team as a code owner June 26, 2026 16:22
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

Successfully merging this pull request may close these issues.

[Feature Request] Add support for opentelemetry v2

1 participant