Skip to content

Commit

Permalink
updating functions for flux 0.12 (#5035)
Browse files Browse the repository at this point in the history
* updating functions for flux 0.12

* updating changelog

* fixing url and lowestmin function
  • Loading branch information
russorat authored Jan 11, 2019
1 parent 4c1b9e5 commit 0dd890e
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
1. [#4906](https://github.com/influxdata/chronograf/pull/4906): Prevent Kapacitor URLs from being overwritten in Connection Wizard.
1. [#4862](https://github.com/influxdata/chronograf/pull/4909): Fix logs intermitently show empty on first load
1. [#5034](https://github.com/influxdata/chronograf/pull/5034): Prevent meta node URLs from being overwritten in Connection Wizard.
1. [#5035](https://github.com/influxdata/chronograf/pull/5035): Update functions list for Flux 0.12

## v1.7.5 [2018-12-14]

Expand Down
244 changes: 218 additions & 26 deletions ui/src/flux/constants/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ export const functions: FluxToolbarFunction[] = [
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/aggregates/aggregatewindow',
},
{
name: 'assertEquals',
args: [
{
name: 'name',
desc: 'Unique name given to the assertion.',
type: 'String',
},
{
name: 'got',
desc: 'The stream containing data to test.',
type: 'Object',
},
{
name: 'want',
desc: 'The stream that contains the expected data to test against.',
type: 'Object',
},
],
desc: 'Tests whether two streams have identical data.',
example: 'assertEquals(got: got, want: want)',
category: 'Test',
link:
'https://docs.influxdata.com/flux/latest/functions/tests/assertequals',
},
{
name: 'bottom',
args: [
Expand Down Expand Up @@ -90,12 +115,12 @@ export const functions: FluxToolbarFunction[] = [
args: [
{
name: 'x',
desc: 'First input stream used to calculate the covariance.',
desc: 'One input stream used to calculate the covariance.',
type: 'Object',
},
{
name: 'y',
desc: 'Second input stream used to calculate the covariance.',
desc: 'The other input table used to calculate the covariance.',
type: 'Object',
},
{
Expand Down Expand Up @@ -325,53 +350,129 @@ export const functions: FluxToolbarFunction[] = [
link: 'https://docs.influxdata.com/flux/latest/functions/inputs/from',
},
{
name: 'fromRows',
name: 'fromCSV',
args: [
{
name: 'bucket',
desc: 'The name of the bucket to query.',
name: 'file',
desc: 'The file path of the CSV file to query.',
type: 'String',
},
{
name: 'bucketID',
desc: 'The string-encoded ID of the bucket to query.',
name: 'csv',
desc:
'Raw CSV-formatted text. CSV data must be in the CSV format produced by the Flux HTTP response standard.',
type: 'String',
},
],
desc:
'This is a special application of the `pivot()` function that will automatically align fields within each measurement that have the same timestamp.',
example: 'fromRows(bucket: "bucket-name")',
desc: 'Retrieves data from a comma-separated value (CSV) data source.',
example: 'from(file: "/path/to/data-file.csv")',
category: 'Inputs',
link: 'https://docs.influxdata.com/flux/latest/functions/inputs/fromrows',
link: 'https://docs.influxdata.com/flux/latest/functions/inputs/fromcsv',
},
{
name: 'group',
args: [
{
name: 'by',
name: 'columns',
desc:
'List of columns by which to group. Cannot be used with `except`.',
'List of columns to use in the grouping operation. Defaults to `[]`.',
type: 'Array of Strings',
},
{
name: 'except',
name: 'mode',
desc:
'List of columns by which to NOT group. All other columns are used to group records. Cannot be used with `by`.',
type: 'Array of Strings',
},
{
name: 'none',
desc: 'Remove existing groups.',
type: 'Boolean',
'The mode used to group columns. The following options are available: by, except. Defaults to `"by"`.',
type: 'String',
},
],
desc:
'Groups records based on their values for specific columns. It produces tables with new group keys based on provided properties.',
example: 'group(by: ["host", "_measurement"])',
example: 'group(columns: ["host", "_measurement"], mode:"by")',
category: 'Transformations',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/group',
},
{
name: 'highestAverage',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the top `n` records from all groups using the average of each group.',
example: 'highestAverage(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/highestaverage',
},
{
name: 'highestCurrent',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the top `n` records from all groups using the last value of each group.',
example: 'highestCurrent(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/highestcurrent',
},
{
name: 'highestMax',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the top `n` records from all groups using the maximum of each group.',
example: 'highestMax(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/highestmax',
},
{
name: 'histogram',
args: [
Expand Down Expand Up @@ -473,6 +574,16 @@ export const functions: FluxToolbarFunction[] = [
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/aggregates/increase',
},
{
name: 'influxFieldsAsCols',
args: [],
desc:
'A special application of the `pivot()` function that automatically aligns fields within each input table that have the same timestamp.',
example: 'influxFieldsAsCols()',
category: 'Transformations',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/influxfieldsascols',
},
{
name: 'integral',
args: [
Expand Down Expand Up @@ -712,6 +823,87 @@ export const functions: FluxToolbarFunction[] = [
link:
'https://docs.influxdata.com/flux/latest/functions/misc/logarithmicbins',
},
{
name: 'lowestAverage',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the bottom `n` records from all groups using the average of each group.',
example: 'lowestAverage(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/lowestaverage',
},
{
name: 'lowestCurrent',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the bottom `n` records from all groups using the last value of each group.',
example: 'lowestCurrent(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/lowestcurrent',
},
{
name: 'lowestMin',
args: [
{
name: 'n',
desc: 'Number of records to return.',
type: 'Integer',
},
{
name: 'columns',
desc: 'List of columns by which to sort. Default is `["_value"]`.',
type: 'Array of Strings',
},
{
name: 'groupColumns',
desc:
'The columns on which to group before performing the aggregation. Default is `[]`.',
type: 'Array of Strings',
},
],
desc:
'Returns the bottom `n` records from all groups using the maximum of each group.',
example: 'lowestMin(n:10, groupColumns: ["host"])',
category: 'Selectors',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/selectors/lowestmin',
},
{
name: 'map',
args: [
Expand Down Expand Up @@ -1051,15 +1243,15 @@ export const functions: FluxToolbarFunction[] = [
type: 'Function',
},
{
name: 'label',
name: 'column',
desc:
'The name of the column added to each record that contains the incremented state count.',
type: 'String',
},
],
desc:
'Computes the number of consecutive records in a given state and stores the increment in a new column.',
example: 'stateCount(fn: (r) => r._field == "state", label: "stateCount")',
example: 'stateCount(fn: (r) => r._field == "state", column: "stateCount")',
category: 'Transformations',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/statecount',
Expand All @@ -1074,7 +1266,7 @@ export const functions: FluxToolbarFunction[] = [
type: 'Function',
},
{
name: 'label',
name: 'column',
desc:
'Name of the column added to each record that contains the incremented state duration.',
type: 'String',
Expand All @@ -1088,7 +1280,7 @@ export const functions: FluxToolbarFunction[] = [
desc:
'Computes the duration of a given state and stores the increment in a new column.',
example:
'stateDuration(fn: (r) => r._measurement == "state", lable: "stateDuration", unit: 1s)',
'stateDuration(fn: (r) => r._measurement == "state", column: "stateDuration", unit: 1s)',
category: 'Transformations',
link:
'https://docs.influxdata.com/flux/latest/functions/transformations/stateduration',
Expand Down

0 comments on commit 0dd890e

Please sign in to comment.