diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/aggregatewindow.md b/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/aggregatewindow.md index 59495d4c5..d2bca2668 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/aggregatewindow.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/aggregates/aggregatewindow.md @@ -92,6 +92,7 @@ from(bucket: "telegraf/autogen") r._measurement == "mem" and r._field == "used_percent") |> aggregateWindow( + column: "_value", every: 5m, fn: (column, tables=<-) => tables |> quantile(q: 0.99, column:column) ) diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestaverage.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestaverage.md index 3d73486e2..09ce2f002 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestaverage.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestaverage.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js highestAverage( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,22 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -highestAverage = (n, columns=["_value"], groupColumns=[], tables=<-) => +highestAverage = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, columns:columns, groupColumns:groupColumns, - reducer: (tables=<-) => tables |> mean(columns:[columns[0]]), + reducer: (tables=<-) => tables |> mean(column:column), _sortLimit: top, ) ``` diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestcurrent.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestcurrent.md index 69e7cea08..25640418e 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestcurrent.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestcurrent.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js highestCurrent( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,22 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -highestCurrent = (n, columns=["_value"], groupColumns=[], tables=<-) => +highestCurrent = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, - columns:columns, + column:column, groupColumns:groupColumns, - reducer: (tables=<-) => tables |> last(column:columns[0]), + reducer: (tables=<-) => tables |> last(column:column), _sortLimit: top, ) ``` diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestmax.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestmax.md index 8532c8f8b..d1214a71e 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestmax.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/highestmax.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js highestMax( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,22 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -highestMax = (n, columns=["_value"], groupColumns=[], tables=<-) => +highestMax = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, - columns:columns, + column:column, groupColumns:groupColumns, - reducer: (tables=<-) => tables |> max(column:columns[0]), + reducer: (tables=<-) => tables |> max(column:column), _sortLimit: top ) ``` diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestaverage.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestaverage.md index 8acce67c1..ee40c18e9 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestaverage.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestaverage.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js lowestAverage( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,22 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -lowestAverage = (n, columns=["_value"], groupColumns=[], tables=<-) => +lowestAverage = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, - columns:columns, + column:column, groupColumns:groupColumns, - reducer: (tables=<-) => tables |> mean(columns:[columns[0]]), + reducer: (tables=<-) => tables |> mean(column:column]), _sortLimit: bottom, ) diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestcurrent.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestcurrent.md index 74a038b7b..9adbd5f46 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestcurrent.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestcurrent.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js lowestCurrent( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,22 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -lowestCurrent = (n, columns=["_value"], groupColumns=[], tables=<-) => +lowestCurrent = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, - columns:columns, + column:column, groupColumns:groupColumns, - reducer: (tables=<-) => tables |> last(column:columns[0]), + reducer: (tables=<-) => tables |> last(column:column), _sortLimit: bottom, ) ``` diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestmin.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestmin.md index 1d7acdfaf..63b3f79b4 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestmin.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/lowestmin.md @@ -17,7 +17,7 @@ _**Function type:** Selector, Aggregate_ ```js lowestMin( n:10, - columns: ["_value"], + column: "_value", groupColumns: [] ) ``` @@ -29,12 +29,11 @@ Number of records to return. _**Data type:** Integer_ -### columns -List of columns by which to sort. -Sort precedence is determined by list order (left to right). -Default is `["_value"]`. +### column +Column by which to sort. +Default is `"_value"`. -_**Data type:** Array of strings_ +_**Data type:** String_ ### groupColumns The columns on which to group before performing the aggregation. @@ -63,23 +62,22 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) => // _highestOrLowest is a helper function which reduces all groups into a single // group by specific tags and a reducer function. It then selects the highest or -// lowest records based on the columns and the _sortLimit function. +// lowest records based on the column and the _sortLimit function. // The default reducer assumes no reducing needs to be performed. -_highestOrLowest = (n, _sortLimit, reducer, columns=["_value"], groupColumns=[], tables=<-) => +_highestOrLowest = (n, _sortLimit, reducer, column="_value", groupColumns=[], tables=<-) => tables |> group(columns:groupColumns) |> reducer() |> group(columns:[]) - |> _sortLimit(n:n, columns:columns) + |> _sortLimit(n:n, columns:[column]) -lowestMin = (n, columns=["_value"], groupColumns=[], tables=<-) => +lowestMin = (n, column="_value", groupColumns=[], tables=<-) => tables |> _highestOrLowest( n:n, - columns:columns, + column:column, groupColumns:groupColumns, - // TODO(nathanielc): Once max/min support selecting based on multiple columns change this to pass all columns. - reducer: (tables=<-) => tables |> min(column:columns[0]), + reducer: (tables=<-) => tables |> min(column:column), _sortLimit: bottom, ) ``` diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/max.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/max.md index b7381c1dc..add7d0067 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/max.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/max.md @@ -16,9 +16,17 @@ _**Function type:** Selector_ _**Output data type:** Object_ ```js -max() +max(column: "_value") ``` +## Parameters + +### column +The column to use to calculate the maximum value. +Default is `"_value"`. + +_**Data type:** String_ + ## Examples ```js from(bucket:"telegraf/autogen") diff --git a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/min.md b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/min.md index 9ecdc94fe..5fe55d001 100644 --- a/content/v2.0/reference/flux/functions/built-in/transformations/selectors/min.md +++ b/content/v2.0/reference/flux/functions/built-in/transformations/selectors/min.md @@ -16,9 +16,17 @@ _**Function type:** Selector_ _**Output data type:** Object_ ```js -min() +min(column: "_value") ``` +## Parameters + +### column +The column to use to calculate the minimum value. +Default is `"_value"`. + +_**Data type:** String_ + ## Examples ```js from(bucket:"telegraf/autogen")