hotfix: update tagValues definition, closes influxdata/DAR#219, closes influxdata/influxdb#22063
parent
6b0ee2968a
commit
6795fe916b
|
@ -15,75 +15,4 @@ related:
|
|||
introduced: 0.88.0
|
||||
---
|
||||
|
||||
The `schema.tagValues()` function returns a list of unique values for a given tag.
|
||||
The return value is always a single table with a single column, `_value`.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/schema"
|
||||
|
||||
schema.tagValues(
|
||||
bucket: "example-bucket",
|
||||
tag: "host",
|
||||
predicate: (r) => true,
|
||||
start: -30d
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### bucket
|
||||
Bucket to return unique tag values from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### tag
|
||||
Tag to return unique values from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### predicate
|
||||
Predicate function that filters tag values.
|
||||
_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](/influxdb/cloud/reference/flux/language/types/#time-types).
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
## Examples
|
||||
```js
|
||||
import "influxdata/influxdb/schema"
|
||||
|
||||
schema.tagValues(
|
||||
bucket: "my-bucket",
|
||||
tag: "host",
|
||||
)
|
||||
```
|
||||
|
||||
## Function definition
|
||||
```js
|
||||
package schema
|
||||
|
||||
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](/influxdb/cloud/reference/flux/stdlib/built-in/inputs/from/),
|
||||
[range](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/range/),
|
||||
[filter](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/filter/),
|
||||
[group](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/group/),
|
||||
[distinct](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/selectors/distinct/),
|
||||
[keep](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/keep/)_
|
||||
{{< duplicate-oss >}}
|
|
@ -16,80 +16,4 @@ introduced: 0.16.0
|
|||
deprecated: 0.88.0
|
||||
---
|
||||
|
||||
{{% warn %}}
|
||||
`v1.tagValues()` was deprecated in **Flux v0.88.0** in favor of
|
||||
[`schema.tagValues()`](/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagvalues/).
|
||||
{{% /warn %}}
|
||||
|
||||
The `v1.tagValues()` function returns a list of unique values for a given tag.
|
||||
The return value is always a single table with a single column, `_value`.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.tagValues(
|
||||
bucket: "example-bucket",
|
||||
tag: "host",
|
||||
predicate: (r) => true,
|
||||
start: -30d
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### bucket
|
||||
Bucket to return unique tag values from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### tag
|
||||
Tag to return unique values from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### predicate
|
||||
Predicate function that filters tag values.
|
||||
_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](/influxdb/cloud/reference/flux/language/types/#time-types).
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
## Examples
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.tagValues(
|
||||
bucket: "my-bucket",
|
||||
tag: "host",
|
||||
)
|
||||
```
|
||||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
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](/influxdb/cloud/reference/flux/stdlib/built-in/inputs/from/),
|
||||
[range](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/range/),
|
||||
[filter](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/filter/),
|
||||
[group](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/group/),
|
||||
[distinct](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/selectors/distinct/),
|
||||
[keep](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/keep/)_
|
||||
{{< duplicate-oss >}}
|
|
@ -75,9 +75,9 @@ tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
|
|||
from(bucket: bucket)
|
||||
|> range(start: start)
|
||||
|> filter(fn: predicate)
|
||||
|> group(columns: [tag])
|
||||
|> keep(columns: [tag])
|
||||
|> group()
|
||||
|> distinct(column: tag)
|
||||
|> keep(columns: ["_value"])
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
|
|
|
@ -75,15 +75,13 @@ v1.tagValues(
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
|
||||
from(bucket: bucket)
|
||||
|> range(start: start)
|
||||
|> filter(fn: predicate)
|
||||
|> group(columns: [tag])
|
||||
|> keep(columns: [tag])
|
||||
|> group()
|
||||
|> distinct(column: tag)
|
||||
|> keep(columns: ["_value"])
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
|
|
Loading…
Reference in New Issue