Passing tags from consul catalog to prometheus metrics

TLDR:
How do I pass arbitrary tags set in Consul through to Prometheus?


traefik has consul catalog provider configured:

[providers.consulCatalog]
  prefix           = "traefik"
  exposedByDefault = false

  [providers.consulCatalog.endpoint]
    address = "127.0.0.1:8500"
    scheme  = "http"

and then passes metrics to prometheus:

[metrics]
  [metrics.prometheus]
    addServicesLabels = true
    addEntryPointsLabels = true
    addRoutersLabels = true

In consul, I've tagged a service with ctm_app=true

How do I pass that specific tag through to prometheus?

1 Like

Hello @jsharpe1983 and thanks for your interest in Traefik,

Unfortunately, this is not possible with Traefik at the moment.

Might be a nice feature? Was thinking of tagging services so that I could group them in grafana better.
ex: grafana/loki/prometheus/statsd -> tagged "type:logging"
ex: internal_app1/internal_app2/etc... -> tagged "type:app"

Could then easily filter in grafana by "app" to see only those services

Feel free to open a feature request if you think this could be an interesting addition and to explain the use case.