Documentation

schema.tagKeys() function

Flux 0.88.0+

The schema.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/schema"

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

Parameters

bucket

Bucket to return tag keys from.

predicate

Predicate function that filters tag keys. Default is (r) => true.

start

Oldest time to include in results. Default is -30d.

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

Examples

import "influxdata/influxdb/schema"

schema.tagKeys(bucket: "my-bucket")

Function definition

package schema

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

Supported in the InfluxDB Cloud UI

The schema package can retrieve schema information from the InfluxDB Cloud user interface (UI), but not from the Flux REPL.


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.