Skip to content

Traefik

Prometheus Metrics

Traefik is a modern reverse proxy and load balancer that exposes native Prometheus metrics when its metrics provider is enabled.

Enable the Prometheus metrics provider and define a dedicated entrypoint in your traefik.yml static configuration file:

metrics:
prometheus:
entryPoint: metrics
entryPoints:
metrics:
address: ":8082"

Alternatively, using TOML (traefik.toml):

[metrics.prometheus]
entryPoint = "metrics"
[entryPoints.metrics]
address = ":8082"

Or via CLI flags:

Terminal window
--metrics.prometheus=true --entrypoints.metrics.address=:8082

Restart Traefik after updating its static configuration. The metrics endpoint will be available at http://localhost:8082/metrics.

Terminal window
sudo tee /etc/glouton/conf.d/99-traefik.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:8082/metrics"
name: "traefik"
allow_metrics:
- "traefik_entrypoint_requests_total"
- "traefik_entrypoint_request_duration_seconds_sum"
- "traefik_entrypoint_request_duration_seconds_count"
- "traefik_service_requests_total"
- "traefik_service_open_connections"
- "traefik_entrypoint_requests_bytes_total"
- "traefik_entrypoint_responses_bytes_total"
- "traefik_service_request_duration_seconds_sum"
- "traefik_service_request_duration_seconds_count"
EOF
Metric Description
traefik_entrypoint_requests_total Total number of requests handled by each entrypoint
traefik_entrypoint_request_duration_seconds_sum Cumulative request duration at the entrypoint level
traefik_entrypoint_request_duration_seconds_count Number of requests measured for duration at the entrypoint level
traefik_service_requests_total Total number of requests forwarded to each backend service
traefik_service_open_connections Number of currently open connections to each backend service
traefik_entrypoint_requests_bytes_total Total bytes received by each entrypoint
traefik_entrypoint_responses_bytes_total Total bytes sent by each entrypoint
traefik_service_request_duration_seconds_sum Cumulative request duration at the service level
traefik_service_request_duration_seconds_count Number of requests measured for duration at the service level