Olumide
Olumide

Reputation: 5839

Creating Grafana variable from the set of of all possible values of a label

I'd like to create a Grafana variable/filter of all possible values of a label region on the metric instance. The query for listing these value is:

group by (region)(instance)

Unfortunately, when I paste this query in Grafana >> Variables >> Query options >> Query I get the errors

Validation
cannot parse parameter match[]

and

Templating [region]
Error updating options: cannot parse parameter match[]

Upvotes: 7

Views: 22573

Answers (1)

Pedro Rodrigues
Pedro Rodrigues

Reputation: 707

To create a variable in Grafana that contains all values of a specific label in a specific metric you can use label_values(metric, label). You can also do label_values(metric{label2="test"}, label) if you want to be more specific.

In your case it seems to me that it should be label_values(instance, region), where instance is the metric and region is the label.

You have information about it in Grafana's documentation.

Upvotes: 15

Related Questions