Question about Service name in metrics

Hello! First Post!

I have a question regarding the reported service name as seen in the metrics. For example:

traefik_service_requests_total{code="200",method="GET",protocol="http",service="xxxx-xxxxxx-traefik-ingress-9d50afc83b446c8a5c01@kubernetescrd"} 1059

My question is as follows: Is there a way to have it show the actual service name the router is forwarding to instead of this generated name?

TIA

I'm sorry, I did not look in depth at metrics, but from common sense:

  • Traefik service is not the same as kubernetes service
  • From you excerpt, it looks like what is being shown is the traefik name
  • It does not look like there is a way to provide the service name in the IngressRoute object for that purpose. The service name is always generated.
  • So as it is now, no, it is not possible

@ldez would you support it if I write a GitHub feature request for this, or do we already have anything similar? It seems a few other options are also missing on IngressRoute, e.g sans for LE certificates, service stickiness, mirroring, etc.

Thanks @zespri for your reply. It would be nice if the name can be defined. This came up when I added Traefik metrics into Prometheus. As I started looking at the data, it was hard to determine which service referred to what. It's easy to tell in the Traefik dashboard since each Traefik service prints out the configured rule, but not outsides that dashboard.

I noticed this open PR if merged, it can resolved the issue.

Awesome thanks for that! I will keep an eye out on that PR.

Hi!
It doesn't look like the PR is solving the problem as I still see this happening in v2.1.2, or am I missing something?

@golgoth

I did not have much experience with metrics, so I cannot definitely tell you if it is resolved or now, it looks like it should. Of course it goes without saying, that you have to update your configuration accordingly, ot take advantage of that PR. If you did not change anything in your configs, that I would expect no change in this behaviour either. Having said that, I have not tried that personally, so I do not have a definite answer.

Are you able to tell us in this thread what you should be changing in the configs to be able to see the correct service names in the metrics ?

Im useing kubernetes and traefik and are having trouble using the metrics for anything at the moment.

@larsbloch I have not tried it but it looks like property name of kind TrafeikService is what you need to set.