Skip to main content

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:
metrics:
  prometheus: {}
Access metrics at http://localhost:8080/metrics (on the Traefik entrypoint).

Common Configuration

Add Internals

addInternals
boolean
default:"false"
Enable metrics for internal resources like ping@internal.
metrics:
  addInternals: true
  prometheus: {}

Prometheus

Prometheus is a pull-based monitoring system that scrapes metrics from HTTP endpoints.

Basic Configuration

metrics:
  prometheus:
    buckets:
      - 0.1
      - 0.3
      - 1.2
      - 5.0
    addEntryPointsLabels: true
    addRoutersLabels: true
    addServicesLabels: true

Configuration Options

buckets
array
default:"[0.1, 0.3, 1.2, 5.0]"
Histogram buckets for latency metrics (in seconds).
addEntryPointsLabels
boolean
default:"true"
Enable metrics on entrypoints.
addRoutersLabels
boolean
default:"false"
Enable metrics on routers (high cardinality - use with caution).
addServicesLabels
boolean
default:"true"
Enable metrics on services.

Custom EntryPoint

Expose metrics on a dedicated entrypoint:
entryPoints:
  web:
    address: ':80'
  metrics:
    address: ':8082'

metrics:
  prometheus:
    entryPoint: metrics

Manual Routing

manualRouting
boolean
default:"false"
Disable the default internal router to create custom routing for prometheus@internal service.
metrics:
  prometheus:
    manualRouting: true

Header Labels

Add custom labels from request headers:
headerLabels
object
default:"{}"
Map of label names to request header names.
metrics:
  prometheus:
    headerLabels:
      useragent: User-Agent
      country: X-Country-Code
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

scrape_configs:
  - job_name: 'traefik'
    static_configs:
      - targets: ['traefik:8080']

Datadog

Send metrics to Datadog Agent via StatsD protocol or Unix Domain Socket.

Basic Configuration

metrics:
  datadog:
    address: 127.0.0.1:8125
    pushInterval: 10s
    addEntryPointsLabels: true
    addServicesLabels: true
    prefix: traefik

Configuration Options

address
string
default:"127.0.0.1:8125"
required
Address of the Datadog Agent. Supports UDP and Unix Domain Sockets.
Supported address formats:
  • 127.0.0.1:8125 - UDP socket
  • unix:///path/to/datadog.socket - Unix socket (auto-detect type)
  • unixgram:///path/to/datadog.socket - SOCK_DGRAM socket
  • unixstream:///path/to/datadog.socket - SOCK_STREAM socket
pushInterval
duration
default:"10s"
Interval between metric pushes to Datadog Agent.
prefix
string
default:"traefik"
Prefix for all metrics.

Unix Domain Socket Example

metrics:
  datadog:
    address: unix:///var/run/datadog/dsd.socket

StatsD

Send metrics using the StatsD protocol.

Basic Configuration

metrics:
  statsD:
    address: localhost:8125
    pushInterval: 10s
    prefix: traefik
    addEntryPointsLabels: true
    addServicesLabels: true

Configuration Options

address
string
default:"localhost:8125"
required
Address of the StatsD server.
pushInterval
duration
default:"10s"
Interval between metric pushes.
prefix
string
default:"traefik"
Prefix for all metrics.

InfluxDB 2.x

Send metrics to InfluxDB 2.x time-series database.

Basic Configuration

metrics:
  influxDB2:
    address: http://localhost:8086
    token: mytoken
    org: myorg
    bucket: traefik
    pushInterval: 10s
    additionalLabels:
      environment: production
      datacenter: us-east-1

Configuration Options

address
string
default:"http://localhost:8086"
required
Address of the InfluxDB 2.x instance.
token
string
required
Authentication token. Can be a token value or file path.
org
string
required
Organization name where metrics are stored.
bucket
string
required
Bucket name where metrics are stored.
pushInterval
duration
default:"10s"
Interval between metric pushes.
additionalLabels
object
default:"{}"
Additional InfluxDB tags on all metrics.

OpenTelemetry

Export metrics using the OpenTelemetry Protocol (OTLP).
metrics:
  otlp:
    http:
      endpoint: https://otel-collector:4318/v1/metrics
    grpc:
      endpoint: otel-collector:4317
See the metrics overview documentation for OpenTelemetry semantic conventions.

Available Metrics

Global Metrics

MetricTypeLabelsDescription
traefik_config_reloads_totalCounter-Total configuration reloads
traefik_config_last_reload_successGauge-Timestamp of last successful reload
traefik_open_connectionsGaugeentrypoint, protocolCurrent open connections
traefik_tls_certs_not_afterGauge-TLS certificate expiration timestamp

EntryPoint Metrics

MetricTypeLabelsDescription
traefik_entrypoint_requests_totalCountercode, method, protocol, entrypointTotal HTTP requests
traefik_entrypoint_requests_tls_totalCountertls_version, tls_cipher, entrypointTotal HTTPS requests
traefik_entrypoint_request_duration_secondsHistogramcode, method, protocol, entrypointRequest duration
traefik_entrypoint_requests_bytes_totalCountercode, method, protocol, entrypointTotal request bytes
traefik_entrypoint_responses_bytes_totalCountercode, method, protocol, entrypointTotal response bytes

Router Metrics

High Cardinality WarningRouter metrics can create high cardinality in your metrics system. Enable only when necessary.
MetricTypeLabelsDescription
traefik_router_requests_totalCountercode, method, protocol, router, serviceTotal requests per router
traefik_router_requests_tls_totalCountertls_version, tls_cipher, router, serviceTotal HTTPS requests per router
traefik_router_request_duration_secondsHistogramcode, method, protocol, router, serviceRequest duration per router
traefik_router_requests_bytes_totalCountercode, method, protocol, router, serviceRequest bytes per router
traefik_router_responses_bytes_totalCountercode, method, protocol, router, serviceResponse bytes per router

Service Metrics

MetricTypeLabelsDescription
traefik_service_requests_totalCountercode, method, protocol, serviceTotal requests per service
traefik_service_requests_tls_totalCountertls_version, tls_cipher, serviceTotal HTTPS requests per service
traefik_service_request_duration_secondsHistogramcode, method, protocol, serviceRequest duration per service
traefik_service_retries_totalCounterserviceTotal request retries
traefik_service_server_upGaugeservice, urlServer health status (0=down, 1=up)
traefik_service_requests_bytes_totalCountercode, method, protocol, serviceRequest bytes per service
traefik_service_responses_bytes_totalCountercode, method, protocol, serviceResponse bytes per service

Metric Labels

LabelDescriptionExample
codeHTTP status code200, 404, 500
entrypointEntryPoint nameweb, websecure
methodHTTP methodGET, POST
protocolProtocolhttp, https
routerRouter namemy-router@docker
serviceService namemy-service@docker
tls_versionTLS version1.2, 1.3
tls_cipherTLS cipher suiteTLS_AES_128_GCM_SHA256
urlService backend URLhttp://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

MetricTypeDescription
http.server.request.durationHistogramDuration of HTTP server requests
Labels: error.type, http.request.method, http.response.status_code, network.protocol.name, server.address, server.port, url.scheme

HTTP Client Metrics

MetricTypeDescription
http.client.request.durationHistogramDuration of HTTP client requests
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:

Complete Examples

Production Prometheus Setup

entryPoints:
  web:
    address: ':80'
  websecure:
    address: ':443'
  metrics:
    address: ':8082'

metrics:
  prometheus:
    entryPoint: metrics
    buckets:
      - 0.1
      - 0.3
      - 1.2
      - 5.0
      - 10.0
    addEntryPointsLabels: true
    addRoutersLabels: false
    addServicesLabels: true

Multi-Backend Setup

metrics:
  prometheus:
    addServicesLabels: true
  datadog:
    address: 127.0.0.1:8125
    pushInterval: 10s
You can enable multiple metrics backends simultaneously.