Using a variable in a TSDB Metric Path


I’m not sure if this is a supported feature or not, but I have a use case where I need to change the path of a metric query in a tsdb datasource query. Due to a large amount of metrics on the back end system, we need to specify a different path to the metric depending on the datacentre. For example;



I created a custom variable (datacentre) with two values; dc1,dc2

I then have a second variable (host) which will get a list of hosts for a metric (datasource query) with the path above, i.e.;
tag_values(system.$datacentre.cpu.load, host)
I have also tried using this format:
tag_values(system.[[datacentre]].cpu.load, host)

In both cases, instead of the metric path changing to ‘system.dc1.cpu.load’ it seems to treat it like an array of values. Using develop tools I see this is the query sent to the backend;

Whereas I would expect it to look like this:

Is this a supported use-case? Or should I open a feature request for this?


What version of Grafana are you using? This should be fixed in 4.2