> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/opentelemetry.md).

# OpenTelemetry

{% hint style="info" %}
**File-based configuration**

You can add `_FILE` to individual variables to provide their configuration in a separate file. Refer to [Keeping sensitive data in separate files](/deploy/host-n8n/configure-n8n/basic-configuration.md#keeping-sensitive-data-in-separate-files) for more details.
{% endhint %}

n8n can export workflow and node execution traces over OTLP to an OpenTelemetry collector. Refer to [OpenTelemetry tracing](/deploy/host-n8n/keep-n8n-running/trace-executions-with-opentelemetry.md) for details.

| Variable                                   | Type    | Default                 | Description                                                                                                                                                                                                | Available from |
| ------------------------------------------ | ------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `N8N_OTEL_ENABLED`                         | Boolean | `false`                 | Whether to enable OpenTelemetry tracing. When set to `false`, n8n doesn't load the OpenTelemetry SDK.                                                                                                      | 2.19.0         |
| `N8N_OTEL_EXPORTER_OTLP_ENDPOINT`          | String  | `http://localhost:4318` | Base URL of the OTLP HTTP endpoint to export traces to. n8n appends the value of `N8N_OTEL_EXPORTER_OTLP_TRACING_PATH` to this URL.                                                                        | 2.19.0         |
| `N8N_OTEL_EXPORTER_OTLP_TRACING_PATH`      | String  | `/v1/traces`            | Path appended to `N8N_OTEL_EXPORTER_OTLP_ENDPOINT` for exporting traces.                                                                                                                                   | 2.19.0         |
| `N8N_OTEL_EXPORTER_OTLP_HEADERS`           | String  | -                       | Comma-separated list of `key=value` pairs to send as HTTP headers with each OTLP request. Use this for authentication tokens or tenant headers. For example: `authorization=Bearer <token>,x-tenant=acme`. | 2.19.0         |
| `N8N_OTEL_EXPORTER_SERVICE_NAME`           | String  | `n8n`                   | Value of the `service.name` resource attribute on exported spans.                                                                                                                                          | 2.19.0         |
| `N8N_OTEL_TRACES_SAMPLE_RATE`              | Number  | `1.0`                   | Fraction of traces to export, between `0` and `1`. n8n uses a trace ID ratio sampler, so all spans in a trace are either sampled or dropped together.                                                      | 2.19.0         |
| `N8N_OTEL_TRACES_INCLUDE_NODE_SPANS`       | Boolean | `true`                  | Whether to emit a `node.execute` span for each node execution. Set to `false` to export workflow-level spans only.                                                                                         | 2.19.0         |
| `N8N_OTEL_TRACES_PRODUCTION_ONLY`          | Boolean | `true`                  | Whether to export traces for [production executions](/build/understand-workflows/understand-executions/types-of-executions.md) only. Set to `false` to export traces for all workflow executions.          | 2.25.2         |
| `N8N_OTEL_TRACES_INJECT_OUTBOUND`          | Boolean | `true`                  | Whether to inject the W3C `traceparent`/`tracesstate` headers into outbound HTTP requests made by nodes that use n8n's HTTP helpers.                                                                       | 2.19.0         |
| `N8N_OTEL_STARTUP_CONNECTIVITY_TIMEOUT_MS` | Number  | `2000`                  | Timeout (in milliseconds) for the startup connectivity check against the OTLP endpoint. n8n logs a warning if the endpoint isn't reachable within this period.                                             | 2.19.0         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/opentelemetry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
