Skip to content

Commit 1a20a31

Browse files
authored
doc(k8s-operator): document customizing enabled auto-instrumentations for nodejs with kubernetes-operator (#4137)
1 parent c4532a3 commit 1a20a31

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

content/en/docs/kubernetes/operator/automatic.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,24 @@ must be able to receive OTLP over `grpc`. Therefore, the example uses
282282

283283
#### Excluding auto-instrumentation {#js-excluding-auto-instrumentation}
284284

285-
By default, the Node.js auto-instrumentation ships with
286-
[many instrumentation libraries](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#supported-instrumentations).
287-
At the moment, there is no way to opt-in to only specific packages or disable
288-
specific packages. If you don't want to use a package included by the default
289-
image you must either supply your own image that includes only the packages you
290-
want or use manual instrumentation.
285+
By default, the Node.js auto-instrumentation has all the instrumentation
286+
libraries enabled.
287+
288+
To enable only specific instrumentations you can use the
289+
`OTEL_NODE_ENABLED_INSTRUMENTATIONS` environment variable as documented in the
290+
[Node.js auto-instrumentation documentation](/docs/languages/js/automatic/configuration/#excluding-auto-instrumentation).
291+
292+
```yaml
293+
apiVersion: opentelemetry.io/v1alpha1
294+
kind: Instrumentation
295+
# ... other fields skipped from this example
296+
spec:
297+
# ... other fields skipped from this example
298+
nodejs:
299+
env:
300+
- name: OTEL_NODE_ENABLED_INSTRUMENTATIONS
301+
value: http,nestjs-core # comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix.
302+
```
291303
292304
#### Learn more {#js-learn-more}
293305

content/en/docs/languages/js/automatic/configuration.md

+19
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,22 @@ For example, to only enable the `env` and `host` detectors, you can set:
3939
```shell
4040
OTEL_NODE_RESOURCE_DETECTORS=env,host
4141
```
42+
43+
### Excluding auto-instrumentation
44+
45+
By default, all
46+
[supported instrumentation libraries](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#supported-instrumentations)
47+
are enabled, but you can use the environment variable
48+
`OTEL_NODE_ENABLED_INSTRUMENTATIONS` to enable only certain instrumentations by
49+
providing a comma-separated list of the instrumentation package names without
50+
the `@opentelemetry/instrumentation-` prefix.
51+
52+
For example, to enable only
53+
[@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-http)
54+
and
55+
[@opentelemetry/instrumentation-express](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express)
56+
instrumentations:
57+
58+
```shell
59+
OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,express"
60+
```

0 commit comments

Comments
 (0)