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:
- app1_current_sensor1
- app1_current_sensor2
- app2_current_sensor2
- app2_current_sensor3
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.
label_values({__name__=~"app1_.*"}, uid)
– Preceptive