[operator/nodejs] document disabling node auto-instrumentations (#4824)
This commit is contained in:
parent
bf49f3af61
commit
114d136a9a
|
|
@ -300,6 +300,32 @@ spec:
|
||||||
value: http,nestjs-core # comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix.
|
value: http,nestjs-core # comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To keep all default libraries and disable only specific instrumentation
|
||||||
|
libraries you can use the `OTEL_NODE_DISABLED_INSTRUMENTATIONS` environment
|
||||||
|
variable. For details, see
|
||||||
|
[Excluding instrumentation libraries](/docs/zero-code/js/configuration/#excluding-instrumentation-libraries).
|
||||||
|
|
||||||
|
```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_DISABLED_INSTRUMENTATIONS
|
||||||
|
value: fs,grpc # comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix.
|
||||||
|
```
|
||||||
|
|
||||||
|
{{% alert title="Note" color="info" %}}
|
||||||
|
|
||||||
|
If both environment variables are set, `OTEL_NODE_ENABLED_INSTRUMENTATIONS` is
|
||||||
|
applied first, and then `OTEL_NODE_DISABLED_INSTRUMENTATIONS` is applied to that
|
||||||
|
list. Therefore, if the same instrumentation is included in both lists, that
|
||||||
|
instrumentation will be disabled.
|
||||||
|
|
||||||
|
{{% /alert %}}
|
||||||
|
|
||||||
#### Learn more {#js-learn-more}
|
#### Learn more {#js-learn-more}
|
||||||
|
|
||||||
For more details, see
|
For more details, see
|
||||||
|
|
|
||||||
|
|
@ -45,17 +45,22 @@ For example, to only enable the `env` and `host` detectors, you can set:
|
||||||
OTEL_NODE_RESOURCE_DETECTORS=env,host
|
OTEL_NODE_RESOURCE_DETECTORS=env,host
|
||||||
```
|
```
|
||||||
|
|
||||||
### Excluding instrumentation libraries
|
## Excluding instrumentation libraries
|
||||||
|
|
||||||
By default, all
|
By default, all
|
||||||
[supported instrumentation libraries](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#supported-instrumentations)
|
[supported instrumentation libraries](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#supported-instrumentations)
|
||||||
are enabled, but you can use the environment variable
|
are enabled, but you can use environment variables to enable or disable specific
|
||||||
`OTEL_NODE_ENABLED_INSTRUMENTATIONS` to enable only certain instrumentations by
|
instrumentations.
|
||||||
providing a comma-separated list of the instrumentation library names without
|
|
||||||
the `@opentelemetry/instrumentation-` prefix.
|
### Enable specific instrumentations
|
||||||
|
|
||||||
|
Use the environment variable `OTEL_NODE_ENABLED_INSTRUMENTATIONS` to enable only
|
||||||
|
certain instrumentations by providing a comma-separated list of the
|
||||||
|
instrumentation library names without the `@opentelemetry/instrumentation-`
|
||||||
|
prefix.
|
||||||
|
|
||||||
For example, to enable only
|
For example, to enable only
|
||||||
[@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-http)
|
[@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http)
|
||||||
and
|
and
|
||||||
[@opentelemetry/instrumentation-express](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express)
|
[@opentelemetry/instrumentation-express](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express)
|
||||||
instrumentations:
|
instrumentations:
|
||||||
|
|
@ -63,3 +68,29 @@ instrumentations:
|
||||||
```shell
|
```shell
|
||||||
OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,express"
|
OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,express"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disable specific instrumentations
|
||||||
|
|
||||||
|
Use the environment variable `OTEL_NODE_DISABLED_INSTRUMENTATIONS` to keep the
|
||||||
|
fully enabled list and only disable certain instrumentations by providing a
|
||||||
|
comma-separated list of the instrumentation library names without the
|
||||||
|
`@opentelemetry/instrumentation-` prefix.
|
||||||
|
|
||||||
|
For example, to disable only
|
||||||
|
[@opentelemetry/instrumentation-fs](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-fs)
|
||||||
|
and
|
||||||
|
[@opentelemetry/instrumentation-grpc](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc)
|
||||||
|
instrumentations:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
OTEL_NODE_DISABLED_INSTRUMENTATIONS="fs,grpc"
|
||||||
|
```
|
||||||
|
|
||||||
|
{{% alert title="Note" color="info" %}}
|
||||||
|
|
||||||
|
If both environment variables are set, `OTEL_NODE_ENABLED_INSTRUMENTATIONS` is
|
||||||
|
applied first, and then `OTEL_NODE_DISABLED_INSTRUMENTATIONS` is applied to that
|
||||||
|
list. Therefore, if the same instrumentation is included in both lists, that
|
||||||
|
instrumentation will be disabled.
|
||||||
|
|
||||||
|
{{% /alert %}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue