2022-11-29 14:34:05 +00:00
---
title: "Traefik OpenTelemetry Documentation"
description: "Traefik supports several tracing backends, including OpenTelemetry. Learn how to implement it for observability in Traefik Proxy. Read the technical documentation."
---
# OpenTelemetry
2024-06-27 12:14:03 +00:00
Traefik Proxy follows [official OpenTelemetry semantic conventions v1.26.0 ](https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/http/http-spans.md ).
2022-11-29 14:34:05 +00:00
To enable the OpenTelemetry tracer:
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp: {}
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[tracing]
2024-01-08 08:10:06 +00:00
[tracing.otlp]
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp=true
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
!!! info "Default protocol"
The OpenTelemetry trace exporter will export traces to the collector using HTTP by default to https://localhost:4318/v1/traces, see the [gRPC Section ](#grpc-configuration ) to use gRPC.
2022-11-29 14:34:05 +00:00
!!! info "Trace sampling"
2024-02-06 09:04:05 +00:00
By default, the OpenTelemetry trace exporter will sample 100% of traces.
2022-11-29 14:34:05 +00:00
See [OpenTelemetry's SDK configuration ](https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/#general-sdk-configuration ) to customize the sampling strategy.
2024-02-26 10:50:04 +00:00
!!! info "Propagation"
Traefik supports the `OTEL_PROPAGATORS` env variable to set up the propragators. The supported propagators are:
- tracecontext (default)
- baggage (default)
- b3
- b3multi
- jaeger
- xray
- ottrace
Example of configuration:
OTEL_PROPAGATORS=b3,jaeger
2024-01-08 08:10:06 +00:00
### HTTP configuration
2022-11-29 14:34:05 +00:00
2024-01-08 08:10:06 +00:00
_Optional_
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
This instructs the exporter to send spans to the OpenTelemetry Collector using HTTP.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
http: {}
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[tracing]
2024-01-08 08:10:06 +00:00
[tracing.otlp.http]
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.http=true
2022-11-29 14:34:05 +00:00
```
2024-01-08 08:10:06 +00:00
#### `endpoint`
2022-11-29 14:34:05 +00:00
2024-01-08 08:10:06 +00:00
_Required, Default="http://localhost:4318/v1/traces", Format="`< scheme > ://< host > :< port > < path > `"_
2022-11-29 14:34:05 +00:00
2024-01-08 08:10:06 +00:00
URL of the OpenTelemetry Collector to send spans to.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
http:
endpoint: http://localhost:4318/v1/traces
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[tracing]
2024-01-08 08:10:06 +00:00
[tracing.otlp.http]
endpoint = "http://localhost:4318/v1/traces"
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.http.endpoint=http://localhost:4318/v1/traces
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
#### `headers`
_Optional, Default={}_
Additional headers sent with traces by the exporter to the OpenTelemetry Collector.
```yaml tab="File (YAML)"
tracing:
otlp:
http:
headers:
foo: bar
baz: buz
```
```toml tab="File (TOML)"
[tracing]
[tracing.otlp.http.headers]
foo = "bar"
baz = "buz"
```
```bash tab="CLI"
--tracing.otlp.http.headers.foo=bar --tracing.otlp.http.headers.baz=buz
```
2024-01-08 08:10:06 +00:00
#### `tls`
_Optional_
2024-02-06 09:04:05 +00:00
Defines the Client TLS configuration used by the exporter to send spans to the OpenTelemetry Collector.
2024-01-08 08:10:06 +00:00
##### `ca`
_Optional_
`ca` is the path to the certificate authority used for the secure connection to the OpenTelemetry Collector,
it defaults to the system bundle.
```yaml tab="File (YAML)"
tracing:
otlp:
http:
tls:
ca: path/to/ca.crt
```
```toml tab="File (TOML)"
[tracing.otlp.http.tls]
ca = "path/to/ca.crt"
```
```bash tab="CLI"
--tracing.otlp.http.tls.ca=path/to/ca.crt
```
##### `cert`
_Optional_
`cert` is the path to the public certificate used for the secure connection to the OpenTelemetry Collector.
When using this option, setting the `key` option is required.
```yaml tab="File (YAML)"
tracing:
otlp:
http:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
```
```toml tab="File (TOML)"
[tracing.otlp.http.tls]
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
--tracing.otlp.http.tls.cert=path/to/foo.cert
--tracing.otlp.http.tls.key=path/to/foo.key
```
##### `key`
_Optional_
`key` is the path to the private key used for the secure connection to the OpenTelemetry Collector.
When using this option, setting the `cert` option is required.
```yaml tab="File (YAML)"
tracing:
otlp:
http:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
```
```toml tab="File (TOML)"
[tracing.otlp.http.tls]
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
--tracing.otlp.http.tls.cert=path/to/foo.cert
--tracing.otlp.http.tls.key=path/to/foo.key
```
##### `insecureSkipVerify`
2022-11-29 14:34:05 +00:00
_Optional, Default=false_
2024-01-08 08:10:06 +00:00
If `insecureSkipVerify` is `true` ,
the TLS connection to the OpenTelemetry Collector accepts any certificate presented by the server regardless of the hostnames it covers.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
http:
tls:
insecureSkipVerify: true
```
```toml tab="File (TOML)"
[tracing.otlp.http.tls]
insecureSkipVerify = true
```
```bash tab="CLI"
--tracing.otlp.http.tls.insecureSkipVerify=true
```
2024-02-06 09:04:05 +00:00
### gRPC configuration
2024-01-08 08:10:06 +00:00
_Optional_
2024-02-06 09:04:05 +00:00
This instructs the exporter to send spans to the OpenTelemetry Collector using gRPC.
2024-01-08 08:10:06 +00:00
```yaml tab="File (YAML)"
tracing:
otlp:
grpc: {}
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[tracing]
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc]
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc=true
2022-11-29 14:34:05 +00:00
```
2024-01-08 08:10:06 +00:00
#### `endpoint`
2022-11-29 14:34:05 +00:00
2024-01-08 08:10:06 +00:00
_Required, Default="localhost:4317", Format="`< host > :< port > `"_
2022-11-29 14:34:05 +00:00
2024-01-08 08:10:06 +00:00
Address of the OpenTelemetry Collector to send spans to.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
grpc:
endpoint: localhost:4317
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[tracing]
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc]
endpoint = "localhost:4317"
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc.endpoint=localhost:4317
```
#### `insecure`
_Optional, Default=false_
2024-02-06 09:04:05 +00:00
Allows exporter to send spans to the OpenTelemetry Collector without using a secured protocol.
2024-01-08 08:10:06 +00:00
```yaml tab="File (YAML)"
tracing:
otlp:
grpc:
insecure: true
```
```toml tab="File (TOML)"
[tracing]
[tracing.otlp.grpc]
insecure = true
```
```bash tab="CLI"
--tracing.otlp.grpc.insecure=true
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
#### `headers`
_Optional, Default={}_
Additional headers sent with traces by the exporter to the OpenTelemetry Collector.
```yaml tab="File (YAML)"
tracing:
otlp:
grpc:
headers:
foo: bar
baz: buz
```
```toml tab="File (TOML)"
[tracing]
[tracing.otlp.grpc.headers]
foo = "bar"
baz = "buz"
```
```bash tab="CLI"
--tracing.otlp.grpc.headers.foo=bar --tracing.otlp.grpc.headers.baz=buz
```
2022-11-29 14:34:05 +00:00
#### `tls`
_Optional_
2024-02-06 09:04:05 +00:00
Defines the Client TLS configuration used by the exporter to send spans to the OpenTelemetry Collector.
2022-11-29 14:34:05 +00:00
##### `ca`
_Optional_
`ca` is the path to the certificate authority used for the secure connection to the OpenTelemetry Collector,
it defaults to the system bundle.
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
grpc:
tls:
ca: path/to/ca.crt
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc.tls]
2022-11-29 14:34:05 +00:00
ca = "path/to/ca.crt"
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc.tls.ca=path/to/ca.crt
2022-11-29 14:34:05 +00:00
```
##### `cert`
_Optional_
`cert` is the path to the public certificate used for the secure connection to the OpenTelemetry Collector.
When using this option, setting the `key` option is required.
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
grpc:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc.tls]
2022-11-29 14:34:05 +00:00
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc.tls.cert=path/to/foo.cert
--tracing.otlp.grpc.tls.key=path/to/foo.key
2022-11-29 14:34:05 +00:00
```
##### `key`
_Optional_
`key` is the path to the private key used for the secure connection to the OpenTelemetry Collector.
When using this option, setting the `cert` option is required.
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
grpc:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc.tls]
2022-11-29 14:34:05 +00:00
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc.tls.cert=path/to/foo.cert
--tracing.otlp.grpc.tls.key=path/to/foo.key
2022-11-29 14:34:05 +00:00
```
##### `insecureSkipVerify`
_Optional, Default=false_
If `insecureSkipVerify` is `true` ,
the TLS connection to the OpenTelemetry Collector accepts any certificate presented by the server regardless of the hostnames it covers.
```yaml tab="File (YAML)"
tracing:
2024-01-08 08:10:06 +00:00
otlp:
grpc:
tls:
insecureSkipVerify: true
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-01-08 08:10:06 +00:00
[tracing.otlp.grpc.tls]
2022-11-29 14:34:05 +00:00
insecureSkipVerify = true
```
```bash tab="CLI"
2024-01-08 08:10:06 +00:00
--tracing.otlp.grpc.tls.insecureSkipVerify=true
2022-11-29 14:34:05 +00:00
```