resolved merge conflicts with master branch

pull/390/head
Scott Anderson 2019-08-13 15:00:26 -06:00
commit 6202c401d0
19 changed files with 175 additions and 10 deletions

View File

@ -56,7 +56,7 @@ pre {
padding: 0;
font-size: .95rem;
line-height: 1.5rem;
white-space: pre-wrap;
white-space: pre;
}
}

View File

@ -35,7 +35,9 @@ to(
```
{{% note %}}
### Output data requirements
The `to()` function converts output data into line protocol and writes it to InfluxDB.
Line protocol requires each record to have a timestamp, a measurement, a field, and a value.
All output data must include the following columns:
@ -47,21 +49,25 @@ All output data must include the following columns:
{{% /note %}}
## Parameters
{{% note %}}
`bucket` OR `bucketID` is **required**.
{{% /note %}}
### bucket
The bucket to which data is written. Mutually exclusive with `bucketID`.
_**Data type:** String_
### bucketID
The ID of the bucket to which data is written. Mutually exclusive with `bucket`.
_**Data type:** String_
### org
The organization name of the specified [`bucket`](#bucket).
Only required when writing to a remote host.
Mutually exclusive with `orgID`
@ -73,6 +79,7 @@ Specify either an `org` or an `orgID`, but not both.
{{% /note %}}
### orgID
The organization ID of the specified [`bucket`](#bucket).
Only required when writing to a remote host.
Mutually exclusive with `org`.
@ -92,18 +99,21 @@ _Required when a `host` is specified._
_**Data type:** String_ -->
### timeColumn
The time column of the output.
Default is `"_time"`.
_**Data type:** String_
### tagColumns
The tag columns of the output.
Defaults to all columns with type `string`, excluding all value columns and the `_field` column if present.
_**Data type:** Array of strings_
### fieldFn
Function that takes a record from the input table and returns an object.
For each record from the input table, `fieldFn` returns an object that maps output the field key to the output value.
Default is `(r) => ({ [r._field]: r._value })`
@ -111,9 +121,14 @@ Default is `(r) => ({ [r._field]: r._value })`
_**Data type:** Function_
_**Output data type:** Object_
{{% note %}}
Make sure `fieldFn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
## Examples
### Default to() operation
Given the following table:
| _time | _start | _stop | _measurement | _field | _value |
@ -138,6 +153,7 @@ _measurement=a temp=99.9 0007
```
### Custom to() operation
The `to()` functions default operation can be overridden. For example, given the following table:
| _time | _start | _stop | tag1 | tag2 | hum | temp |
@ -164,4 +180,5 @@ _tag1=a hum=55.5,temp=99.9 0007
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT INTO](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-into-clause)

View File

@ -32,12 +32,18 @@ View the [function definition](#function-definition).
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### every
The duration of windows.
_**Data type:** Duration_
### fn
The [aggregate function](/v2.0/reference/flux/functions/built-in/transformations/aggregates) used in the operation.
_**Data type:** Function_
@ -47,24 +53,28 @@ Only aggregate and selector functions with a `column` parameter (singular) work
{{% /note %}}
### column
The column on which to operate.
Defaults to `"_value"`.
_**Data type:** String_
### timeSrc
The time column from which time is copied for the aggregate record.
Defaults to `"_stop"`.
_**Data type:** String_
### timeDst
The "time destination" column to which time is copied for the aggregate record.
Defaults to `"_time"`.
_**Data type:** String_
### createEmpty
For windows without data, this will create an empty window and fill
it with a `null` aggregate value.
Defaults to `true`.
@ -74,6 +84,7 @@ _**Data type:** Boolean_
## Examples
###### Using an aggregate function with default parameters
```js
from(bucket: "example-bucket")
|> range(start: 1h)
@ -104,6 +115,7 @@ from(bucket: "example-bucket")
```
## Function definition
```js
aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time", tables=<-) =>
tables
@ -116,5 +128,6 @@ aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time",
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[InfluxQL aggregate functions](https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations)
[GROUP BY time()](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause)

View File

@ -11,7 +11,7 @@ weight: 501
---
The `difference()` function computes the difference between subsequent records.
The user-specified column of numeric type is subtracted while others are kept intact.
The user-specified columns of numeric type are subtracted while others are kept intact.
_**Function type:** Aggregate_
_**Output data type:** Float_
@ -19,7 +19,7 @@ _**Output data type:** Float_
```js
difference(
nonNegative: false,
column: "_value",
columns: ["_value"],
keepFirst: false
)
```
@ -32,11 +32,11 @@ When set to `true`, if a value is less than the previous value, it is assumed th
_**Data type:** Boolean_
### column
The column to use to compute the difference.
Defaults to `"_value"`.
### columns
The columns to use to compute the difference.
Defaults to `["_value"]`.
_**Data type:** String_
_**Data type:** Array of Strings_
### keepFirst
Indicates the first row should be kept.

View File

@ -30,6 +30,10 @@ However, if two reduced tables write to the same destination group key, the func
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
Function to apply to each record with a reducer object ([`identity`](#identity)).

View File

@ -28,13 +28,19 @@ drop(fn: (column) => column =~ /usage*/)
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### columns
Columns to be removed from the table.
Cannot be used with `fn`.
_**Data type:** Array of strings_
### fn
A predicate function which takes a column name as a parameter (`column`) and returns
a boolean indicating whether or not the column should be removed from the table.
Cannot be used with `columns`.
@ -44,6 +50,7 @@ _**Data type:** Function_
## Examples
##### Drop a list of columns
```js
from(bucket: "example-bucket")
|> range(start: -5m)
@ -51,6 +58,7 @@ from(bucket: "example-bucket")
```
##### Drop columns matching a predicate
```js
from(bucket: "example-bucket")
|> range(start: -5m)
@ -60,4 +68,5 @@ from(bucket: "example-bucket")
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[DROP MEASUREMENT](https://docs.influxdata.com/influxdb/latest/query_language/database_management/#delete-measurements-with-drop-measurement)

View File

@ -22,7 +22,12 @@ filter(fn: (r) => r._measurement == "cpu")
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
A single argument predicate function that evaluates true or false.
Records are passed to the function.
Those that evaluate to true are included in the output tables.
@ -35,6 +40,7 @@ Objects evaluated in `fn` functions are represented by `r`, short for "record" o
{{% /note %}}
## Examples
```js
from(bucket:"example-bucket")
|> range(start:-1h)
@ -48,4 +54,5 @@ from(bucket:"example-bucket")
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement)

View File

@ -27,13 +27,19 @@ keep(fn: (column) => column =~ /inodes*/)
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### columns
Columns that should be included in the resulting table.
Cannot be used with `fn`.
_**Data type:** Array of strings_
### fn
A predicate function which takes a column name as a parameter (`column`) and returns
a boolean indicating whether or not the column should be included in the resulting table.
Cannot be used with `columns`.
@ -43,6 +49,7 @@ _**Data type:** Function_
## Examples
##### Keep a list of columns
```js
from(bucket: "example-bucket")
|> range(start: -5m)
@ -50,6 +57,7 @@ from(bucket: "example-bucket")
```
##### Keep all columns matching a predicate
```js
from(bucket: "example-bucket")
|> range(start: -5m)

View File

@ -31,6 +31,7 @@ keyValues(fn: (schema) => schema.columns |> filter(fn: (r) => r.label =~ /usage
{{% /note %}}
### keyColumns
A list of columns from which values are extracted.
All columns indicated must be of the same type.
Each input table must have all of the columns listed by the `keyColumns` parameter.
@ -38,9 +39,14 @@ Each input table must have all of the columns listed by the `keyColumns` paramet
_**Data type:** Array of strings_
### fn
Function used to identify a set of columns.
All columns indicated must be of the same type.
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
_**Data type:** Function_
## Additional requirements
@ -52,6 +58,7 @@ _**Data type:** Function_
## Examples
##### Get key values from explicitly defined columns
```js
from(bucket: "example-bucket")
|> range(start: -30m)
@ -60,6 +67,7 @@ from(bucket: "example-bucket")
```
##### Get key values from columns matching a regular expression
```js
from(bucket: "example-bucket")
|> range(start: -30m)
@ -70,6 +78,7 @@ from(bucket: "example-bucket")
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SHOW MEASUREMENTS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements)
[SHOW FIELD KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys)
[SHOW TAG KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)

View File

@ -26,7 +26,12 @@ map(fn: (r) => ({ _value: r._value * r._value }))
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
A single argument function that to apply to each record.
The return value must be an object.
@ -39,6 +44,7 @@ Objects evaluated in `fn` functions are represented by `r`, short for "record" o
## Important notes
#### Preserve columns
By default, `map()` drops any columns that:
1. Are not part of the input table's group key.
@ -58,6 +64,7 @@ map(fn: (r) => ({ r with newColumn: r._value * 2 }))
## Examples
###### Square the value of each record
```js
from(bucket:"example-bucket")
|> filter(fn: (r) =>
@ -70,6 +77,7 @@ from(bucket:"example-bucket")
```
###### Create a new table with new format
```js
from(bucket:"example-bucket")
|> filter(fn: (r) =>

View File

@ -30,13 +30,19 @@ rename(fn: (column) => "{column}_new")
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### columns
A map of columns to rename and their corresponding new names.
Cannot be used with `fn`.
_**Data type:** Object_
### fn
A function mapping between old and new column names.
Cannot be used with `columns`.
@ -45,6 +51,7 @@ _**Data type:** Function_
## Examples
##### Rename a single column
```js
from(bucket: "example-bucket")
|> range(start: -5m)
@ -52,6 +59,7 @@ from(bucket: "example-bucket")
```
##### Rename all columns using a function
```js
from(bucket: "example-bucket")
|> range(start: -5m)

View File

@ -28,7 +28,12 @@ and does not affect the state count._
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
A single argument function that evaluates true or false to identify the state of the record.
Records are passed to the function.
Those that evaluate to `true` increment the state count.
@ -37,11 +42,13 @@ Those that evaluate to `false` reset the state count.
_**Data type:** Function_
### column
The name of the column added to each record that contains the incremented state count.
_**Data type:** String_
## Examples
```js
from("monitor/autogen")
|> range(start: -1h)

View File

@ -34,7 +34,12 @@ and does not affect the state duration._
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
A single argument function that evaluates true or false to identify the state of the record.
Records are passed to the function.
Those that evaluate to `true` increment the state duration.
@ -43,17 +48,20 @@ Those that evaluate to `false` reset the state duration.
_**Data type:** Function_
### column
The name of the column added to each record that contains the state duration.
_**Data type:** String_
### unit
The unit of time in which the state duration is incremented.
For example: `1s`, `1m`, `1h`, etc.
_**Data type:** Duration_
## Examples
```js
from("monitor/autogen")
|> range(start: -1h)

View File

@ -21,7 +21,12 @@ tableFind(column: "_value")
## Parameters
{{% note %}}
Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
{{% /note %}}
### fn
A predicate function for matching keys in a table's group key.
`tableFind` returns the first table that resolves as `true`.
It expects a `key` argument which represents a group key in the input stream.
@ -29,11 +34,13 @@ It expects a `key` argument which represents a group key in the input stream.
_**Data type:** Function_
##### Example fn function
```js
(key) => key._field == "fieldName"
```
## Example
```js
t = from(bucket:"example-bucket")
|> range(start: -5m)

View File

@ -18,9 +18,11 @@ Flux employs a basic data model built from basic data types.
The data model consists of tables, records, columns and streams.
## Record
A **record** is a tuple of named values and is represented using an object type.
## Column
A **column** has a label and a data type.
The available data types for a column are:
@ -36,6 +38,7 @@ The available data types for a column are:
| duration | A nanosecond precision duration of time. |
## Table
A **table** is set of records with a common set of columns and a group key.
The group key is a list of columns.
@ -50,6 +53,7 @@ A tables schema consists of its group key and its columns' labels and types.
{{% /note %}}
## Stream of tables
A **stream** represents a potentially unbounded set of tables.
A stream is grouped into individual tables using their respective group keys.
Tables within a stream each have a unique group key value.
@ -60,6 +64,7 @@ types that make up stream and table types
{{% /note %}}
## Missing values (null)
`null` is a predeclared identifier representing a missing or unknown value.
`null` is the only value comprising the _null type_.
Any non-boolean operator that operates on basic types returns _null_ when at least one of its operands is _null_.
@ -101,6 +106,7 @@ In order to perform such a check, Flux provides a built-in `exists` operator:
{{% /note %}}
## Transformations
Transformations define a change to a stream.
Transformations may consume an input stream and always produce a new output stream.
The output stream group keys have a stable output order based on the input stream.
@ -111,3 +117,25 @@ Transformations that modify group keys or values regroup the tables in the outpu
A transformation produces side effects when constructed from a function that produces side effects.
Transformations are represented using function types.
### Match parameter names
Some transformations (for example, `map` and `filter`) are represented using higher-order functions (functions that accept other functions).
Each argument passed into a function must match the parameter name defined for the function.
For example, `filter` accepts `fn`, which takes one argument named `r`:
```js
from(bucket: "db")
|> filter(fn: (r) => ...)
```
If a parameter is renamed from `r` to `v`, the script fails:
```js
from(bucket: "db")
|> filter(fn: (v) => ...)
// FAILS!: 'v' != 'r'.
```
Because Flux does not support positional arguments, parameter names matter. The transformation (in this case, `filter`) must know `r` is the parameter name to successfully invoke the function.

View File

@ -22,6 +22,7 @@ PrimaryExpression = identifier | Literal | "(" Expression ")" .
```
## Literals
Literals construct a value.
```js
@ -37,6 +38,7 @@ Literal = int_lit
```
### Object literals
Object literals construct a value with the object type.
```js
@ -121,6 +123,23 @@ f(a:1, b:9.6)
float(v:1)
```
Use short notation in a call expression when the name of every argument matches the name of every parameter.
##### Examples of short notation in call expressions
```js
add(a: a, b: b) //long notation
add(a, b) // short notation equivalent
add = (a,b) => a + b
a = 1
b = 2
// Don't mix short and long notation.
add(a: a, b)
add(a, b: b)
```
## Pipe expressions
A _pipe expression_ is a call expression with an implicit piped argument.

View File

@ -10,6 +10,18 @@ aliases:
- /cloud/about/release-notes
---
## 2019-07-23 _General Availability_
### Features
- **InfluxDB 2.0 alpha-15**
_See the [alpha-9 release notes](/v2.0/reference/release-notes/influxdb/#v2-0-0-alpha-15-2019-07-11) for details._
- Pay As You Go Pricing Plan.
- Adjusted Free Plan rate limits.
- Timezone selection in the user interface.
---
## 2019-05-06 _Public Beta_
### Features

View File

@ -59,8 +59,9 @@ This variable is typically used to define the `every` or `period` parameters of
[`window()` function](/v2.0/reference/flux/functions/built-in/transformations/window)
in data aggregation operations.
The value of this variable is calculated by dividing the total time within the displayed
time range by the dashboard refresh interval (defined by the **Refresh** dropdown).
The value of this variable is calculated by analyzing the duration of the Flux
query it is used within. Queries that fetch data from a longer time range will
have a larger `v.windowPeriod` duration.
## Custom dashboard variables
Create, manage, and use custom dashboard variables in the InfluxDB user interface (UI).

View File

@ -416,7 +416,7 @@ input:
- name: Filecount
id: filecount
description: |
The Filecount input plugin counts files in directories that match certain criteria.
The Filecount input plugin reports the number and total size of files in directories that match certain criteria.
link: https://github.com/influxdata/telegraf/blob/release-1.11/plugins/inputs/filecount/README.md
introduced: 1.8.0
tags: [linux, macos, windows, systems]