State Timeline with multiple queries from dashboard variable

Hi all -

I’m trying to achieve a multi-result state timeline with data sourced from a query, using a custom key:value dashboard variable.

Grafana v9.5.21
Datasource Influx-DB

My variable node_ids_state looks as follows:

m000 : 5db76d7635868c1f85fd45bbd3bb838a,m001 : 3a756eff845006f589a1ff981125a677,...

The key represents a device-name, the value holds the id which is used as tag for Influx-DB time-series.
My goal is a state-timeline showing results from a (or multiple) query, labeled with the device-name. See example below:


My actual query is looking like this:

SELECT "str" FROM "autogen"."nodes_hist" WHERE ("nodeId" =~ /${node_ids_state:pipe}/) AND $timeFilter Group BY nodeId order by time DESC LIMIT 10000

Which queries data for the given nodes but has obviously no relation to the device-name, giving the following result:


So what I basically need is to get the device-name from the dashboard-variable in the state-timeline.

Any idea?

Thanks and regards,
Oliver

something like this?

Ah sorry yosiasz, maybe I was unclear!

I don’t want to put this text on the panel but as labels with the state timeline. Here a better example:


Basically the alias name from the query:

In the same way I take the id from the variable I would also like to map the device-name.

Thanks!

yeah that was just to show usage. so can you use a variable in the Alias field ie ${node_ids_state:text} ?

Hi,

this works for single but not for multi-selection variable. The following setup:


gives this result on a multi-selection:

Since that query returns multiple data series, there is no 1:1 mapping.

Regards,
Oliver