todi
1
I’m on influx 2.0. I know that I can find unique tag values on a bucket by
import "influxdata/influxdb/v1"
v1.tagValues(bucket: "bucket-name", tag: "host")
but how do I find unique tag values in a certain time interval for a specific measurement?
@todi
Is a filter clause working ?
Maybe like this :
|> filter(fn: (r) => r._measurement == "your_measurement")
|> range(start: -5m)
todi
3
Thanks. No, I can’t do anything like this
import "influxdata/influxdb/v1"
v1.tagValues(bucket: "raw", tag: "serial")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "reading")
I can of course filter the bucket like this
from(bucket: "raw")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "reading")
but I don’t know how to count distinct tag values from here.
Did you read the doc ?
I can see more parameters like start parameter.
For the measurement I don’t know.
todi
5
Thanks. Somehow I manage to overlook this. The measurement can be put into the predicate. Below gives me the desired.
import "influxdata/influxdb/v1"
v1.tagValues(
bucket: "my_bucket",
tag: "my_tag",
start:-1h,
predicate: (r) => r._measurement == "my_measurement"
)