-
Notifications
You must be signed in to change notification settings - Fork 953
Description
Is your feature request related to a problem? Please describe.
My product is an API that provides web components to be consumed by other products.
When a client consuming my API has opentelemetry, my traces are sent to their collectors (or their traces are sent to mine).
Describe the solution you'd like
I would like to have my traces sent to my collector independent if my client is using opentelemetry or not.
Additional context
This is happening because Opentelemetry has a global Symbol where it keeps and share its state between its own packages.
This symbol is created by Symbol.for(...) in your global-utils.ts
https://github.com/open-telemetry/opentelemetry-js/blob/main/api/src/internal/global-utils.ts
Since Symbol.for(...) returns same Symbol for given string, different opentelemetry instances/versions are sharing same state, mixing traces and sending to wrong collector.
Switching it to Symbol(...) might fix this issue.
Besides this shared state, opentelemetry-instrumentation-fetch is also not built to work with multiple instances.
opentelemetry-instrumentation-fetch is unwrapping fetch if it is already wrapped
https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L662
Basically if my client uses opentelemetry-instrumentation-fetch my API is going to unwrap their version to add mine, or their implementation is going unwrap mine to add theirs.
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.