traefik ignores `base2_exponential_bucket_histogram` setting for some histogram metrics
Welcome!
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've searched similar issues on the Traefik community forum and didn't find any.
What did you do?
We're using OpenTelemetry for our merics and prometheus as backend. We want to use native historgrams as much as possible as the resource footprint is way smaller.
OTels/Prometheus compat defines that histograms exported as base2_exponential_bucket_histogram will then be mapped to native histograms in prometheus.
The Otel SDK does this automatically if the env var OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION is set to base2_exponential_bucket_histogram
The expected collected histogram metrics would all be native histograms in prometheus, ie. http_server_request_duration_seconds, traefik_service_request_duration_seconds
What did you see instead?
Some metrics seem to be captured as native histograms, see the http_server_request_duration_seconds metric.
Some traefik custom metrics seem to stay classic ones, e.g: traefik_service_request_duration_seconds_bucket/sum/count (classic)
What version of Traefik are you using?
v3.7.11
What is your environment & configuration?
docker compose example:
traefik config (./traefik/traefik.yml)
entryPoints:
web:
address: ":80"
providers:
docker:
exposedByDefault: false
network: traefik-demo
metrics:
otlp:
serviceName: traefik
addEntryPointsLabels: true
# Off by default; without it there is no `router` label to group by.
addRoutersLabels: true
addServicesLabels: true
pushInterval: 10s
grpc:
endpoint: lgtm:4317
insecure: truedocker-compose.yml
name: traefik-otel-lgtm-demo
services:
lgtm:
image: grafana/otel-lgtm:0.31.0
#container_name: lgtm
init: true
environment:
GF_SERVER_ROOT_URL: http://grafana.localhost/
healthcheck:
# 13133 = collector health extension, 3000 = Grafana.
test:
- CMD-SHELL
- curl -fsS http://127.0.0.1:13133/ready && curl -fsS http://127.0.0.1:3000/api/health
interval: 5s
timeout: 3s
retries: 30
start_period: 40s
networks:
- demo
labels:
- traefik.enable=true
- traefik.http.routers.grafana.rule=Host(`grafana.localhost`)
- traefik.http.routers.grafana.entrypoints=web
- traefik.http.services.grafana.loadbalancer.server.port=3000
traefik:
image: traefik:v3.7.11
environment:
# if you disable this all histogram will be classic _bucket/count/sum
- OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION=base2_exponential_bucket_histogram
depends_on:
lgtm:
# Wait for the collector so the first metric push isn't dropped.
condition: service_healthy
ports:
- "80:80"
volumes:
- ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- demo
labels:
- traefik.enable=true
- traefik.http.routers.dashboard.rule=Host(`traefik.localhost`)
- traefik.http.routers.dashboard.entrypoints=web
- traefik.http.routers.dashboard.service=api@internal
networks:
demo:
# Explicit name (no project prefix) so it matches providers.docker.network.
name: traefik-demo
If applicable, please paste the log output in DEBUG level
No response
Source: traefik/traefik