updated aggregate selector functions
parent
0eccc61f4e
commit
693e5f2137
|
@ -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)
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
```
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
```
|
||||
|
|
|
@ -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
|
||||
)
|
||||
```
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
```
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
```
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue