InfluxDB Docs

v1.tagKeys() function

The v1.tagKeys() function returns a list of tag keys for all series that match the predicate. The return value is always a single table with a single column, _value.

import "influxdata/influxdb/v1"

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

Parameters

bucket

The bucket from which to list tag keys.

Data type: String

predicate

The predicate function that filters tag keys. 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")

Function definition

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

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