Skip to content
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

Laminar does not work when we specify NODE_OPTIONS for opentelemetry #231

Open
Mohit21GoJs opened this issue Nov 21, 2024 · 5 comments
Open
Labels
bug Something isn't working question Further information is requested

Comments

@Mohit21GoJs
Copy link

When i specify env variable NODE_OPTIONS=--require @opentelemetry/auto-instrumentations-node/register as recommended here

Throws error:

Error: @opentelemetry/api: Attempted duplicate registration of API: trace
    at registerGlobal (/usr/src/app/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/internal/global-utils.ts:47:17)
    at TraceAPI.setGlobalTracerProvider (/usr/src/app/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/api/trace.ts:67:35)
    at NodeTracerProvider.register (/usr/src/app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/sdk-trace-base/src/BasicTracerProvider.ts:153:11)
    at NodeTracerProvider.register (/usr/src/app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/sdk-trace-node/src/NodeTracerProvider.ts:68:11)
    at startTracing (/usr/src/app/node_modules/.pnpm/@[email protected]/node_modules/@lmnr-ai/lmnr/src/sdk/tracing/index.ts:257:12)
    at initialize (/usr/src/app/node_modules/.pnpm/@[email protected]/node_modules/@lmnr-ai/lmnr/src/sdk/configuration/index.ts:52:3)
    at Function.initialize (/usr/src/app/node_modules/.pnpm/@[email protected]/node_modules/@lmnr-ai/lmnr/src/laminar.ts:128:5)

Is there something we can do to enable this option and still use laminar?

@Mohit21GoJs Mohit21GoJs changed the title Laminar does not play well when we specify NODE_OPTIONS for opentelemetry Laminar does not work when we specify NODE_OPTIONS for opentelemetry Nov 21, 2024
@dinmukhamedm dinmukhamedm added bug Something isn't working question Further information is requested labels Nov 22, 2024
@dinmukhamedm
Copy link
Member

Hey @Mohit21GoJs thanks for reporting. We will have a look and let you know

@dinmukhamedm
Copy link
Member

I was able to reproduce. While I am investigating further, I can say that auto-instrumented spans seem unaffected as well as the attributes you set manually with Laminar.setSpanAttributes, so if this is blocking you from something – it should not, you can proceed even though you see this message in console.

It does, however, mess up some of the things we set in our SDK such as span path and span type attributes, so I am continuing investigation.

@Mohit21GoJs
Copy link
Author

Hi @dinmukhamedm Is there any update on this? It would be helpful to know the fix as we are preparing for production release of our app integrated with laminar and this is a blocker for us, could you please suggest a way to help us leverage laminar in production?

@dinmukhamedm
Copy link
Member

Hey @Mohit21GoJs. I do have a temporary fix in place, but I was not willing to release it, since it is flaky, and I have not had time to test it. In addition it is clearly a temporary solution.

But I understand that this is a blocker to you, so if you are ok with switching to an alpha channel, I can release the fix as 0.4.24-alpha.0 and provide additional instructions on how to use it. Please note that this may never reach a stable version.

Would you like me to do that?

@dinmukhamedm
Copy link
Member

@Mohit21GoJs alright, I published it anyway as part of 0.4.24. We may remove this in later versions.

The way to use it is to pass useExternalTracerProvider: true to Laminar.initialize. Let us know if that solves your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants