v1.tagValues() function

v1.tagValues() was deprecated in Flux v0.88.0 in favor of schema.tagValues().

The v1.tagValues() function returns a list of unique values for a given tag. The return value is always a single table with a single column, _value.

  1. import "influxdata/influxdb/v1"
  2. v1.tagValues(
  3. bucket: "example-bucket",
  4. tag: "host",
  5. predicate: (r) => true,
  6. start: -30d
  7. )

Parameters

bucket

Bucket to return unique tag values from.

*Data type: String*

tag

Tag to return unique values from.

*Data type: String*

predicate

Predicate function that filters tag values. Defaults to (r) => true.

*Data type: Function*

start

Oldest time to include in results. Defaults to -30d.

Relative start times are defined using negative durations. Negative durations are relative to now. Absolute start times are defined using time values.

*Data type: Duration*

Examples

  1. import "influxdata/influxdb/v1"
  2. v1.tagValues(
  3. bucket: "my-bucket",
  4. tag: "host",
  5. )

Function definition

  1. package v1
  2. tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
  3. from(bucket: bucket)
  4. |> range(start: start)
  5. |> filter(fn: predicate)
  6. |> group(columns: [tag])
  7. |> distinct(column: tag)
  8. |> keep(columns: ["_value"])

*Used functions: from, range, filter, group, distinct, keep*

Related articles

tags