Templating - Select one of the predefined variables


I have two query type variables already defined, say ‘FirstHalfList’ and ‘SecondHalfList’ now I want to define a third variable that allows me to select one of these.

Eg My time-series could be : 1, 2, … , 10

result of FirstHalfList query ($FirstHalfList) : 1, 2,…, 5
result of SecondHlfList query ($SecondHalfList): 6, 7, …, 10

I want a new variable “ActualSelectedList” for which I can select one of “FirstHalfList” and “SecondHalfList” but the actual value of this new variable should be the value of the selected variable. (One extra layer of indirection)

Effectively this is pre-defined multiple selection (the multiple selections are tagged, and only tag is selected, just like we select ‘All’ tag). So instead of every time selecting all 1, 2, …5, I would only select ‘FirstHalfList’ (which is a tag for all that subset)



I imagine that you’re using Graphite as datasource, is that correct?

If I understand your question correctly you want to be able to use the Valug groups/tags support based on your above metrics.

If you don’t have the “FirstHalfList” and “SecondHalfList” in your Graphite metrics path, i.e. “something.FirstHalfList.1” I think it will be hard to use the Valug groups/tags functionality in Grafana since you probably want to define a Tags query as something.* and the Tag values query as `something.$tag.*. On solution to your problem may be to store your metrics in a different way to be able to easier filter them (as my examples above for example).

Another option may be to have a look at Graphite 1.1 since it introduces support for labels, however Grafana don’t support this feature yet.