When using "Custom" template vars, there is no "none" option choosable

As stated in the title, I use a TSDB datasource which splits stats if you select “All” as it pipes them all together as a composite. That’s not a desirable default value. The default value should be not to use the filter, as it is with TSDB’s UI. I tried using a space, the word null, open and closed quotes with no value, and putting an item in the array that is blank such as “Item1,Item2,Item3” and all of these values are either pruned in the case of spaces or blanks, or outright fails in terms of the other attempts.

How can I get a “None” or “Null” option.

1 Like

The templating system is based interpolation. So if you use it for a filter most TSDB query languages do no consider an empty filter value as no filter at all but would filter it for something being empty.

So a None / Null option would not work for many data sources. For example InfluxDB WHERE hostname="" , Graphite my.metric.$hostname.req.count after interpolation my.metric..req.count (just empty string) would be an invalid query. Same is true for most Databases Grafana support.

That is why there is no None / Null option.

I get that there’s a method behind the logic here, but this is super limiting if i want to create a split between data centers, secure vs non secure delivery, canaries vs controls, and such where the traffic is not proportional and those stats become noise against the overall because i can’t tell it to ignore that value all together. There must be a compromise somewhere that would allow support for data systems beyond influxdb and graphite. Even if it doesn’t work for those, the utility of this option for TSDB systems would be clutch. The worst part is that I can’t use the All override to hard wire that to ignore the param.

Maybe there’s a way i can hack the All value to be the entire tag rather than key value pair? Basically what I’m saying is I really need this function to realize the full potential of this tool, and I’m ok with finding any possible ugly hacky solution if it works, because it’s just that necessary to have.

1 Like

BTW, this forum system is beautiful. I’m not sure if you wrote this yourself or if it’s a plugin or service, but it’s really lovely to use.

Yes, it’s pretty great. It’s an open source project called [Discourse] (http://www.discourse.org/)

Neat! Thanks for sharing. BTW, the request is poorly described as “none”. It should really be “Ignore”

Not sure I understand your request thoughh, the splits your talking about. What stops you from doing that now? And how would grafana Interpolate the template variable so that it would generate a valid query in your case.

Do you have solution?

There were additionally two template fields here at the top. Data center, and secure. When “All” is selected, or rather “Ignore”, the item should be able to specify nothing or the tag should be capable of selecting nothing. I tried to dump some xss style escaped markup into the template to hijack the json and dump an empty param in here to see if it would ignore it, but because it’s json, it’s not quite the same as hacking the plain query string param and your app is too good and properly escaped my first few attempts at breaking out of the valid escaping.

This time with some illustration in a working query

And OpenTSDB has the same problem as the one I mentioned for InfluxDB and Graphite.

A tag filter like campaing_type = "" will filter empty value not ignore the filter.

So what is the difference between All and no filter in you case? We have a special type of template variable called ad-hoc which allows you to define on demand key / value filters globally for a whole dashboard. These key / value filters will be applied automatically to all queries using that data source in the dashboard. This feature is currently only supported by InfluxDB and Elasticsearch.


I think the ask was to remove the filter by a given tag when a known/predefined value like “none” or “ignore” is used. In jeffreytgilbert example above when he selects dc=Ignore, I believe his expectation is that the downstream query to OpenTSDB/InfluxDB/Graphite does not include any filtering by dc tag.

I for one would be keen to have such feature. It will allow one to drill down from an aggregated series to its constituent components.

I am not sure if it is exactly what you want, but I managed to change the ALL option into a NONE (in a hacky way)


I manage this by applying regex.

For this, the filters on the metric must use the operator =~ like:

external_sql_connection_monitor{environment=~"$environment", tenantId=~"$tenantId", internalName=~"$internalName"}

Now configure the Custom all value for the variable, with: .+

It worked like a charm