I am trying to setup templating in Grafana using the label_values function. The documentation specifies the possibility to query label_values like:
label_values(metric, label)
In my use case there are two main metric groups with names similar to:
Each of them has a label named 'uid'. I'm looking to use the above query to filter only the user ids of the 'app1' on one dashboard and 'app2' on another dashboard.
I've tried
label_values(app1_current_sensor1, uid)
But if for some reason sensor1 does not send data for a while I won't be seeing any more user ids on the dashboard even though sensor2 is sending data.
Would it be possible to use a regex as input for the metric variable? Something like this would work for me:
label_values(metric=~(app1_[^\s]+), uid)
But I'm not sure if this is possible in Grafana.
The following expression selects all metrics that have a name starting with job_
and have label method="GET"
{__name__=~"job_.*", method="GET"}
To get all metrics whose name start with app1_
use
{__name__=~"app1_.*"}
To get all metrics whose name start with app1_
and uid
equal to some specific value, use
{__name__=~"app1_.*", uid="value"}