How to limit panel variable queries to the selected time range?

I’m trying to create panel variable drop downs where the user can select a variable based on tags in the database. This query works:

SHOW TAG VALUES WITH KEY = “wlc”

However, that shows all of the keys for the tag “wlc” for all time. I’d like to narrow that down to the time range selected in the panel. I tried this:

SHOW TAG VALUES WITH KEY = “wlc” WHERE $timeFilter

But that generates the error

Templating init failed
error parsing query: missing parameter: timeFilter

How would one go about doing this?

In the words of the immortal Emily Litella: “Nevermind”. I see this is not supported (but is frequently requested).

There’s an open feature request for supporting this.

Marcus

Status of this is somewhat unclear, I have tested
SHOW TAG VALUES WITH KEY = “domain” WHERE $timeFilter
in Grafana v5.4.2 but I get:
“Template variables could not be initialized: error parsing query: missing parameter: timeFilter”
Anyone else that has tried this?

Hello Please add a template variable for timeFilter in the page.

Hi shyamaey, thanks for answering :slight_smile: Can you please explain a little more what you mean?