Is it possible to have RequestPath as a label in the prometheus metrics?

I would like to check the response time by RequestPath. Thanks!

IMHO this is not possible by default, check the doc.

You could try to find a middleware that places the path in a header and then add that header to the metrics. But I am not sure if middlewares are processed before metrics.

If you want to measure only some specific routes, you could just duplicate the router, use Host() && PathPrefix() (this rule is longer, therefore has a higher priority and would be used first if matched) and then add the router name to the metrics.

1 Like

Thanks! I will try to have different route then. Weird that this is not in the built-in metrics :man_shrugging: