Warn when two @opentelemetry/api copies load - #1504
Draft
unflxw wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a runtime check to detect when multiple incompatible copies of @opentelemetry/api are loaded in the current process, and emits a warning so span loss due to OpenTelemetry API version arbitration is visible to the application operator.
Changes:
- Introduce
loadedOpenTelemetryApiCopies+duplicateOpenTelemetryApiWarningto detect loaded@opentelemetry/apicopies viarequire.cacheand generate a human-readable warning. - Call the new warning logic during
Clientstartup when the OpenTelemetry SDK is initialized, logging to bothconsole.warnand the internal logger. - Add Jest coverage for the new helper module and a changeset entry documenting the new warning.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/otel_api_copies.ts |
New helpers to detect loaded @opentelemetry/api copies and produce an incompatibility warning message. |
src/client.ts |
Invoke the duplicate-API warning during OpenTelemetry initialization and log it. |
src/__tests__/otel_api_copies.test.ts |
Unit tests for the new helper module (copy detection + warning generation behavior). |
.changesets/warn-about-duplicate-opentelemetry-api-copies.md |
Changeset entry describing the new runtime warning behavior. |
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 10:34
089d8e6 to
6f043b6
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 10:45
6f043b6 to
5194ff6
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 14:24
5194ff6 to
eae13bc
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 14:40
eae13bc to
59b931e
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 14:59
59b931e to
d221474
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 15:06
d221474 to
508986a
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 15:14
508986a to
9282cf0
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 15:15
9282cf0 to
ff5e410
Compare
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 15:22
ff5e410 to
de22309
Compare
An application loading two incompatible copies reports only some of its spans, because the API hands a tracer that drops every span to whichever copy loses the version comparison, which looks the same as an application that produces none. The check reads the module cache rather than walking `node_modules`, since a copy nothing loaded cannot cause this, and says it once per process because which copies are loaded does not change while one is running.
unflxw
force-pushed
the
otel-api-runtime-warning
branch
from
August 25, 2026 15:44
de22309 to
bad32ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1503.
Warn when two @opentelemetry/api copies load
An application loading two incompatible copies reports only some of its
spans, because the API hands a tracer that drops every span to whichever
copy loses the version comparison, which looks the same as an
application that produces none. The check reads the module cache rather
than walking
node_modules, since a copy nothing loaded cannot causethis, and says it once per process because which copies are loaded does
not change while one is running.