Variables with multiple values in query

Hello Community,

I’m trying to create a graph with a query where I can use/pass multiple values into a single query. Something similar to this:

request_count:count:service{service!~"api1|api2|api3"}

where, “request_count:count:service” is a record rule sourced from Prometheus.

I want to replace my query with a variable. I have a variable with label values, that returns all the services/apis as expected.

How do I then pipe these values into my query above? When I use the “pipe” formatting option in my query, only one value gets evaluated/selected.

topk($top, sum by (service) (request_count:count:service{service=~'${all_services_copy_of_service:pipe}'}))


Any help would be greatly appreciated, thank you.