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

[operator/nodejs] document disabling node auto-instrumentations #4824

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions content/en/docs/kubernetes/operator/automatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,32 @@ spec:
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}

For more details, see
Expand Down
43 changes: 37 additions & 6 deletions content/en/docs/zero-code/js/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,52 @@ For example, to only enable the `env` and `host` detectors, you can set:
OTEL_NODE_RESOURCE_DETECTORS=env,host
```

### Excluding instrumentation libraries
## Excluding instrumentation libraries

By default, all
[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
`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.
are enabled, but you can use environment variables to enable or disable specific
instrumentations.

### 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
[@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
[@opentelemetry/instrumentation-express](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express)
instrumentations:

```shell
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 %}}