schema.tagKeys() function

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.

  1. import "influxdata/influxdb/schema"
  2. schema.tagKeys(
  3. bucket: "example-bucket",
  4. predicate: (r) => true,
  5. start: -30d
  6. )

Parameters

bucket

Bucket to return tag keys from.

*Data type: String*

predicate

Predicate function that filters tag keys. 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/schema"
  2. schema.tagKeys(bucket: "my-bucket")

Function definition

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

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

Related articles

tags