Using templates with regex series override

I am having trouble getting templates to work with regex in the series override.

The goal is to have a graph that has lines hidden (line width 0) and be able to make them visible (line width 1+) using a template drop down.


  1. Using Prometheus datasources
  2. Multiple datasources (ex. SiteA, SiteB, SiteC)
  3. Each datasource in a datasource template variable

My current approach:

  1. On the metrics tab, each query will have a different datasource and will have the datasource in the legend
    queries legend
  2. By default the lines will have a width of 0 (making them look hidden)
  3. Select the datasource we want visible in the template drop down
    datasource templated
  4. Use the template variable in series overrides to make the line width 1 (visible)

As you can see in the screen shot above, the override works as expected when I use a hard coded site value (ex. SiteA), but does not work when using the template variable (ex. SiteB that is selected in the drop down at the top of the screen).


  1. In the series overrides, is the template value evaluated before the regex expression (ex. /$SitesToShow/ is changed to /SiteB/ before evaluating the regex expression)?
  2. Is there an issue with my regex expression?
  3. Is there an easier/another approach to accomplish the same goal?
1 Like

Any thoughts on this issue?

I would be very interested in this too as you can make panels very dynamic e.g. in having the user look at min, avg, or max values - as per drop down selection instead of having to navigate to another panel.