Skip to content

fix(opentelemetry): make @opentelemetry/api a peer dependency - #59

Merged
andra-sava merged 2 commits into
mainfrom
fix/opentelemetry-api-peer-dependency
Nov 3, 2026
Merged

andra-sava merged 2 commits into
mainfrom
fix/opentelemetry-api-peer-dependency

Conversation

@andra-sava

Copy link
Copy Markdown
Contributor

@opentelemetry/api keeps its state in one process-wide global and refuses registrations from a different version. Declaring it as a regular dependency let package managers nest a private copy (e.g. api 1.9.1 inside @totalsoft/metrics next to the app's api 1.10), which made the SDK's tracer registration fail and silently disabled tracing.

  • metrics, pino-opentelemetry, opentelemetry-instrumentation-ws: api is now a peer dependency (>=1.9.0 <1.11.0), kept as a devDependency for tests.
  • opentelemetry-instrumentation-ws: also peer-depend on @opentelemetry/instrumentation and @opentelemetry/core, which are imported at runtime but were only devDependencies.

@opentelemetry/api keeps its state in one process-wide global and refuses
registrations from a different version. Declaring it as a regular dependency
let package managers nest a private copy (e.g. api 1.9.1 inside
@totalsoft/metrics next to the app's api 1.10), which made the SDK's tracer
registration fail and silently disabled tracing.

- metrics, pino-opentelemetry, opentelemetry-instrumentation-ws: api is now a
  peer dependency (>=1.9.0 <1.11.0), kept as a devDependency for tests.
- opentelemetry-instrumentation-ws: also peer-depend on
  @opentelemetry/instrumentation and @opentelemetry/core, which are imported
  at runtime but were only devDependencies.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ac49702

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@totalsoft/metrics Major
@totalsoft/pino-opentelemetry Major
@totalsoft/opentelemetry-instrumentation-ws Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

The <1.11.0 upper bound would block compatible 1.x releases. ^1.9.0 matches
the convention of the other OpenTelemetry libraries and only excludes 2.x.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fraliv13
fraliv13 self-requested a review November 3, 2026 13:28
@andra-sava
andra-sava merged commit 7c6fb00 into main Nov 3, 2026
1 check passed
@andra-sava
andra-sava deleted the fix/opentelemetry-api-peer-dependency branch November 3, 2026 13:29
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.

2 participants