Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
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
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
Histogram buckets for latency metrics (in seconds).
Enable metrics on entrypoints.
Enable metrics on routers (high cardinality - use with caution).
Enable metrics on services.
Custom EntryPoint
Expose metrics on a dedicated entrypoint:Manual Routing
Disable the default internal router to create custom routing for
prometheus@internal service.Header Labels
Add custom labels from request headers: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
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
Interval between metric pushes to Datadog Agent.
Prefix for all metrics.
Unix Domain Socket Example
StatsD
Send metrics using the StatsD protocol.Basic Configuration
Configuration Options
Address of the StatsD server.
Interval between metric pushes.
Prefix for all metrics.
InfluxDB 2.x
Send metrics to InfluxDB 2.x time-series database.Basic Configuration
Configuration Options
Address of the InfluxDB 2.x instance.
Authentication token. Can be a token value or file path.
Organization name where metrics are stored.
Bucket name where metrics are stored.
Interval between metric pushes.
Additional InfluxDB tags on all metrics.
OpenTelemetry
Export metrics using the OpenTelemetry Protocol (OTLP).Available Metrics
Global Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
traefik_config_reloads_total | Counter | - | Total configuration reloads |
traefik_config_last_reload_success | Gauge | - | Timestamp of last successful reload |
traefik_open_connections | Gauge | entrypoint, protocol | Current open connections |
traefik_tls_certs_not_after | Gauge | - | TLS certificate expiration timestamp |
EntryPoint Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
traefik_entrypoint_requests_total | Counter | code, method, protocol, entrypoint | Total HTTP requests |
traefik_entrypoint_requests_tls_total | Counter | tls_version, tls_cipher, entrypoint | Total HTTPS requests |
traefik_entrypoint_request_duration_seconds | Histogram | code, method, protocol, entrypoint | Request duration |
traefik_entrypoint_requests_bytes_total | Counter | code, method, protocol, entrypoint | Total request bytes |
traefik_entrypoint_responses_bytes_total | Counter | code, method, protocol, entrypoint | Total response bytes |
Router Metrics
High Cardinality WarningRouter metrics can create high cardinality in your metrics system. Enable only when necessary.
| Metric | Type | Labels | Description |
|---|---|---|---|
traefik_router_requests_total | Counter | code, method, protocol, router, service | Total requests per router |
traefik_router_requests_tls_total | Counter | tls_version, tls_cipher, router, service | Total HTTPS requests per router |
traefik_router_request_duration_seconds | Histogram | code, method, protocol, router, service | Request duration per router |
traefik_router_requests_bytes_total | Counter | code, method, protocol, router, service | Request bytes per router |
traefik_router_responses_bytes_total | Counter | code, method, protocol, router, service | Response bytes per router |
Service Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
traefik_service_requests_total | Counter | code, method, protocol, service | Total requests per service |
traefik_service_requests_tls_total | Counter | tls_version, tls_cipher, service | Total HTTPS requests per service |
traefik_service_request_duration_seconds | Histogram | code, method, protocol, service | Request duration per service |
traefik_service_retries_total | Counter | service | Total request retries |
traefik_service_server_up | Gauge | service, url | Server health status (0=down, 1=up) |
traefik_service_requests_bytes_total | Counter | code, method, protocol, service | Request bytes per service |
traefik_service_responses_bytes_total | Counter | code, method, protocol, service | Response bytes per service |
Metric Labels
| Label | Description | Example |
|---|---|---|
code | HTTP status code | 200, 404, 500 |
entrypoint | EntryPoint name | web, websecure |
method | HTTP method | GET, POST |
protocol | Protocol | http, https |
router | Router name | my-router@docker |
service | Service name | my-service@docker |
tls_version | TLS version | 1.2, 1.3 |
tls_cipher | TLS cipher suite | TLS_AES_128_GCM_SHA256 |
url | Service backend URL | http://backend:8080 |
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
| Metric | Type | Description |
|---|---|---|
http.server.request.duration | Histogram | Duration of HTTP server requests |
error.type, http.request.method, http.response.status_code, network.protocol.name, server.address, server.port, url.scheme
HTTP Client Metrics
| Metric | Type | Description |
|---|---|---|
http.client.request.duration | Histogram | Duration of HTTP client requests |
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.