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 5 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
17 changes: 17 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,23 @@ 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 as documented in the
[Node.js zero-code instrumentation documentation](/docs/zero-code/js/configuration/#excluding-instrumentation-libraries).
JamieDanielson marked this conversation as resolved.
Show resolved Hide resolved

```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.
```

#### Learn more {#js-learn-more}

For more details, see
Expand Down
34 changes: 28 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,43 @@ 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 package 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 package 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 package 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"
```