Hi,
I may have kind of an impossible request here.
we’ve been asked to make a dashboard that is filtered by a specific tag but sometimes as it’s a migration in progress the tag is not set.
I defined a variable that takes the value of the tag with a simple query ( "show tag values from _bms_metrics with key = “typetrt” where env =~ /^$env$/ " ) but I don’t see how it could take a default value if the tag is not set and then filtering those unset measurements like that… Is it even possible ? Should I take a different path to filter the measurement that have this value set or not set ( and by value if possible ).
Thanks for reading.
Hello @miogi,
What version of InfluxDB are you using?
There are dashbaord variables but they’re not schema aware:
Also what project are you working on with InfluxDB I love to learn about customer/user use cases.
In Grafana…I think you can do something like…
Create a New Variable in Grafana
Go to Settings > Variables > New.
Set the Type to Query.
Set the Name to something like typetrt_value.
Use the following query to include a default option for missing tags:
SHOW TAG VALUES FROM "_bms_metrics" WITH KEY = "typetrt" WHERE "env" =~ /^$env$/
Check the Include All option box. This allows you to select all values including missing ones. Add a Custom Value like No Tag to handle the case when the tag is missing.
Use a Regular Expression for Filtering
In the Regex field, add a regex pattern to filter out tags that are not set:
/.*/|No Tag
I hope that helps! Otherwise I’d ask the fine people over at the Grafana community
Hi,
Thanks for taking the time to answer my request.
We’re in Enterprise version for influxdb, Grafana v10.1.3
“Use the following query to include a default option for missing tags:”
=> The query you wrote is the same as my original post, I think you forgot to write yours