From 5cc36be1e40c7fa080ab5aa5133be47d11bccffe Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 21 Jul 2021 13:53:25 -0600 Subject: [PATCH] Flux v0.123 (#2880) * Flux 0.123.0 updates (#2878) * add note about flux sleep function being removed * update description of createEmpty param on aggregateWindow * more updates to aggregateWindow * removed aggregateWindow function definition * Flux 0.123.0 release notes (#2877) * Flux sample package (#2876) * added flux influxdb sample data package * WIP update sample data doc * WIP sample data updates * updated sample package and sample data instructions, closes #2845 * Apply suggestions from code review Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * updates to address PR feedback Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> --- assets/styles/layouts/article/_buttons.scss | 7 + assets/styles/layouts/article/_captions.scss | 16 ++ .../flux/stdlib/built-in/misc/sleep.md | 48 +--- .../aggregates/aggregatewindow.md | 135 +---------- .../flux/stdlib/influxdb-sample/_index.md | 16 ++ .../flux/stdlib/influxdb-sample/data.md | 15 ++ .../flux/stdlib/influxdb-sample/list.md | 15 ++ .../flux/stdlib/influxdb-schema/_index.md | 2 +- .../flux/stdlib/influxdb-schema/fieldkeys.md | 2 +- .../stdlib/influxdb-schema/fieldsascols.md | 2 +- .../influxdb-schema/measurementfieldkeys.md | 2 +- .../stdlib/influxdb-schema/measurements.md | 2 +- .../influxdb-schema/measurementtagkeys.md | 2 +- .../influxdb-schema/measurementtagvalues.md | 2 +- .../flux/stdlib/influxdb-schema/tagkeys.md | 2 +- .../flux/stdlib/influxdb-schema/tagvalues.md | 2 +- .../flux/stdlib/influxdb-tasks/_index.md | 12 +- .../flux/stdlib/influxdb-tasks/lastsuccess.md | 2 +- .../reference/flux/stdlib/monitor/_index.md | 6 +- .../reference/flux/stdlib/monitor/check.md | 2 +- .../reference/flux/stdlib/monitor/deadman.md | 2 +- .../reference/flux/stdlib/monitor/from.md | 2 +- .../reference/flux/stdlib/monitor/logs.md | 2 +- .../reference/flux/stdlib/monitor/notify.md | 2 +- .../flux/stdlib/monitor/statechanges.md | 2 +- .../flux/stdlib/monitor/statechangesonly.md | 2 +- .../reference/flux/stdlib/secrets/_index.md | 2 +- .../reference/flux/stdlib/secrets/get.md | 2 +- .../influxdb/cloud/reference/sample-data.md | 218 ++++++++++-------- content/influxdb/cloud/write-data/_index.md | 2 +- .../v2.0/query-data/common-queries/_index.md | 3 +- .../v2.0/query-data/flux/geo/_index.md | 37 +-- content/influxdb/v2.0/query-data/flux/sql.md | 70 +++--- .../flux/stdlib/built-in/misc/sleep.md | 9 +- .../aggregates/aggregatewindow.md | 26 +-- .../flux/stdlib/influxdb-sample/_index.md | 24 ++ .../flux/stdlib/influxdb-sample/data.md | 102 ++++++++ .../flux/stdlib/influxdb-sample/list.md | 21 ++ .../flux/stdlib/influxdb-schema/_index.md | 2 +- .../flux/stdlib/influxdb-schema/fieldkeys.md | 2 +- .../stdlib/influxdb-schema/fieldsascols.md | 2 +- .../influxdb-schema/measurementfieldkeys.md | 2 +- .../stdlib/influxdb-schema/measurements.md | 2 +- .../influxdb-schema/measurementtagkeys.md | 2 +- .../influxdb-schema/measurementtagvalues.md | 2 +- .../flux/stdlib/influxdb-schema/tagkeys.md | 2 +- .../flux/stdlib/influxdb-schema/tagvalues.md | 2 +- .../flux/stdlib/influxdb-tasks/_index.md | 12 +- .../flux/stdlib/influxdb-tasks/lastsuccess.md | 2 +- .../reference/flux/stdlib/monitor/_index.md | 8 +- .../reference/flux/stdlib/monitor/check.md | 2 +- .../reference/flux/stdlib/monitor/deadman.md | 2 +- .../reference/flux/stdlib/monitor/from.md | 2 +- .../reference/flux/stdlib/monitor/logs.md | 2 +- .../reference/flux/stdlib/monitor/notify.md | 2 +- .../flux/stdlib/monitor/statechanges.md | 2 +- .../flux/stdlib/monitor/statechangesonly.md | 2 +- .../reference/flux/stdlib/secrets/_index.md | 10 +- .../v2.0/reference/flux/stdlib/secrets/get.md | 2 +- .../v2.0/reference/release-notes/flux.md | 12 + .../influxdb/v2.0/reference/sample-data.md | 155 ++++++++++--- shared/text/flux/noaa-ndbc-sample-task.md | 14 ++ 62 files changed, 597 insertions(+), 470 deletions(-) create mode 100644 content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/list.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/_index.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/list.md create mode 100644 shared/text/flux/noaa-ndbc-sample-task.md diff --git a/assets/styles/layouts/article/_buttons.scss b/assets/styles/layouts/article/_buttons.scss index f9a3917ad..39bdedfce 100644 --- a/assets/styles/layouts/article/_buttons.scss +++ b/assets/styles/layouts/article/_buttons.scss @@ -40,4 +40,11 @@ a.btn { margin-right: .5rem; font-size: 1.1rem; } + + &.github:before { + content: "\eab0"; + font-family: "icomoon"; + margin-right: .5rem; + font-size: 1.1rem; + } } diff --git a/assets/styles/layouts/article/_captions.scss b/assets/styles/layouts/article/_captions.scss index 3324d640a..8a8a14c9f 100644 --- a/assets/styles/layouts/article/_captions.scss +++ b/assets/styles/layouts/article/_captions.scss @@ -12,4 +12,20 @@ & + .caption { margin-top: -2.75rem; } +} + +p { + & + .caption { + padding: 0; + margin: -.75rem 0 0; + opacity: 1; + } +} + +h2,h3,h4,h5,h6 { + & + .caption { + padding: 0; + margin: 0; + opacity: 1; + } } \ No newline at end of file diff --git a/content/influxdb/cloud/reference/flux/stdlib/built-in/misc/sleep.md b/content/influxdb/cloud/reference/flux/stdlib/built-in/misc/sleep.md index 173ba5bc9..0f85617bc 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/built-in/misc/sleep.md +++ b/content/influxdb/cloud/reference/flux/stdlib/built-in/misc/sleep.md @@ -3,53 +3,7 @@ title: sleep() function description: The `sleep()` function delays execution by a specified duration. aliases: - /influxdb/cloud/reference/flux/functions/built-in/misc/sleep/ -menu: - influxdb_cloud_ref: - name: sleep - parent: built-in-misc weight: 401 --- -The `sleep()` function delays execution by a specified duration. - -_**Function type:** Miscellaneous_ - -```js -sleep( - v: x, - duration: 10s -) -``` - -## Parameters - -### v -Defines input tables. -`sleep()` accepts piped-forward data and passes it on unmodified after the -specified [duration](#duration). -If data is not piped-forward into `sleep()`, set `v` to specify a stream of tables. -The examples [below](#examples) illustrate how. - -_**Data type:** Record_ - -### duration -The length of time to delay execution. - -_**Data type:** Duration_ - -## Examples - -### Delay execution in a chained query -```js -from(bucket: "example-bucket") - |> range(start: -1h) - |> sleep(duration: 10s) -``` - -### Delay execution using a stream variable -```js -x = from(bucket: "example-bucket") - |> range(start: -1h) - -sleep(v: x, duration: 10s) -``` +{{< duplicate-oss >}} \ No newline at end of file diff --git a/content/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md b/content/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md index 9659192ef..5c2ce62a3 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md +++ b/content/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md @@ -15,137 +15,4 @@ related: - /{{< latest "influxdb" "v1" >}}/query_language/explore-data/#the-group-by-clause, InfluxQL – GROUP BY time() --- -The `aggregateWindow()` function applies an aggregate or selector function -(any function with a `column` parameter) to fixed windows of time. - -_**Function type:** Aggregate_ - -```js -aggregateWindow( - every: 1m, - fn: mean, - column: "_value", - timeSrc: "_stop", - timeDst: "_time", - createEmpty: true -) -``` - -As data is windowed into separate tables and processed, the `_time` column is dropped from each group key. -This function copies the timestamp from a remaining column into the `_time` column. -View the [function definition](#function-definition). - -`aggregateWindow()` restores the original `_start` and `_stop` values of input data -and, by default, uses `_stop` to set the `_time` value for each aggregated window. -Each row in the output of `aggregateWindow` represents an aggregated window ending at `_time`. - -## Parameters - -{{% note %}} -Make sure `fn` parameter names match each specified parameter. To learn why, see [Match parameter names](/influxdb/cloud/reference/flux/language/data-model/#match-parameter-names). -{{% /note %}} - -### every - -The duration of windows. - -{{% note %}} -#### Calendar months and years -`every` supports all [valid duration units](/influxdb/cloud/reference/flux/language/types/#duration-types), -including **calendar months (`1mo`)** and **years (`1y`)**. -{{% /note %}} - -_**Data type:** Duration_ - -### fn - -The [aggregate function](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates) used in the operation. - -_**Data type:** Function_ - -{{% note %}} -Only aggregate and selector functions with a `column` parameter (singular) work with `aggregateWindow()`. -{{% /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`. - -_**Data type:** Boolean_ - -## Examples -The examples below use a `data` variable to represent a filtered data set. - -```js -data = from(bucket: "example-bucket") - |> range(start: -1h) - |> filter(fn: (r) => - r._measurement == "mem" and - r._field == "used_percent") -``` - -##### Use an aggregate function with default parameters -The following example uses the default parameters of the -[`mean()` function](/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/mean/) -to aggregate time-based windows: - -```js -data - |> aggregateWindow( - every: 5m, - fn: mean - ) -``` -##### Specify parameters of the aggregate function -To use functions that don't provide defaults for required parameters with `aggregateWindow()`, -define an anonymous function with `column` and `tables` parameters that pipes-forward -tables into the aggregate or selector function with all required parameters defined: - -```js -data - |> aggregateWindow( - column: "_value", - every: 5m, - fn: (column, tables=<-) => tables |> quantile(q: 0.99, column:column) - ) -``` - -##### Window and aggregate by calendar month -```js -data - |> aggregateWindow(every: 1mo, fn: mean) -``` - -## Function definition - -```js -aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time", tables=<-) => - tables - |> window(every:every) - |> fn(column:column) - |> duplicate(column:timeSrc, as:timeDst) - |> window(every:inf, timeColumn:timeDst) -``` +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/_index.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/_index.md new file mode 100644 index 000000000..f551cffcc --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/_index.md @@ -0,0 +1,16 @@ +--- +title: Flux InfluxDB sample package +list_title: InfluxDB sample package +description: > + The Flux InfluxDB sample package provides functions for downloading and outputting InfluxDB sample data. + Import the `influxdata/influxdb/sample` package. +menu: + influxdb_cloud_ref: + name: InfluxDB Sample + parent: Flux standard library +weight: 202 +influxdb/v2.0/tags: [functions, sample, package] +introduced: 0.123.0 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data.md new file mode 100644 index 000000000..6eaf5ceb4 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data.md @@ -0,0 +1,15 @@ +--- +title: sample.data() function +description: > + The `sample.data()` function downloads and outputs an InfluxDB sample dataset. +menu: + influxdb_cloud_ref: + name: sample.data + parent: InfluxDB Sample +weight: 301 +related: + - /influxdb/cloud/reference/sample-data/ +introduced: 0.123.0 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/list.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/list.md new file mode 100644 index 000000000..41a1fed4b --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-sample/list.md @@ -0,0 +1,15 @@ +--- +title: sample.list() function +description: > + The `sample.list()` function outputs information about available InfluxDB sample datasets. +menu: + influxdb_cloud_ref: + name: sample.list + parent: InfluxDB Sample +weight: 301 +related: + - /influxdb/cloud/reference/sample-data/ +introduced: 0.123.0 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/_index.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/_index.md index dc6922aad..b00efcf21 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/_index.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/_index.md @@ -8,7 +8,7 @@ aliases: - /influxdb/cloud/reference/flux/functions/influxdb-v1/ menu: influxdb_cloud_ref: - name: InfluxDB Schema + name: InfluxDB schema parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, schema, package] diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldkeys.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldkeys.md index 81001b43e..11a41e17a 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldkeys.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldkeys.md @@ -4,7 +4,7 @@ description: The `schema.fieldKeys()` function returns field keys in a bucket. menu: influxdb_cloud_ref: name: schema.fieldKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [fields] aliases: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldsascols.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldsascols.md index d54defdbf..65d45f1fa 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldsascols.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/fieldsascols.md @@ -9,7 +9,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.fieldsAsCols - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 introduced: 0.88.0 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md index 497dff15c..f7a0027cf 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md @@ -4,7 +4,7 @@ description: The `schema.measurementFieldKeys()` function returns a list of fiel menu: influxdb_cloud_ref: name: schema.measurementFieldKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [fields] aliases: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurements.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurements.md index e5ba8d7cb..38fd9167d 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurements.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurements.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.measurements - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [measurements] related: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md index 789fb673f..60cf4c184 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.measurementTagKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md index 2a270ad22..961ba04e3 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.measurementTagValues - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagkeys.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagkeys.md index 2f9c32fc2..37e76a114 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagkeys.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagkeys.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.tagKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagvalues.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagvalues.md index 2a5ac2ff5..802c21b66 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagvalues.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-schema/tagvalues.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_cloud_ref: name: schema.tagValues - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/_index.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/_index.md index 5261b948f..ed2c86aaa 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/_index.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/_index.md @@ -1,15 +1,15 @@ --- -title: Flux InfluxDB Tasks package -list_title: InfluxDB Tasks package +title: Flux InfluxDB tasks package +list_title: InfluxDB tasks package description: > - The Flux InfluxDB Tasks package provides options and functions for working with + The Flux InfluxDB tasks package provides options and functions for working with [InfluxDB tasks](/influxdb/cloud/process-data/get-started/). Import the `influxdata/influxdb/tasks` package. aliases: - /influxdb/cloud/reference/flux/functions/influxdb-v1/ menu: influxdb_cloud_ref: - name: InfluxDB Tasks + name: InfluxDB tasks parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, tasks, package] @@ -17,7 +17,7 @@ related: - /influxdb/cloud/process-data/get-started/ --- -The Flux InfluxDB Tasks package provides options and functions for working with +The Flux InfluxDB tasks package provides options and functions for working with [InfluxDB tasks](/influxdb/cloud/process-data/get-started/). Import the `influxdata/influxdb/tasks` package: @@ -26,7 +26,7 @@ import "influxdata/influxdb/tasks" ``` ## Options -The InfluxDB Tasks package provides the following options: +The InfluxDB tasks package provides the following options: #### lastSuccessTime Define the time of the last successful task run. diff --git a/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/lastsuccess.md b/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/lastsuccess.md index de771383b..fda09b80d 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/lastsuccess.md +++ b/content/influxdb/cloud/reference/flux/stdlib/influxdb-tasks/lastsuccess.md @@ -4,7 +4,7 @@ description: The `tasks.lastSuccess()` function returns ... menu: influxdb_cloud_ref: name: tasks.lastSuccess - parent: InfluxDB Tasks + parent: InfluxDB tasks weight: 301 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/_index.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/_index.md index 6dbee264c..7d21a7bf9 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/_index.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/_index.md @@ -1,6 +1,6 @@ --- -title: Flux InfluxDB Monitor package -list_title: InfluxDB Monitor package +title: Flux InfluxDB monitor package +list_title: InfluxDB monitor package description: > The Flux Monitor package provides tools for monitoring and alerting with InfluxDB. Import the `influxdata/influxdb/monitor` package. @@ -8,7 +8,7 @@ aliases: - /influxdb/cloud/reference/flux/functions/monitor/ menu: influxdb_cloud_ref: - name: InfluxDB Monitor + name: InfluxDB monitor parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, monitor, alerts, package] diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/check.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/check.md index c8874bc8e..06413ea59 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/check.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/check.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.check - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/deadman.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/deadman.md index f62329958..2eaaf55e7 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/deadman.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/deadman.md @@ -7,7 +7,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.deadman - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 cloud_all: true --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/from.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/from.md index 9ead72910..4b6df73c9 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/from.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/from.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.from - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/logs.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/logs.md index 1f26266ca..85dbb1d35 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/logs.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/logs.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.logs - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/notify.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/notify.md index 011f20038..c7a95572d 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/notify.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/notify.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.notify - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/statechanges.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/statechanges.md index 458eac0a0..bd1616dd6 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/statechanges.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/statechanges.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_cloud_ref: name: monitor.stateChanges - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/monitor/statechangesonly.md b/content/influxdb/cloud/reference/flux/stdlib/monitor/statechangesonly.md index 63cc3b592..7c68e75cd 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/monitor/statechangesonly.md +++ b/content/influxdb/cloud/reference/flux/stdlib/monitor/statechangesonly.md @@ -6,7 +6,7 @@ description: > menu: influxdb_cloud_ref: name: monitor.stateChangesOnly - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/cloud/reference/flux/stdlib/secrets/_index.md b/content/influxdb/cloud/reference/flux/stdlib/secrets/_index.md index 9690a0ee3..6b292ab00 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/secrets/_index.md +++ b/content/influxdb/cloud/reference/flux/stdlib/secrets/_index.md @@ -8,7 +8,7 @@ aliases: - /influxdb/cloud/reference/flux/functions/secrets/ menu: influxdb_cloud_ref: - name: InfluxDB Secrets + name: InfluxDB secrets parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, secrets, package] diff --git a/content/influxdb/cloud/reference/flux/stdlib/secrets/get.md b/content/influxdb/cloud/reference/flux/stdlib/secrets/get.md index 31b9034bc..e02416613 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/secrets/get.md +++ b/content/influxdb/cloud/reference/flux/stdlib/secrets/get.md @@ -7,7 +7,7 @@ aliases: menu: influxdb_cloud_ref: name: secrets.get - parent: InfluxDB Secrets + parent: InfluxDB secrets weight: 202 --- diff --git a/content/influxdb/cloud/reference/sample-data.md b/content/influxdb/cloud/reference/sample-data.md index 2e9ac0095..52343b7b6 100644 --- a/content/influxdb/cloud/reference/sample-data.md +++ b/content/influxdb/cloud/reference/sample-data.md @@ -10,12 +10,18 @@ menu: influxdb_cloud_ref weight: 7 --- -Use sample data to familiarize yourself with time series data and InfluxDB. -InfluxData provides many sample time series datasets to use with **InfluxDB Cloud**. +Use **demo data** and **sample data** to familiarize yourself with time series data and InfluxDB Cloud. +InfluxDB Cloud lets you access **Demo data buckets** that contain real-time time +series data without having to write data to InfluxDB. +Sample datasets are also available for download and can be written to InfluxDB +or loaded at query time. + +- [InfluxDB Cloud demo data](#influxdb-cloud-demo-data) +- [Sample datasets](#sample-datasets) ## InfluxDB Cloud demo data Use [InfluxDB Cloud demo data buckets](/influxdb/cloud/reference/sample-data/#influxdb-cloud-demo-data) for quick, -free access to different types of sample data. +free access to different time series datasets. {{< youtube GSaByPC1Bdc >}} @@ -23,47 +29,116 @@ free access to different types of sample data. Demo data is not available for use with third-party integrations such as Grafana. {{% /note %}} -## Sample data sets -The following sample data sets are used as examples in [InfluxDB query guides](/influxdb/cloud/query-data/flux). +## Sample datasets - [Air sensor sample data](#air-sensor-sample-data) - [Bird migration sample data](#bird-migration-sample-data) -- [NOAA water sample data](#noaa-water-sample-data) -- [USGS earthquake data](#usgs-earthquake-data) +- [NOAA sample data](#noaa-sample-data) + - [NOAA NDBC data](#noaa-ndbc-data) + - [NOAA water sample data](#noaa-water-sample-data) +- [USGS Earthquake data](#usgs-earthquake-data) ### Air sensor sample data + +{{% caption %}} +**Size**: ~600 KB • **Updated**: every 15m +{{% /caption %}} + Air sensor sample data represents an "Internet of Things" (IoT) use case by simulating temperature, humidity, and carbon monoxide levels for multiple rooms in a building. -The dataset also includes a relational SQL dataset with meta information about sensors in each room. - - View air sensor sample data - +To download and output the air sensor sample dataset, use the +[`sample.data()` function](/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data/). -_Used in [Query SQL data sources](/influxdb/cloud/query-data/flux/sql/)._ +```js +import "influxdata/influxdb/sample" + +sample.data(set: "airSensor") +``` + +#### Companion SQL sensor data +The air sensor sample dataset is paired with a relational SQL dataset with meta +information about sensors in each room. +These two sample datasets are used to demonstrate +[how to join time series data and relational data with Flux](/influxdb/cloud/query-data/flux/sql/#join-sql-data-with-data-in-influxdb) +in the [Query SQL data sources](/influxdb/cloud/query-data/flux/sql/) guide. + +Download SQL air sensor data ### Bird migration sample data -Bird migration data is adapted from the -[Movebank: Animal Tracking data set on Kaggle](https://www.kaggle.com/pulkit8595/movebank-animal-tracking) + +{{% caption %}} +**Size**: ~1.2 MB • **Updated**: N/A +{{% /caption %}} + +Bird migration sample data is adapted from the +[Movebank: Animal Tracking data set](https://www.kaggle.com/pulkit8595/movebank-animal-tracking) and represents animal migratory movements throughout 2019. -Use the [Flux Geo package](/influxdb/cloud/reference/flux/stdlib/experimental/geo/#geo-schema-requirements) -to query and analyze the geo-temporal data in this sample data set. - - View bird migration sample data - +To download and output the bird migration sample dataset, use the +[`sample.data()` function](/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data/). -_Used in [Work with geo-temporal data](/influxdb/cloud/query-data/flux/geo/)._ +```js +import "influxdata/influxdb/sample" -### NOAA water sample data +sample.data(set: "birdMigration") +``` -This data set is publicly available data from the [National Oceanic and Atmospheric Administration’s (NOAA) Center for Operational Oceanographic Products and Services](http://tidesandcurrents.noaa.gov/stations.html). +The bird migration sample dataset is used in the [Work with geo-temporal data](/influxdb/cloud/query-data/flux/geo/) +guide to demonstrate how to query and analyze geo-temporal data. -[The CSV data](https://influx-testdata.s3.amazonaws.com/noaa.csv) includes 15,258 -observations of water levels (ft) collected every six minutes at two stations +### NOAA sample data + +The following two National Oceanic and Atmospheric Administration (NOAA) datasets are +available to use with InfluxDB. + +- [NOAA NDBC data](#noaa-ndbc-data) +- [NOAA water sample data](#noaa-water-sample-data) + +#### NOAA NDBC data + +{{% caption %}} +**Size**: ~1.3 MB • **Updated**: every 15m +{{% /caption %}} + +The **NOAA National Data Buoy Center (NDBC)** dataset provides observations (updated every 15 minutes) from the NOAA NDBC network of buoys throughout the world. + +To download and output the most recent NOAA NDBC observations, use the +[`sample.data()` function](/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data/). + +```js +import "influxdata/influxdb/sample" + +sample.data(set: "noaa") +``` + +{{% note %}} +##### Store historical NOAA NDBC data + +The **NOAA NDBC sample dataset** only returns the most recent observations; +not historical observations. +To regularly query and store NOAA NDBC observations, add the following as an +[InfluxDB task](/inflxudb/v2.0/process-data/manage-tasks/). +Replace `example-org` and `example-bucket` with your organization name and the +name of the bucket to store data in. + +{{% get-shared-text "flux/noaa-ndbc-sample-task.md" %}} +{{% /note %}} + +#### NOAA water sample data + +{{% caption %}} +**Size**: ~10 MB • **Updated**: N/A +{{% /caption %}} + +The **NOAA water sample dataset** is static dataset extracted from +[NOAA Center for Operational Oceanographic Products and Services](http://tidesandcurrents.noaa.gov/stations.html) data. +The sample dataset includes 15,258 observations of water levels (ft) collected every six minutes at two stations (Santa Monica, CA (ID 9410840) and Coyote Creek, CA (ID 9414575)) over the period -from August 18, 2015 through September 18, 2015. +from **August 18, 2015** through **September 18, 2015**. +{{% note %}} +##### Store NOAA water sample data to avoid bandwidth usage To avoid having to re-download this 10MB dataset every time you run a query, we recommend that you [create a new bucket](/influxdb/cloud/organizations/buckets/create-bucket/) (`noaa`) and write the NOAA data to it. @@ -84,88 +159,27 @@ csv.from(url: "https://influx-testdata.s3.amazonaws.com/noaa.csv") |> relativeToNow() |> to(bucket: "noaa", org: "example-org") ``` +{{% /note %}} -_Used in [Common queries](/influxdb/cloud/query-data/common-queries/) and [Common tasks](/influxdb/cloud/process-data/common-tasks/)._ +The NOAA water sample dataset is used to demonstrate Flux queries in the +[Common queries](/influxdb/cloud/query-data/common-queries/) and +[Common tasks](/influxdb/cloud/process-data/common-tasks/) guides. -### USGS earthquake data -The United States Geological Survey (USGS) collects earthquake data and makes -this data publicly available. -Each earthquake event includes information such as latitude and longitude -coordinates, magnitude, depth, and [more](#collected-usgs-data). +### USGS Earthquake data -**To periodically retrieve and write USGS earthquake data to InfluxDB** +{{% caption %}} +**Size**: ~6 MB • **Updated**: every 15m +{{% /caption %}} -1. [Create a new bucket](/influxdb/cloud/organizations/buckets/create-bucket/) named `usgs`. -2. [Create a new task](/influxdb/cloud/process-data/manage-tasks/create-task/) - and include the following Flux script: +The United States Geological Survey (USGS) earthquake dataset contains observations +collected from USGS seismic sensors around the world over the last week. +Data is updated approximately every 15m. + +To download and output the last week of USGS seismic data, use the +[`sample.data()` function](/influxdb/cloud/reference/flux/stdlib/influxdb-sample/data/). - {{% truncate %}} ```js -import "csv" -import "experimental" -import "experimental/http" +import "influxdata/influxdb/sample" -usgsCSV = string(v: (http.get(url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv")).body) - -csv.from(csv: usgsCSV, mode: "raw") - |> map(fn: (r) => ({ - _measurement: "earthquakes", - _time: time(v: r.time), - lat: float(v: r.latitude), - lon: float(v: r.longitude), - depth: float(v: r.depth), - depthError: float(v: r.depthError), - mag: float(v: r.mag), - magType: string(v: r.magType), - nst: int(v: r.nst), - gap: float(v: r.gap), - dmin: float(v: r.dmin), - rms: float(v: r.rms), - net: string(v: r.net), - id: string(v: r.id), - updated: int(v: time(v: r.updated)) / 1000000, - place: string(v: r.place), - type: string(v: r.type), - locationSource: string(v: r.locationSource), - magSource: string(v: r.magSource), - horizontalError: float(v: r.horizontalError), - magError: float(v: r.magError), - magNst: int(v: r.magNst), - })) - |> group(columns: ["_measurement", "locationSource", "magSource", "type", "net", "magType"]) - |> experimental.to(bucket: "usgs") +sample.data(set: "usgs") ``` - {{% /truncate %}} - {{% note %}} -USGS updates earthquake data every minute. -This task retrieves earthquake data for the current day. -Set your task's `every` interval between `1m` and `24h`, depending on how often -you want to retrieve new data. - {{% /note %}} - -#### Collected USGS data -The task above writes the following to InfluxDB: - -**Fields:** -[lat](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#latitude), -[lon](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#longitude), -[depth](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#depth), -[depthError](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#depthError), -[mag](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#mag), -[nst](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#nst), -[gap](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#gap), -[dmin](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#dmin), -[rms](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#rms), -[id](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#id), -[updated](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#updated), -[place](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#place), -[horizontalError](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#horizontalError), -[magError](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#magError), -[magNst](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#magNst) - -**Tags:** -[magType](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#magType), -[net](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#net), -[type](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#type), -[locationSource](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#locationSource), -[magSource](https://earthquake.usgs.gov/data/comcat/data-eventterms.php#magSource) diff --git a/content/influxdb/cloud/write-data/_index.md b/content/influxdb/cloud/write-data/_index.md index d9cd7d382..448edb56d 100644 --- a/content/influxdb/cloud/write-data/_index.md +++ b/content/influxdb/cloud/write-data/_index.md @@ -138,7 +138,7 @@ See [Sample data](/influxdb/cloud/reference/sample-data) for more sample InfluxD {{% /note %}} ## Sample data -Use [sample data sets](/influxdb/cloud/reference/sample-data/#sample-data-sets) +Use [sample data sets](/influxdb/cloud/reference/sample-data/#sample-datasets) to quickly populate InfluxDB with sample time series data. --- diff --git a/content/influxdb/v2.0/query-data/common-queries/_index.md b/content/influxdb/v2.0/query-data/common-queries/_index.md index 74fee7d76..4c6967063 100644 --- a/content/influxdb/v2.0/query-data/common-queries/_index.md +++ b/content/influxdb/v2.0/query-data/common-queries/_index.md @@ -11,7 +11,8 @@ menu: weight: 104 --- -The following articles walk through common queries using the [NOAA water database data](https://influx-testdata.s3.amazonaws.com/noaa.csv). +The following articles walk through common queries using the +[NOAA water database data](/influxdb/v2.0/reference/sample-data/#noaa-water-sample-data). {{< children >}} diff --git a/content/influxdb/v2.0/query-data/flux/geo/_index.md b/content/influxdb/v2.0/query-data/flux/geo/_index.md index 808de218a..81df8d163 100644 --- a/content/influxdb/v2.0/query-data/flux/geo/_index.md +++ b/content/influxdb/v2.0/query-data/flux/geo/_index.md @@ -48,43 +48,22 @@ By using it, you agree to the [risks of experimental functions](/influxdb/v2.0/r ## Sample data Many of the examples in this section use a `sampleGeoData` variable that represents a sample set of geo-temporal data. -The [Bird Migration Sample Data](https://github.com/influxdata/influxdb2-sample-data/tree/master/bird-migration-data) -available on GitHub provides sample geo-temporal data that meets the +The [Bird Migration Sample Data](/influxdb/v2.0/reference/sample-data/#bird-migration-sample-data) +provides sample geo-temporal data that meets the [requirements of the Flux Geo package](/influxdb/v2.0/reference/flux/stdlib/experimental/geo/#geo-schema-requirements). -### Load annotated CSV sample data -Use the [experimental `csv.from()` function](/influxdb/v2.0/reference/flux/stdlib/experimental/csv/from/) -to load the sample bird migration annotated CSV data from GitHub: +### Load bird migration sample data +Use the [`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/) +to load the sample bird migration data: ```js -import `experimental/csv` +import "influxdata/influxdb/sample" -sampleGeoData = csv.from( - url: "https://github.com/influxdata/influxdb2-sample-data/blob/master/bird-migration-data/bird-migration.csv" -) +sampleGeoData = sample.data(set: "birdMigration") ``` {{% note %}} -`csv.from(url: ...)` downloads sample data each time you execute the query **(~1.3 MB)**. +`sample.data()` downloads sample data each time you execute the query **(~1.3 MB)**. If bandwidth is a concern, use the [`to()` function](/influxdb/v2.0/reference/flux/stdlib/built-in/outputs/to/) to write the data to a bucket, and then query the bucket with [`from()`](/influxdb/v2.0/reference/flux/stdlib/built-in/inputs/from/). {{% /note %}} - -### Write sample data to InfluxDB with line protocol -Use `curl` and the `influx write` command to write bird migration line protocol to InfluxDB. -Replace `example-bucket` with your destination bucket: - -```sh -curl https://raw.githubusercontent.com/influxdata/influxdb2-sample-data/master/bird-migration-data/bird-migration.line \ - --output ./tmp-data -influx write -b example-bucket @./tmp-data -rm -f ./tmp-data -``` - -Use Flux to query the bird migration data and assign it to the `sampleGeoData` variable: - -```js -sampleGeoData = from(bucket: "example-bucket") - |> range(start: 2019-01-01T00:00:00Z, stop: 2019-12-31T23:59:59Z) - |> filter(fn: (r) => r._measurement == "migration") -``` diff --git a/content/influxdb/v2.0/query-data/flux/sql.md b/content/influxdb/v2.0/query-data/flux/sql.md index 740a0ca77..cbda51b18 100644 --- a/content/influxdb/v2.0/query-data/flux/sql.md +++ b/content/influxdb/v2.0/query-data/flux/sql.md @@ -292,7 +292,7 @@ sql.from( --- ## Sample sensor data -The [sample data generator](#download-and-run-the-sample-data-generator) and +The [air sensor sample data](#download-sample-air-sensor-data) and [sample sensor information](#import-the-sample-sensor-information) simulate a group of sensors that measure temperature, humidity, and carbon monoxide in rooms throughout a building. @@ -303,53 +303,43 @@ Sample sensor information is stored in PostgreSQL. **Sample data includes:** - Simulated data collected from each sensor and stored in the `airSensors` measurement in **InfluxDB**: - - temperature - - humidity - - co + - temperature + - humidity + - co - Information about each sensor stored in the `sensors` table in **PostgreSQL**: - - sensor_id - - location - - model_number - - last_inspected + - sensor_id + - location + - model_number + - last_inspected -### Import and generate sample sensor data +#### Download sample air sensor data -#### Download and run the sample data generator -`air-sensor-data.rb` is a script that generates air sensor data and stores the data in InfluxDB. -To use `air-sensor-data.rb`: +1. [Create a bucket](/influxdb/v2.0/organizations/buckets/create-bucket/) to store the data. +2. [Create an InfluxDB task](/influxdb/v2.0/process-data/manage-tasks/create-task/) + and use the [`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/) + to download sample air sensor data every 15 minutes. + Write the downloaded sample data to your new bucket: -1. [Create a bucket](/influxdb/v2.0/organizations/buckets/create-bucket/) to store the data. -2. Download the sample data generator. _This tool requires [Ruby](https://www.ruby-lang.org/en/)._ + ```js + import "influxdata/influxdb/sample" - Download Air Sensor Generator + option task = { + name: "Collect sample air sensor data", + every: 15m + } -3. Give `air-sensor-data.rb` executable permissions: - - ``` - chmod +x air-sensor-data.rb + sample.data(set: "airSensor") + |> to( + org: "example-org", + bucket: "example-bucket" + ) ``` -4. Start the generator. Specify your organization, bucket, and authorization token. - _For information about retrieving your token, see [View tokens](/influxdb/v2.0/security/tokens/view-tokens/)._ +3. [Query your target bucket](/influxdb/v2.0/query-data/execute-queries/) after + the first task run to ensure the sample data is writing successfully. - ``` - ./air-sensor-data.rb -o your-org -b your-bucket -t YOURAUTHTOKEN - ``` - - The generator begins to write data to InfluxDB and will continue until stopped. - Use `ctrl-c` to stop the generator. - - {{% note %}} - Use the `--help` flag to view other configuration options. - {{% /note %}} - -5. [Query your target bucket](/influxdb/v2.0/query-data/execute-queries/) to ensure the - generated data is writing successfully. - The generator doesn't catch errors from write requests, so it will continue running - even if data is not writing to InfluxDB successfully. - - ``` + ```js from(bucket: "example-bucket") |> range(start: -1m) |> filter(fn: (r) => r._measurement == "airSensors") @@ -359,7 +349,7 @@ To use `air-sensor-data.rb`: 1. [Download and install PostgreSQL](https://www.postgresql.org/download/). 2. Download the sample sensor information CSV. - Download Sample Data + Download sample sensor information 3. Use a PostgreSQL client (`psql` or a GUI) to create the `sensors` table: @@ -389,6 +379,6 @@ To use `air-sensor-data.rb`: #### Import the sample data dashboard Download and import the Air Sensors dashboard to visualize the generated data: -Download Air Sensors dashboard +View Air Sensors dashboard JSON _For information about importing a dashboard, see [Create a dashboard](/influxdb/v2.0/visualize-data/dashboards/create-dashboard)._ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/built-in/misc/sleep.md b/content/influxdb/v2.0/reference/flux/stdlib/built-in/misc/sleep.md index fd041a172..e39dc67d4 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/built-in/misc/sleep.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/built-in/misc/sleep.md @@ -3,13 +3,14 @@ title: sleep() function description: The `sleep()` function delays execution by a specified duration. aliases: - /influxdb/v2.0/reference/flux/functions/built-in/misc/sleep/ -menu: - influxdb_2_0_ref: - name: sleep - parent: built-in-misc weight: 401 +removed: 0.123.0 --- +{{% warn %}} +The `sleep()` function was removed in **Flux 0.123.0**. +{{% /warn %}} + The `sleep()` function delays execution by a specified duration. _**Function type:** Miscellaneous_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md b/content/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md index 305979744..531f3ee0a 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow.md @@ -33,7 +33,6 @@ aggregateWindow( As data is windowed into separate tables and processed, the `_time` column is dropped from each group key. This function copies the timestamp from a remaining column into the `_time` column. -View the [function definition](#function-definition). `aggregateWindow()` restores the original `_start` and `_stop` values of input data and, by default, uses `_stop` to set the `_time` value for each aggregated window. @@ -59,7 +58,9 @@ _**Data type:** Duration_ ### fn -The [aggregate function](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates) used in the operation. +The [aggregate](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates) +or [selector function](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/selectors) +used in the operation. _**Data type:** Function_ @@ -90,12 +91,18 @@ _**Data type:** String_ ### createEmpty -For windows without data, this will create an empty window and fill -it with a `null` aggregate value. +For windows without data, create a single-row table for each empty window (using +[`table.fill()`](/influxdb/v2.0/reference/flux/stdlib/experimental/table/fill/)). Defaults to `true`. _**Data type:** Boolean_ +{{% note %}} +When using `createEmpty: true`, [aggregate functions](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates) +return empty tables, but [selector functions](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/selectors) do not. +By design, selectors drop empty tables. +{{% /note %}} + ## Examples The examples below use a `data` variable to represent a filtered data set. @@ -138,14 +145,3 @@ data data |> aggregateWindow(every: 1mo, fn: mean) ``` - -## Function definition - -```js -aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time", tables=<-) => - tables - |> window(every:every) - |> fn(column:column) - |> duplicate(column:timeSrc, as:timeDst) - |> window(every:inf, timeColumn:timeDst) -``` diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/_index.md new file mode 100644 index 000000000..bf76e587d --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/_index.md @@ -0,0 +1,24 @@ +--- +title: Flux InfluxDB sample package +list_title: InfluxDB sample package +description: > + The Flux InfluxDB sample package provides functions for downloading and outputting InfluxDB data sample. + Import the `influxdata/influxdb/sample` package. +menu: + influxdb_2_0_ref: + name: InfluxDB sample + parent: Flux standard library +weight: 202 +influxdb/v2.0/tags: [functions, sample, package] +introduced: 0.123.0 +--- + +The Flux InfluxDB sample package provides functions for downloading and outputting InfluxDB data sample. + +Import the `influxdata/influxdb/sample` package: + +```js +import "influxdata/influxdb/sample" +``` + +{{< children type="functions" show="pages" >}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data.md new file mode 100644 index 000000000..77397e1d0 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data.md @@ -0,0 +1,102 @@ +--- +title: sample.data() function +description: > + The `sample.data()` function downloads and outputs an InfluxDB sample dataset. +menu: + influxdb_2_0_ref: + name: sample.data + parent: InfluxDB sample +weight: 301 +related: + - /influxdb/v2.0/reference/sample-data/ +introduced: 0.123.0 +--- + +The `sample.data()` function downloads and outputs an InfluxDB sample dataset. + +```js +import "influxdata/influxdb/sample" + +sample.data( + set: "airSensor" +) +``` + +{{% note %}} +#### Network bandwidth +Each execution of `sample.data()` downloads the specified dataset from **Amazon S3**. +If using [InfluxDB Cloud](/influxdb/cloud/) or a hosted InfluxDB OSS instance, +you may see additional network bandwidth costs when using this function. +Approximate sample dataset sizes are listed [below](#available-influxdb-sample-datasets) +and in the output of [`sample.list()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/list/). +{{% /note %}} + +## Available InfluxDB sample datasets + +### airSensor + +Simulated office building air sensor data with temperature, +humidity, and carbon monoxide metrics. + +{{% caption %}} +**Size**: ~600 KB • **Updated**: every 15m +{{% /caption %}} + +### birdMigration + +2019 African bird migration data from the +[Movebank: Animal Tracking](https://www.kaggle.com/pulkit8595/movebank-animal-tracking) dataset. +Contains geotemporal data between 2019-01-01 and 2019-12-31. + +{{% caption %}} +**Size**: ~1.2 MB • **Updated**: N/A +{{% /caption %}} + +### noaa + +Latest observations from the [NOAA National Data Buoy Center (NDBC)](https://www.ndbc.noaa.gov/). +Contains only the most recent observations (no historical data). +Data is updated approximately every 15m. + +{{% caption %}} +**Size**: ~1.3 MB • **Updated**: every 15m +{{% /caption %}} + +### usgs + +USGS earthquake data from the last week. +Contains geotemporal data collected from USGS seismic sensors around the world. +Data is updated approximately every 15m. + +{{% caption %}} +**Size**: ~6 MB • **Updated**: every 15m +{{% /caption %}} + + +## Parameters + +### set +({{< req >}}) InfluxDB sample dataset to download and output. + +**Valid values**: + +- `airSensor` +- `birdMigration` +- `noaa` +- `usgs` + + +## Examples + +##### Return USGS earthquake data from the last week +```js +import "influxdata/influxdb/sample" + +sample.data(set: "usgs") +``` + +##### Download and write NOAA NDBC data to InfluxDB +Add the following as an [InfluxDB task](/influxdb/v2.0/process-data/) to regularly +collect the latest reported observations from the NOAA NDBC. + +{{% get-shared-text "flux/noaa-ndbc-sample-task.md" %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/list.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/list.md new file mode 100644 index 000000000..40cd2c1aa --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/list.md @@ -0,0 +1,21 @@ +--- +title: sample.list() function +description: > + The `sample.list()` function outputs information about available InfluxDB sample datasets. +menu: + influxdb_2_0_ref: + name: sample.list + parent: InfluxDB sample +weight: 301 +related: + - /influxdb/v2.0/reference/sample-data/ +introduced: 0.123.0 +--- + +The `sample.list()` function outputs information about available InfluxDB sample datasets. + +```js +import "influxdata/influxdb/sample" + +sample.list() +``` diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md index 7020d97a1..f34cdd170 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md @@ -8,7 +8,7 @@ aliases: - /influxdb/v2.0/reference/flux/functions/influxdb-v1/ menu: influxdb_2_0_ref: - name: InfluxDB Schema + name: InfluxDB schema parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, schema, package] diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md index 9722755b8..d4724e2c1 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md @@ -4,7 +4,7 @@ description: The `schema.fieldKeys()` function returns field keys in a bucket. menu: influxdb_2_0_ref: name: schema.fieldKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [fields] aliases: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md index 866807e3f..5e9787240 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md @@ -9,7 +9,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.fieldsAsCols - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 introduced: 0.88.0 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md index 17d6d8097..cac3849b4 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md @@ -4,7 +4,7 @@ description: The `schema.measurementFieldKeys()` function returns a list of fiel menu: influxdb_2_0_ref: name: schema.measurementFieldKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [fields] aliases: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md index ac758aa1f..7f9453db3 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.measurements - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [measurements] related: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md index 6e71c4bfa..0cb9c584d 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.measurementTagKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md index c65087847..99fac129e 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.measurementTagValues - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md index c5eba6f70..d0fae974a 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.tagKeys - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md index a50706be7..3527feb7d 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md @@ -6,7 +6,7 @@ aliases: menu: influxdb_2_0_ref: name: schema.tagValues - parent: InfluxDB Schema + parent: InfluxDB schema weight: 301 influxdb/v2.0/tags: [tags] related: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/_index.md index be8476054..c701f1ab2 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/_index.md @@ -1,15 +1,15 @@ --- -title: Flux InfluxDB Tasks package -list_title: InfluxDB Tasks package +title: Flux InfluxDB tasks package +list_title: InfluxDB tasks package description: > - The Flux InfluxDB Tasks package provides options and functions for working with + The Flux InfluxDB tasks package provides options and functions for working with [InfluxDB tasks](/influxdb/v2.0/process-data/get-started/). Import the `influxdata/influxdb/tasks` package. aliases: - /influxdb/v2.0/reference/flux/functions/influxdb-v1/ menu: influxdb_2_0_ref: - name: InfluxDB Tasks + name: InfluxDB tasks parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, tasks, package] @@ -17,7 +17,7 @@ related: - /influxdb/v2.0/process-data/get-started/ --- -The Flux InfluxDB Tasks package provides options and functions for working with +The Flux InfluxDB tasks package provides options and functions for working with [InfluxDB tasks](/influxdb/v2.0/process-data/get-started/). Import the `influxdata/influxdb/tasks` package: @@ -26,7 +26,7 @@ import "influxdata/influxdb/tasks" ``` ## Options -The InfluxDB Tasks package provides the following options: +The InfluxDB tasks package provides the following options: #### lastSuccessTime Define the time of the last successful task run. diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/lastsuccess.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/lastsuccess.md index 36376437e..304c69879 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/lastsuccess.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/lastsuccess.md @@ -4,7 +4,7 @@ description: The `tasks.lastSuccess()` function returns ... menu: influxdb_2_0_ref: name: tasks.lastSuccess - parent: InfluxDB Tasks + parent: InfluxDB tasks weight: 301 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/_index.md index 9381c0824..f83d31c7c 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/_index.md @@ -1,14 +1,14 @@ --- -title: Flux InfluxDB Monitor package -list_title: InfluxDB Monitor package +title: Flux InfluxDB monitor package +list_title: InfluxDB monitor package description: > - The Flux Monitor package provides tools for monitoring and alerting with InfluxDB. + The Flux monitor package provides tools for monitoring and alerting with InfluxDB. Import the `influxdata/influxdb/monitor` package. aliases: - /influxdb/v2.0/reference/flux/functions/monitor/ menu: influxdb_2_0_ref: - name: InfluxDB Monitor + name: InfluxDB monitor parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, monitor, alerts, package] diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/check.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/check.md index a1f41eeec..64ad7b59d 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/check.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/check.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.check - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/deadman.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/deadman.md index 420e9e0b1..dfc137282 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/deadman.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/deadman.md @@ -7,7 +7,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.deadman - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 cloud_all: true --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/from.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/from.md index 60e19fc88..7de2c338b 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/from.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/from.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.from - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/logs.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/logs.md index 7d1d5ac12..20e2010b8 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/logs.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/logs.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.logs - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/notify.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/notify.md index 6dac726ff..4cac0330c 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/notify.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/notify.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.notify - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechanges.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechanges.md index 9cdfda520..934f25100 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechanges.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechanges.md @@ -8,7 +8,7 @@ aliases: menu: influxdb_2_0_ref: name: monitor.stateChanges - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechangesonly.md b/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechangesonly.md index 3ede1f35c..f8769112c 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechangesonly.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/monitor/statechangesonly.md @@ -6,7 +6,7 @@ description: > menu: influxdb_2_0_ref: name: monitor.stateChangesOnly - parent: InfluxDB Monitor + parent: InfluxDB monitor weight: 202 --- diff --git a/content/influxdb/v2.0/reference/flux/stdlib/secrets/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/secrets/_index.md index 03fdac7b5..954760424 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/secrets/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/secrets/_index.md @@ -1,20 +1,20 @@ --- -title: Flux InfluxDB Secrets package -list_title: InfluxDB Secrets package +title: Flux InfluxDB secrets package +list_title: InfluxDB secrets package description: > - The Flux InfluxDB Secrets package provides functions for working with sensitive secrets managed by InfluxDB. + The Flux InfluxDB secrets package provides functions for working with sensitive secrets managed by InfluxDB. Import the `influxdata/influxdb/secrets` package. aliases: - /influxdb/v2.0/reference/flux/functions/secrets/ menu: influxdb_2_0_ref: - name: InfluxDB Secrets + name: InfluxDB secrets parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, secrets, package] --- -InfluxDB Secrets Flux functions provide tools for working with sensitive secrets managed by InfluxDB. +InfluxDB secrets Flux functions provide tools for working with sensitive secrets managed by InfluxDB. Import the `influxdata/influxdb/secrets` package: ```js diff --git a/content/influxdb/v2.0/reference/flux/stdlib/secrets/get.md b/content/influxdb/v2.0/reference/flux/stdlib/secrets/get.md index 7d22a93ba..15eb6a75f 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/secrets/get.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/secrets/get.md @@ -7,7 +7,7 @@ aliases: menu: influxdb_2_0_ref: name: secrets.get - parent: InfluxDB Secrets + parent: InfluxDB secrets weight: 202 --- diff --git a/content/influxdb/v2.0/reference/release-notes/flux.md b/content/influxdb/v2.0/reference/release-notes/flux.md index ede52cc7e..85848eee9 100644 --- a/content/influxdb/v2.0/reference/release-notes/flux.md +++ b/content/influxdb/v2.0/reference/release-notes/flux.md @@ -8,6 +8,18 @@ menu: name: Flux --- +## v0.123.0 [2021-07-19] + +### Breaking changes +- Remove the [`sleep()` function](/influxdb/v2.0/reference/flux/stdlib/built-in/misc/sleep/). + +### Features +- Optimize [`pivot()` transformation](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/pivot/). +- Add [InfluxDB sample data package](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/). +- Use `table.fill()` when `aggregateWindow(createEmpty: true)` is used. + +--- + ## v0.122.0 [2021-07-13] ### Features diff --git a/content/influxdb/v2.0/reference/sample-data.md b/content/influxdb/v2.0/reference/sample-data.md index d6f35dc4b..d020bd85e 100644 --- a/content/influxdb/v2.0/reference/sample-data.md +++ b/content/influxdb/v2.0/reference/sample-data.md @@ -12,67 +12,150 @@ weight: 7 Use sample data to familiarize yourself with time series data and InfluxDB. InfluxData provides many sample time series datasets to use with InfluxDB. - -## Sample data sets -The following sample data sets are used as examples in [InfluxDB query guides](/influxdb/v2.0/query-data/flux) -and can be used with **InfluxDB OSS** or **InfluxDB Cloud**. +You can also use the [Flux InfluxDB sample package](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/) +to view, download, and output sample datasets. - [Air sensor sample data](#air-sensor-sample-data) - [Bird migration sample data](#bird-migration-sample-data) -- [NOAA water sample data](#noaa-water-sample-data) +- [NOAA sample data](#noaa-sample-data) + - [NOAA NDBC data](#noaa-ndbc-data) + - [NOAA water sample data](#noaa-water-sample-data) +- [USGS Earthquake data](#usgs-earthquake-data) + +## Air sensor sample data + +{{% caption %}} +**Size**: ~600 KB • **Updated**: every 15m +{{% /caption %}} -### Air sensor sample data Air sensor sample data represents an "Internet of Things" (IoT) use case by simulating temperature, humidity, and carbon monoxide levels for multiple rooms in a building. -The dataset also includes a relational SQL dataset with meta information about sensors in each room. - - View air sensor sample data - +To download and output the air sensor sample dataset, use the +[`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/). -_Used in [Query SQL data sources](/influxdb/v2.0/query-data/flux/sql/)._ +```js +import "influxdata/influxdb/sample" -### Bird migration sample data -Bird migration data is adapted from the -[Movebank: Animal Tracking data set on Kaggle](https://www.kaggle.com/pulkit8595/movebank-animal-tracking) +sample.data(set: "airSensor") +``` + +#### Companion SQL sensor data +The air sensor sample dataset is paired with a relational SQL dataset with meta +information about sensors in each room. +These two sample datasets are used to demonstrate +[how to join time series data and relational data with Flux](/influxdb/v2.0/query-data/flux/sql/#join-sql-data-with-data-in-influxdb) +in the [Query SQL data sources](/influxdb/v2.0/query-data/flux/sql/) guide. + +Download SQL air sensor data + +## Bird migration sample data + +{{% caption %}} +**Size**: ~1.2 MB • **Updated**: N/A +{{% /caption %}} + +Bird migration sample data is adapted from the +[Movebank: Animal Tracking data set](https://www.kaggle.com/pulkit8595/movebank-animal-tracking) and represents animal migratory movements throughout 2019. -Use the [Flux Geo package](/influxdb/v2.0/reference/flux/stdlib/experimental/geo/#geo-schema-requirements) -to query and analyze the geo-temporal data in this sample data set. - - View bird migration sample data - +To download and output the bird migration sample dataset, use the +[`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/). -_Used in [Work with geo-temporal data](/influxdb/v2.0/query-data/flux/geo/)._ +```js +import "influxdata/influxdb/sample" + +sample.data(set: "birdMigration") +``` + +The bird migration sample dataset is used in the [Work with geo-temporal data](/influxdb/v2.0/query-data/flux/geo/) +guide to demonstrate how to query and analyze geo-temporal data. + +## NOAA sample data + +There are two National Oceanic and Atmospheric Administration (NOAA) datasets +available to use with InfluxDB. + +- [NOAA NDBC data](#noaa-ndbc-data) +- [NOAA water sample data](#noaa-water-sample-data) + +### NOAA NDBC data + +{{% caption %}} +**Size**: ~1.3 MB • **Updated**: every 15m +{{% /caption %}} + +The **NOAA National Data Buoy Center (NDBC)** dataset provides the latest +observations from the NOAA NDBC network of buoys throughout the world. +Observations are updated approximately every 15 minutes. + +To download and output the most recent NOAA NDBC observations, use the +[`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/). + +```js +import "influxdata/influxdb/sample" + +sample.data(set: "noaa") +``` + +{{% note %}} +#### Store historical NOAA NDBC data + +The **NOAA NDBC sample dataset** only returns the most recent observations; +not historical observations. +To regularly query and store NOAA NDBC observations, add the following as an +[InfluxDB task](/inflxudb/v2.0/process-data/manage-tasks/). +Replace `example-org` and `example-bucket` with your organization name and the +name of the bucket to store data in. + +{{% get-shared-text "flux/noaa-ndbc-sample-task.md" %}} +{{% /note %}} ### NOAA water sample data -This data set is publicly available data from the [National Oceanic and Atmospheric Administration’s (NOAA) Center for Operational Oceanographic Products and Services](http://tidesandcurrents.noaa.gov/stations.html). +{{% caption %}} +**Size**: ~10 MB • **Updated**: N/A +{{% /caption %}} -[The CSV data](https://influx-testdata.s3.amazonaws.com/noaa.csv) includes 15,258 -observations of water levels (ft) collected every six minutes at two stations +The **NOAA water sample dataset** is static dataset extracted from +[NOAA Center for Operational Oceanographic Products and Services](http://tidesandcurrents.noaa.gov/stations.html) data. +The sample dataset includes 15,258 observations of water levels (ft) collected every six minutes at two stations (Santa Monica, CA (ID 9410840) and Coyote Creek, CA (ID 9414575)) over the period -from August 18, 2015 through September 18, 2015. +from **August 18, 2015** through **September 18, 2015**. +{{% note %}} +#### Store NOAA water sample data to avoid bandwidth usage To avoid having to re-download this 10MB dataset every time you run a query, we recommend that you [create a new bucket](/influxdb/v2.0/organizations/buckets/create-bucket/) -(`noaa`) and write the NOAA data to it. -We also recommend updating the timestamps of the data to be relative to `now()`. -To do so, run the following: +(`noaa`) and write the NOAA sample water data to it. ```js import "experimental/csv" -relativeToNow = (tables=<-) => - tables - |> elapsed() - |> sort(columns: ["_time"], desc: true) - |> cumulativeSum(columns: ["elapsed"]) - |> map(fn: (r) => ({ r with _time: time(v: int(v: now()) - (r.elapsed * 1000000000))})) - csv.from(url: "https://influx-testdata.s3.amazonaws.com/noaa.csv") - |> relativeToNow() |> to(bucket: "noaa", org: "example-org") ``` +{{% /note %}} -_Used in [Common queries](/influxdb/v2.0/query-data/common-queries/) and [Common tasks](/influxdb/v2.0/process-data/common-tasks/)._ +The NOAA water sample dataset is used to demonstrate Flux queries in the +[Common queries](/influxdb/v2.0/query-data/common-queries/) and +[Common tasks](/influxdb/v2.0/process-data/common-tasks/) guides. + +## USGS Earthquake data + +{{% caption %}} +**Size**: ~6 MB • **Updated**: every 15m +{{% /caption %}} + +The United States Geological Survey (USGS) earthquake dataset contains observations +collected from USGS seismic sensors around the world over the last week. +Data is updated approximately every 15m. + +To download and output the last week of USGS seismic data, use the +[`sample.data()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-sample/data/). + +```js +import "influxdata/influxdb/sample" + +sample.data(set: "usgs") +``` diff --git a/shared/text/flux/noaa-ndbc-sample-task.md b/shared/text/flux/noaa-ndbc-sample-task.md new file mode 100644 index 000000000..1f60769e8 --- /dev/null +++ b/shared/text/flux/noaa-ndbc-sample-task.md @@ -0,0 +1,14 @@ +```js +import "influxdata/influxdb/sample" + +option task = { + name: "Collect NOAA NDBC data" + every: 15m, +} + +sample.data(set: "noaa") + |> to( + org: "example-org", + bucket: "example-bucket" + ) +``` \ No newline at end of file