PromQL - Possible to query label by list of values?

Is is possible in PromQL to query a label with a list of values? For example this is a how you’d do it in SQL:

FROM my_table
WHERE column_1 IN ('A', 'B', 'C')

Is there a similar syntax in PromQL? I would have imagined something like this:

my_metric{Lable_1=["A", "B", "C"]}

You would use the regex match operator =~ like this:


If you use a Grafana list of values variable then it’s:


If you set a Custom all value of .* in your variable it may help performance if you have a long list of values.

More info:

1 Like

This was super helpful for me, thanks! However, I did notice that


should be:


so the whole regex is quoted and not just the values. It explains it in the link you shared, but saves one more click for others :grinning: