# Monitor Traefik v2 Ingress controller with Prometheus by host

**URL:** <https://community.traefik.io/t/monitor-traefik-v2-ingress-controller-with-prometheus-by-host/15651>\
**Category:** Traefik v2\
**Tags:** metrics, kubernetes-ingress\
**Created:** [September 6, 2022, 2:45pm UTC](https://community.traefik.io/t/monitor-traefik-v2-ingress-controller-with-prometheus-by-host/15651 "2022-09-06T14:45:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thanzex](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/thanzex/32/5838_2.png) [@Thanzex](https://community.traefik.io/u/Thanzex)\
**Post date:** [September 6, 2022, 2:45pm UTC](https://community.traefik.io/t/monitor-traefik-v2-ingress-controller-with-prometheus-by-host/15651/1 "2022-09-06T14:45:43Z")

</div>

Hi! I have a k3s cluster with Traefik v2 as Ingress Controller, I successfully configured Prometheus to scrape Traefik's metrics but the exported metrics are labeled by Ingress resource.

This is a problem because a single Ingress resource can be configured to serve multiple domains, and the name of an Ingress resource isn't ideal to categorize the requests.

As an example, in v1 I got metrics like:

```auto
traefik_backend_requests_total{backend="url.of.ingress.com", code="200", container="traefik", endpoint="...", instance="...", job="traefik-prometheus", method="DELETE", namespace="...", pod="...", protocol="http", service="traefik-prometheus"}

```

And from here I could filter/aggregate metrics in Grafana by host thanks to the `backend` field.

But in v2, there are no more backends and I get metrics like:

```auto
traefik_service_requests_total{code="200", container="traefik", endpoint="...", exported_service="name-of-ingress-resource-80@kubernetes", instance="...", job="traefik-metrics", method="GET", namespace="...", pod="...", protocol="http", service="traefik-metrics"}

```

That are not useful at all, since I cannot see the destination host, the only field useful for identification is `exported_service` but again, is no host.

Is there a way to export what I'm looking for?

---

<div class="post-metadata">

**Author:** ![gchiesa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gchiesa/32/5205_2.png) [@gchiesa](https://community.traefik.io/u/gchiesa)\
**Post date:** [December 19, 2023, 11:58am UTC](https://community.traefik.io/t/monitor-traefik-v2-ingress-controller-with-prometheus-by-host/15651/2 "2023-12-19T11:58:10Z")

</div>

I would also like to be able to aggregate in grafana the metrics by the targeted url.  
Is there any possibility?

---

<div class="post-metadata">

**Author:** ![mloiseleur](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mloiseleur/32/4987_2.png) [@mloiseleur](https://community.traefik.io/u/mloiseleur)\
**Post date:** [January 16, 2024, 2:55pm UTC](https://community.traefik.io/t/monitor-traefik-v2-ingress-controller-with-prometheus-by-host/15651/3 "2024-01-16T14:55:39Z")

</div>

When [enabling routers label](https://doc.traefik.io/traefik/observability/metrics/prometheus/#addrouterslabels), you may have more information, depending of your dynamic configuration.

It's also possible with data in access.logs to aggregate per target url or path.
