Reputation: 957
I using influxdb to create a dashboard and i have a variable define by
import "influxdata/influxdb/schema"
schema.tagValues(bucket: v.bucket, tag: "my-tag")
I can use the variable in my dashboard with this example query.
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "aMeasure")
|> filter(fn: (r) => r["my-tag"] == v.myTag)
|> cumulativeSum()
|> yield()
But i want to have the possibility to not select a value and have an unfiltered dashboard but i don't find how to do that with influxdb dashboard and query
Upvotes: 0
Views: 320
Reputation: 465
I wish I knew a better way, but I did this.
'<all>'
in this case):import "csv"
import "influxdata/influxdb/v1"
actual = v1.tagValues(
bucket: myBucket,
tag: "name",
predicate: (r) => true,
)
csvData = "
#datatype,string,long,string
#group,false,false,false
#default,,,
,result,table,_value
,,0,<all>
"
special = csv.from(csv: csvData)
union(tables: [special, actual])
if
condition in filter
handling the wildcard value ...
|> filter(fn: (r) => if v.name == "<all>" then true else r.name == v.name)
...
Upvotes: 1