From 31aa0915c346ebbe0e1ef1fb6042b4fcbb9b524e Mon Sep 17 00:00:00 2001 From: Ats Uiboupin Date: Tue, 12 Mar 2024 09:56:52 +0200 Subject: [PATCH] doc(k8s-operator): document customizing enabled auto-instrumentations for nodejs with kubernetes-operator Closes 4130 --- .../en/docs/kubernetes/operator/automatic.md | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/content/en/docs/kubernetes/operator/automatic.md b/content/en/docs/kubernetes/operator/automatic.md index 10899e528c46..41c841d23a69 100644 --- a/content/en/docs/kubernetes/operator/automatic.md +++ b/content/en/docs/kubernetes/operator/automatic.md @@ -282,12 +282,22 @@ must be able to receive OTLP over `grpc`. Therefore, the example uses #### Excluding auto-instrumentation {#js-excluding-auto-instrumentation} -By default, the Node.js auto-instrumentation ships with -[many instrumentation libraries](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#supported-instrumentations). -At the moment, there is no way to opt-in to only specific packages or disable -specific packages. If you don't want to use a package included by the default -image you must either supply your own image that includes only the packages you -want or use manual instrumentation. +By default, the Node.js auto-instrumentation has all the instrumentation libraries enabled. + +To enable only specific instrumentations you can use the `OTEL_NODE_ENABLED_INSTRUMENTATIONS` environment variable as documented in the +[Node.js auto-instrumentation documentation](/docs/languages/js/automatic/configuration/#excluding-auto-instrumentation). + +```yaml +apiVersion: opentelemetry.io/v1alpha1 +kind: Instrumentation +# ... other fields skipped from this example +spec: + # ... other fields skipped from this example + nodejs: + env: + - name: OTEL_NODE_ENABLED_INSTRUMENTATIONS + value: http,nestjs-core # comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix. +``` #### Learn more {#js-learn-more}