Multiple template variables in a single metric path


I am trying to use multiple template variables in a single metric query path. The datasource is Graphite.

My whisper file looks like: indices_artifact-11_english_total_merges_total-size.wsp and I have split out the index name and metric name into template variables with regexes. The index name and index metric name populate into the template variable dropdown fine, but attempting to access them in a single query path (or box) yields nothing (no error). I did have it working yesterday but my query got blown away so it should work (because I know it has). I also understand that I may be on the edge of supported functionality. If anyone has done something similar, I would appreciate some advice.

Currently, the query looks like this, where the $index would be artifact-11_english and $indexname would be total_merges_total-size


You can use the alternative [[varname]] for this use case

This does not seem to change the behavior at all. I’m assuming you mean my full query would simply change to:


I am getting the select metric box pop up indicating that it is not finding the metric properly. Got any other tricks I can try?

So it looks like just one template variable works but two does not.

I can do

But this does not work still:

Strange, no one has had any issues with that syntax before, using multiple in same metric path, try changing all to alternative syntax

@torkel that does not seem to help either. My regex must not be fully correct (maybe a whitespace issue?). Unfortunately the plugin I am using does not split index metrics into appropriate pathing (i.e. ...indices.$index.$indexmetric).

I’m running into this issue as well … no combination of [[varname]] or $varname works with underscores.

Trying to do something like this

Everything works up to and after the underscores. I’ve tried [[varname]] as well and it doesn’t work. Query inspection looks something like this:

Running: Grafana v4.5.2 (commit: ec2b0fe)


I’m also seeing the same issue using Hosted Graphite. It stops seeing metrics beyond hyphens for me. I’ve tried $varname and [[varname]] with hyphens in between, asterisks in between, and mixtures of them all and I can’t seem to get it to work.

To update this it appears, using inspect network options, the variables are being given curly brackets and this is why it’s not working:


A different graph with 3 variables put together the same way is not rendering with the curly brackets. Query with variables is:

aliasByNode(servers.$Client-$Environment-$Instance.rabbitmq.queues.$Queue.messages_ready, 1, 4)

And inspect shows the first two variables being rendered correctly (in bold below):


This has been resolved from changing the regex to a different format to collect the same information. It then started rendering the query successfully. When I revert the regex back to the old format, it is still working!

Have no idea what caused this or how it was fixed :slight_smile: