'Grafana chained variables in repeating rows

I have a dashboard that uses two variables:

Variables on the dashboard

$clients is a static list and $running_sessions is the result of a MySql query that uses $clients (something like select id from sessions where client_id in ($clients)).

I have a row that repeats per client defined like this:

Row definition

Inside the row, I have a panel that uses $running_sessions from a Prometheus data source.

sum without(instance) (metrics{module="XXX",category="XXX",name="RunStatus",id=~"$running_sessions"})

If All is selected for $clients, I get a row per client (expected), but the panel shows the sessions of all the clients, instead of the sessions of the client of the row.

I was expecting that the value of $running_sessions on a specific row would be computed using the local value of $clients.

Is there a way to achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source