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

doc(k8s-operator): document customizing enabled auto-instrumentations for nodejs with kubernetes-operator #4137

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
24 changes: 18 additions & 6 deletions content/en/docs/kubernetes/operator/automatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,24 @@ 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}

Expand Down
19 changes: 19 additions & 0 deletions content/en/docs/languages/js/automatic/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,22 @@ For example, to only enable the `env` and `host` detectors, you can set:
```shell
OTEL_NODE_RESOURCE_DETECTORS=env,host
```

### Excluding auto-instrumentation

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.

For example, to enable only
[@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/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"
```