Docs

v2.0

v1.tagValues() function

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"

v1.tagValues(
  bucket: "example-bucket",
  tag: "host",
  predicate: (r) => true,
  start: -30d
)

Parameters

bucket

The bucket from which to list tag values.

Data type: String

tag

The tag for which to return unique values.

Data type: String

predicate

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

Data type: Function

start

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

Examples

import "influxdata/influxdb/v1"

v1.tagKeys(
  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


Bug Reports and Feedback

Thank you for being willing to help test InfluxDB v2.0 alpha! Feedback and bug reports are welcome and encouraged both for InfluxDB and this documentation.

Submit feedback in the InfluxData Community