2022-11-29 14:34:05 +00:00
---
title: "Traefik OpenTelemetry Documentation"
description: "Traefik supports several metrics backends, including OpenTelemetry. Learn how to implement it for observability in Traefik Proxy. Read the technical documentation."
---
# OpenTelemetry
2024-02-06 09:04:05 +00:00
To enable the OpenTelemetry metrics:
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp: {}
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp=true
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
!!! info "Default protocol"
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
The OpenTelemetry exporter will export metrics to the collector using HTTP by default to https://localhost:4318/v1/metrics, see the [gRPC Section ](#grpc-configuration ) to use gRPC.
2022-11-29 14:34:05 +00:00
#### `addEntryPointsLabels`
_Optional, Default=true_
Enable metrics on entry points.
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
2022-11-29 14:34:05 +00:00
addEntryPointsLabels: true
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
2022-11-29 14:34:05 +00:00
addEntryPointsLabels = true
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.addEntryPointsLabels=true
2022-11-29 14:34:05 +00:00
```
#### `addRoutersLabels`
_Optional, Default=false_
Enable metrics on routers.
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
2022-11-29 14:34:05 +00:00
addRoutersLabels: true
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
2022-11-29 14:34:05 +00:00
addRoutersLabels = true
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.addRoutersLabels=true
2022-11-29 14:34:05 +00:00
```
#### `addServicesLabels`
_Optional, Default=true_
Enable metrics on services.
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
2022-11-29 14:34:05 +00:00
addServicesLabels: true
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
2022-11-29 14:34:05 +00:00
addServicesLabels = true
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.addServicesLabels=true
2022-11-29 14:34:05 +00:00
```
#### `explicitBoundaries`
_Optional, Default=".005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10"_
Explicit boundaries for Histogram data points.
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
2022-11-29 14:34:05 +00:00
explicitBoundaries:
- 0.1
- 0.3
- 1.2
- 5.0
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
2022-11-29 14:34:05 +00:00
explicitBoundaries = [0.1,0.3,1.2,5.0]
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.explicitBoundaries=0.1,0.3,1.2,5.0
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
#### `pushInterval`
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
_Optional, Default=10s_
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
Interval at which metrics are sent to the OpenTelemetry Collector.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
pushInterval: 10s
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp]
pushInterval = "10s"
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.pushInterval=10s
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
### HTTP configuration
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +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 the metrics to the OpenTelemetry Collector using HTTP.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http: {}
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp.http]
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http=true
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
#### `endpoint`
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
_Required, Default="http://localhost:4318/v1/metrics", Format="`< scheme > ://< host > :< port > < path > `"_
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
URL of the OpenTelemetry Collector to send metrics to.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
endpoint: http://localhost:4318/v1/metrics
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp.http]
endpoint = "http://localhost:4318/v1/metrics"
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.endpoint=http://localhost:4318/v1/metrics
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
#### `headers`
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
_Optional, Default={}_
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
Additional headers sent with metrics by the exporter to the OpenTelemetry Collector.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
headers:
foo: bar
baz: buz
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp.http.headers]
foo = "bar"
baz = "buz"
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.headers.foo=bar --metrics.otlp.http.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 metrics 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)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
tls:
ca: path/to/ca.crt
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-02-06 09:04:05 +00:00
[metrics.otlp.http.tls]
2022-11-29 14:34:05 +00:00
ca = "path/to/ca.crt"
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.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)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-02-06 09:04:05 +00:00
[metrics.otlp.http.tls]
2022-11-29 14:34:05 +00:00
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.tls.cert=path/to/foo.cert
--metrics.otlp.http.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)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-02-06 09:04:05 +00:00
[metrics.otlp.http.tls]
2022-11-29 14:34:05 +00:00
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.tls.cert=path/to/foo.cert
--metrics.otlp.http.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)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
http:
tls:
insecureSkipVerify: true
2022-11-29 14:34:05 +00:00
```
```toml tab="File (TOML)"
2024-02-06 09:04:05 +00:00
[metrics.otlp.http.tls]
2022-11-29 14:34:05 +00:00
insecureSkipVerify = true
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.http.tls.insecureSkipVerify=true
2022-11-29 14:34:05 +00:00
```
2024-02-06 09:04:05 +00:00
### gRPC configuration
_Optional_
2022-11-29 14:34:05 +00:00
2024-02-06 09:04:05 +00:00
This instructs the exporter to send metrics to the OpenTelemetry Collector using gRPC.
2022-11-29 14:34:05 +00:00
```yaml tab="File (YAML)"
metrics:
2024-02-06 09:04:05 +00:00
otlp:
2022-11-29 14:34:05 +00:00
grpc: {}
```
```toml tab="File (TOML)"
[metrics]
2024-02-06 09:04:05 +00:00
[metrics.otlp.grpc]
```
```bash tab="CLI"
--metrics.otlp.grpc=true
```
#### `endpoint`
_Required, Default="localhost:4317", Format="`< host > :< port > `"_
Address of the OpenTelemetry Collector to send metrics to.
```yaml tab="File (YAML)"
metrics:
otlp:
grpc:
endpoint: localhost:4317
```
```toml tab="File (TOML)"
[metrics]
[metrics.otlp.grpc]
endpoint = "localhost:4317"
```
```bash tab="CLI"
--metrics.otlp.grpc.endpoint=localhost:4317
```
#### `insecure`
_Optional, Default=false_
Allows exporter to send metrics to the OpenTelemetry Collector without using a secured protocol.
```yaml tab="File (YAML)"
metrics:
otlp:
grpc:
insecure: true
```
```toml tab="File (TOML)"
[metrics]
[metrics.otlp.grpc]
insecure = true
```
```bash tab="CLI"
--metrics.otlp.grpc.insecure=true
```
#### `headers`
_Optional, Default={}_
Additional headers sent with metrics by the exporter to the OpenTelemetry Collector.
```yaml tab="File (YAML)"
metrics:
otlp:
grpc:
headers:
foo: bar
baz: buz
```
```toml tab="File (TOML)"
[metrics]
[metrics.otlp.grpc.headers]
foo = "bar"
baz = "buz"
```
```bash tab="CLI"
--metrics.otlp.grpc.headers.foo=bar --metrics.otlp.grpc.headers.baz=buz
```
#### `tls`
_Optional_
Defines the Client TLS configuration used by the exporter to send metrics to the OpenTelemetry Collector.
##### `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)"
metrics:
otlp:
grpc:
tls:
ca: path/to/ca.crt
```
```toml tab="File (TOML)"
[metrics.otlp.grpc.tls]
ca = "path/to/ca.crt"
```
```bash tab="CLI"
--metrics.otlp.grpc.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)"
metrics:
otlp:
grpc:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
```
```toml tab="File (TOML)"
[metrics.otlp.grpc.tls]
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
--metrics.otlp.grpc.tls.cert=path/to/foo.cert
--metrics.otlp.grpc.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)"
metrics:
otlp:
grpc:
tls:
cert: path/to/foo.cert
key: path/to/foo.key
```
```toml tab="File (TOML)"
[metrics.otlp.grpc.tls]
cert = "path/to/foo.cert"
key = "path/to/foo.key"
```
```bash tab="CLI"
--metrics.otlp.grpc.tls.cert=path/to/foo.cert
--metrics.otlp.grpc.tls.key=path/to/foo.key
```
##### `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)"
metrics:
otlp:
grpc:
tls:
insecureSkipVerify: true
```
```toml tab="File (TOML)"
[metrics.otlp.grpc.tls]
insecureSkipVerify = true
2022-11-29 14:34:05 +00:00
```
```bash tab="CLI"
2024-02-06 09:04:05 +00:00
--metrics.otlp.grpc.tls.insecureSkipVerify=true
2022-11-29 14:34:05 +00:00
```