Fred Mériot
Fred Mériot

Reputation: 4357

Grafana variable and Prometheus query

I have a problem trying to create a custom variable of type query with this formula :

label_values(increase(nginx_ingress_controller_requests{namespace=~"$Namespace"}[10m])>0,ingress)

When I play this query against the prometheus server (without "label_values" which is a grafan templating function) it works fine.

I have the following toast error :

Template variables could not be initialized: parse error at char 9: could not parse remaining input "(nginx_ingress_"...

The aim of this variable is to list only Ingress labels that had an activity during the last 10m.

Upvotes: 2

Views: 8263

Answers (1)

aayore
aayore

Reputation: 683

label_values(metric,label) is a Grafana function, not a Prometheus function. Since it only takes a metric (not a timeseries/vector), you just want:

label_values(nginx_ingress_controller_requests,ingress)

I don't think you can restrict by namespace in the custom variable query.

Upvotes: 1

Related Questions