v1.tagValues() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.65 is the most recent stable version of Flux.

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

import "influxdata/influxdb/v1"

  bucket: "telegraf/autogen",
  tag: "host",
  predicate: (r) => true,
  start: -30d



The bucket from which to list tag values.

Data type: String


The tag for which to return unique values.

Data type: String


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

Data type: Function


Specifies the oldest time to be included in the results. Defaults to -30d.

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

Data type: Duration


import "influxdata/influxdb/v1"

  bucket: "my-bucket",
  tag: "host",

Function definition

tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
  from(bucket: bucket)
    |> range(start: start)
    |> filter(fn: predicate)
    |> group(columns: [tag])
    |> distinct(column: tag)
    |> keep(columns: ["_value"])

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