Relabeling: replace the matched groups to some value, and use the final result as label value

16 views
Skip to first unread message

Mouhong Lin

unread,
Feb 16, 2020, 9:50:01 AM2/16/20
to Prometheus Users
Hey guys,

I'm using Prometheus to monitor http request performance by exporting metrics from nginx access logs (mtail + Prometheus).

I would like to have a Top K view of slowest url route patterns. By url "route pattern", I mean something like "/api/orders/:num", where the ":num" is a placeholder. Urls like "/api/orders/1200", "/api/orders/1201" will all fall to the route pattern "/api/orders/:num".

Seems "regex" action will not work in this case, because I'm not using the matched group as label value, but use the regex_replace(source_label, /\d+/, ':num') result as the label value.

Any idea? Thanks!

Reply all
Reply to author
Forward
0 new messages