MortenB
MortenB

Reputation: 3567

Grafana variable of a Prometheus __name__ filter metric and one graph for each

in prometheus I can list the metrics like this:

{__name__=~".+_count$", class=~"OracleCustomerDao$", application="access-registration-service"}

And in Grafana I have lots of the graphs where only the name changes:

sum(rate(db_query_issuer_settings_seconds_count{application="access-registration-service"}[5m])) by (dn)

But the number of metrics changes with every release and then I manually need to look up in Prometheus and add them manually as new graphs to the dashboard.

How can I add a Grafana variable of __name__ (here: db_query_issuer_settings_seconds_count) and a for loop showing all the graphs that matches the Prometheus above?

Upvotes: 1

Views: 3056

Answers (1)

Create a variable at Settings > Variables, using the following configuration:

Type        = Query
Data source = Prometheus
Query       = {__name__=~".+_count$", class=~"OracleCustomerDao$", application="access-registration-service"}
Regex       = /(.+){/

Upvotes: 3

Related Questions