Metrics
Traefik provides comprehensive metrics for monitoring performance, traffic patterns, and system health. Metrics are available in multiple formats to integrate with your existing monitoring infrastructure.Supported Backends
Traefik supports these metrics backends:- Prometheus - Pull-based scraping with histogram support
- Datadog - Push metrics to Datadog Agent via StatsD or UDS
- StatsD - Standard StatsD protocol
- InfluxDB 2.x - Time-series database with tags
- OpenTelemetry - OTLP protocol for metrics
Quick Start
Enable Prometheus metrics:http://localhost:8080/metrics (on the Traefik entrypoint).
Common Configuration
Add Internals
boolean
default:"false"
Enable metrics for internal resources like
ping@internal.Prometheus
Prometheus is a pull-based monitoring system that scrapes metrics from HTTP endpoints.Basic Configuration
Configuration Options
array
default:"[0.1, 0.3, 1.2, 5.0]"
Histogram buckets for latency metrics (in seconds).
boolean
default:"true"
Enable metrics on entrypoints.
boolean
default:"false"
Enable metrics on routers (high cardinality - use with caution).
boolean
default:"true"
Enable metrics on services.
Custom EntryPoint
Expose metrics on a dedicated entrypoint:Manual Routing
boolean
default:"false"
Disable the default internal router to create custom routing for
prometheus@internal service.Header Labels
Add custom labels from request headers:object
default:"{}"
Map of label names to request header names.
The
Host header is promoted to Request.Host in Go and is not available in the header map. Use X-Forwarded-Host instead.Prometheus Scrape Configuration
Datadog
Send metrics to Datadog Agent via StatsD protocol or Unix Domain Socket.Basic Configuration
Configuration Options
string
default:"127.0.0.1:8125"
required
Address of the Datadog Agent. Supports UDP and Unix Domain Sockets.
127.0.0.1:8125- UDP socketunix:///path/to/datadog.socket- Unix socket (auto-detect type)unixgram:///path/to/datadog.socket- SOCK_DGRAM socketunixstream:///path/to/datadog.socket- SOCK_STREAM socket
duration
default:"10s"
Interval between metric pushes to Datadog Agent.
string
default:"traefik"
Prefix for all metrics.
Unix Domain Socket Example
StatsD
Send metrics using the StatsD protocol.Basic Configuration
Configuration Options
string
default:"localhost:8125"
required
Address of the StatsD server.
duration
default:"10s"
Interval between metric pushes.
string
default:"traefik"
Prefix for all metrics.
InfluxDB 2.x
Send metrics to InfluxDB 2.x time-series database.Basic Configuration
Configuration Options
string
default:"http://localhost:8086"
required
Address of the InfluxDB 2.x instance.
string
required
Authentication token. Can be a token value or file path.
string
required
Organization name where metrics are stored.
string
required
Bucket name where metrics are stored.
duration
default:"10s"
Interval between metric pushes.
object
default:"{}"
Additional InfluxDB tags on all metrics.
OpenTelemetry
Export metrics using the OpenTelemetry Protocol (OTLP).Available Metrics
Global Metrics
EntryPoint Metrics
Router Metrics
High Cardinality WarningRouter metrics can create high cardinality in your metrics system. Enable only when necessary.
Service Metrics
Metric Labels
HTTP method values outside the standard HTTP/1.1 methods or HTTP/2 PRI verb are labeled as
EXTENSION_METHOD.OpenTelemetry Semantic Conventions
Traefik follows OpenTelemetry semantic conventions v1.23.1:HTTP Server Metrics
Labels:
error.type, http.request.method, http.response.status_code, network.protocol.name, server.address, server.port, url.scheme
HTTP Client Metrics
Labels:
error.type, http.request.method, http.response.status_code, network.protocol.name, server.address, server.port, url.scheme
Official Grafana Dashboards
Traefik provides official Grafana dashboards:- On-Premises Dashboard - Dashboard ID: 17346
- Kubernetes Dashboard - Dashboard ID: 17347
Complete Examples
Production Prometheus Setup
Multi-Backend Setup
You can enable multiple metrics backends simultaneously.