-
Notifications
You must be signed in to change notification settings - Fork 39
fix: OpenTelemetry instrumentation packages updates #2054
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
Conversation
kirrg001
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still compatible with Node v18 and with Otel API version >=1.3.
e103c73 to
545ac45
Compare
5c8f56d to
8d4ea7e
Compare
af14bde to
cedf865
Compare
|
A few tests are failing, specifically, the ones that assert Root Cause: Multiple OTEL API instances are being loaded that intercept the tracing Working case: When modules are loaded from the same location (packages/core/node_modules), both the core code and the FS instrumentation share a single OTEL API instance. As a result, spans are created correctly. Non-working case: When the FS instrumentation is loaded from a different location (e.g., root node_modules), it uses a separate OTEL API instance. Since our core code applies monkey patches to its own API instance(packages/code/node_modules), the instrumentation does not receive those patches, causing spans to be missing and tests to fail. |
c3fef76 to
70473cf
Compare
0949a9d to
fc8f9a2
Compare
21be414 to
f3fedf8
Compare
d1b232d to
e5592d2
Compare
e5592d2 to
8be2f32
Compare
Known Issues
|
packages/core/src/tracing/opentelemetry-instrumentations/opentelemetryApi.js
Outdated
Show resolved
Hide resolved
kirrg001
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work <3
This change fixes an issue where multiple instances of @opentelemetry/api were being loaded — one from the application root and another from instana core. This caused the OpenTelemetry integration to not work correctly. By adding dependency with a bounded version range (>=1.3.0 <1.10.0), we ensure that only one compatible version of the API is installed, maintaining consistent behavior across environments. ref #2054 https://jsw.ibm.com/browse/INSTA-59002
7b082c4 to
6891e76
Compare
b54e0dc to
a18aab6
Compare
a18aab6 to
3752d3e
Compare
|
kirrg001
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super sweet



Changes
Load @opentelemetry/api from the app root to ensure all instrumentations and monkey patches share the same global API instance.
Add peer dependency with bounded version range (>=1.3.0 <1.10.0) to enforce compatibility and avoid runtime issues like NonRecordingSpan.
Updated all @opentelemetry instrumentations versions to latest
What This PR resolves
This PR addresses the multiple API instance issue that occurred when @opentelemetry/api was also installed at the application root. In such cases, our openTelemetry integretion was not functioning correctly before.
When the OTEL SDK and our collector are used together within the same application:
If the OTEL SDK is initialized first, it now correctly captures all our instrumented libraries (including our OTEL). Previously, this was not happening. OTEL also works.
If our collector is initialized first, it currently blocks OTEL tracing - this is a known issue and will be addressed separately.
This PR resolves the multiple instance problem. Tests demonstrating OTEL SDK and our collector behaviors will be included in a separate PR.
There is still issue when our collector initialized first.
References:
https://github.com/open-telemetry/opentelemetry-js/issues/4832
open-telemetry/opentelemetry-js#5454
https://jsw.ibm.com/browse/INSTA-59002