Multi value variable to multi query

Hi Grafana community,

I am using Grafana 9.0.9 with graphite data source plugin (in mode metric tank) and am trying to create a dashboard to dynamically combine (sum) metrics from multiple paths in one Time Series Panel.

I have an additional json api datasource, where I have access to additional data.
The goal is to expose two text fields to a dashboard user, wherein one can provide two regex. Those regex get evaluated in that json api datasource which returns some result in an additional variable, I aim to use in the query. Lets say that variable is called “host_interface_path”

The user enters for example “device [AB]” in the host regex field, and “[XY]” in the interface regex field, to get the sum of all combination. Lets say its:

device A interface X in
device B interface Y in

That dashboard variable “host_interface_map” would than contain in the given example two paths to those metrics, like:

device_A.InterfaceX
device_B.InterfaceY

I try to utilze the variable in a query like this:

sumSeries(${host_interface_map}.in)

If I select one value of host_interface_map, the metric is properly graphed in the panel.
If I select more than one value of host_interface_map, the panel shows “No data”

In the query inspector, I can see that multi value of host_interface_map in the query above gets substituted to:
{device_A.InterfaceX,device_B.InterfaceY}.in

Fine, just doesn’t work.

What works is for example: “device_A.{InterfaceX,InterfaceY}.in”
Unfortunately not what I need. I need device_A.InterfaceX + device_B.InterfaceY

I could of course have multiple query series A,B,C… and do the sum operation on those. Is there a possibility to make grafana dynamically create one query series for each value in a variable?

Maybe you guys have an idea how I could achive what I am trying to do with variables.

If I repeat the panel by the variable host_interface_map, the multiple instances of the time series panel gets rendered also properly by the way.

Hopefully I was able to explain properly and don’t scare everyone away with my wall of text :slight_smile:

Cheers!

Maybe it helps to understand my issue and find a workaround:

The query series A doesn’t return any result
I’ve entered the queries B and C manually, to show which data I’d expect from query A:

The query inspector shows this:

Object
request:Object
method:"POST"
url:"api/datasources/proxy/36/render"
data:"target=%7Bgnms_sw-int_12c_r9_bs_kae_de.Interface_port-channel1%2Cgnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_49%2Cgnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_51%7D.in&target=gnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_51.in&target=gnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_49.in&from=1684843233&until=1684846835&format=json&maxDataPoints=1548&meta=true"
hideFromInspector:false
response:Object
version:"v0.1"
meta:Object
stats:Object
series:Array[2]
0:Object
1:Object

I think it would work if I could change the “A”-grafana query to pass each variable value via an extra target parameter.