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

How to disable specific library instrumentation for NodeJS ? #1283

Closed
santoshkashyap opened this issue Nov 28, 2022 · 3 comments
Closed

How to disable specific library instrumentation for NodeJS ? #1283

santoshkashyap opened this issue Nov 28, 2022 · 3 comments

Comments

@santoshkashyap
Copy link

Hi,

I have setup opentelemetry-operator on our cluster. For NodeJS workload on the cluster I have added the pod annotation :

# (namespace/instrumentation CR name)
annotations:
  instrumentation.opentelemetry.io/inject-nodejs: cls-opentelemetry/opentelemetry-instrumentation

I have configured daemonset for instrumentation. So far everything works fine, but the auto-instrumentation generates lots of spans for our NodeJS application. I'm only interested in spans from the library @opentelemetry/instrumentation-http and not others. So is it possible to disable auto-instrumentation for other libraries eg: @opentelemetry/instrumentation-connect via env variables or even better if could setup the auto-instrumentation only for specific libraries as required?

I checked instrumentation-spec-nodejs to add specific env via instrumentation CR, but not sure how to pass specific library as a value ?

For JavaAgent based instrumentation, disabling auto-instrumentation for specific library already seems to be possible as explained in suppressing-specific-agent-instrumentation. Something like this for NodeJS would be nice . Thanks in advance!

Best,
Santosh

@mat-rumian
Copy link
Contributor

Hey @santoshkashyap,
as you mentioned it's possible to disable specific instrumentation in case of OpenTelemetry Auto Instrumentation for Java (javaagent). For NodeJS it's not possible at least on the environment variables configuration level.

OpenTelemetry Operator is a "client" of OpenTelemetry upstream instrumentation. So if you would like to have this kind of functionality I think you should create an issue in OpenTelemetry JS Contrib repository and ask for changes in @opentelemetry/auto-instrumentations-node package.

@santoshkashyap
Copy link
Author

@mat-rumian , Thank you for your answer. I will create a request on the auto-instrumentation package.

@mderazon
Copy link

Hi. I also would like to disable an instrumentation. Seems like @opentelemetry/instrumentation-fs is causing a lot of unnecessary traces and is recommended to be disabled:
open-telemetry/opentelemetry-js-contrib#1344 (comment)

It's possible to disable it via node auto instrumentation:
open-telemetry/opentelemetry.io#2988 (review)

https://github.com/open-telemetry/opentelemetry.io/blob/16328c6c00bb5c163f200b22ef90b881a80a86d1/content/en/docs/languages/js/libraries.md?plain=1#L145-L154

But I am not sure how to do it through otel operator ?

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

No branches or pull requests

3 participants