From 1d9dbc8369e8df37decb6efb42941105d1793b82 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 18 May 2020 11:24:16 -0600 Subject: [PATCH 01/55] added sql server to sql docs, resolves #1047 --- content/v2.0/query-data/flux/sql.md | 17 ++++++++++++-- .../v2.0/reference/flux/stdlib/sql/_index.md | 4 ++-- .../v2.0/reference/flux/stdlib/sql/from.md | 22 +++++++++++++++++++ content/v2.0/reference/flux/stdlib/sql/to.md | 22 +++++++++++++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/content/v2.0/query-data/flux/sql.md b/content/v2.0/query-data/flux/sql.md index 6baee5ac5..8d0a4db3e 100644 --- a/content/v2.0/query-data/flux/sql.md +++ b/content/v2.0/query-data/flux/sql.md @@ -4,7 +4,8 @@ seotitle: Query SQL data sources with InfluxDB list_title: Query SQL data description: > The Flux `sql` package provides functions for working with SQL data sources. - Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, and SQLite. + Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, + SQLite, and MS SQL Server. v2.0/tags: [query, flux, sql] menu: v2_0: @@ -30,7 +31,8 @@ list_code_example: | The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources. [`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), -[Snowflake](https://www.snowflake.com/), and [SQLite](https://www.sqlite.org/index.html), +[Snowflake](https://www.snowflake.com/), [SQLite](https://www.sqlite.org/index.html), +and [MS SQL Server](https://www.microsoft.com/en-us/sql-server/default.aspx), and use the results with InfluxDB dashboards, tasks, and other operations. - [Query a SQL data source](#query-a-sql-data-source) @@ -57,6 +59,7 @@ To query a SQL data source: [MySQL](#) [Snowflake](#) [SQLite](#) +[SQL Server](#) {{% /code-tabs %}} {{% code-tab-content %}} @@ -110,6 +113,16 @@ sql.from( ) ``` {{% /code-tab-content %}} + +{{% code-tab-content %}} +```js +sql.from( + driverName: "sqlserver", + dataSourceName: "sqlserver://user:password@localhost:1234?database=examplebdb", + query: "GO SELECT * FROM Example.Table" +) +``` +{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} _See the [`sql.from()` documentation](/v2.0/reference/flux/stdlib/sql/from/) for diff --git a/content/v2.0/reference/flux/stdlib/sql/_index.md b/content/v2.0/reference/flux/stdlib/sql/_index.md index 2fd8814e0..0b393d83d 100644 --- a/content/v2.0/reference/flux/stdlib/sql/_index.md +++ b/content/v2.0/reference/flux/stdlib/sql/_index.md @@ -3,7 +3,7 @@ title: Flux SQL package list_title: SQL package description: > The Flux SQL package provides tools for working with data in SQL databases such - as MySQL, PostgreSQL, and SQLite. + as MySQL, PostgreSQL, Snowflake, SQLite, and MS SQL Server. Import the `sql` package. aliases: - /v2.0/reference/flux/functions/sql/ @@ -18,7 +18,7 @@ related: --- SQL Flux functions provide tools for working with data in SQL databases such as -MySQL, PostgreSQL, Snowflake, and SQLite. +MySQL, PostgreSQL, Snowflake, SQLite, and MS SQL Server. Import the `sql` package: ```js diff --git a/content/v2.0/reference/flux/stdlib/sql/from.md b/content/v2.0/reference/flux/stdlib/sql/from.md index 0ecc56666..e92e04474 100644 --- a/content/v2.0/reference/flux/stdlib/sql/from.md +++ b/content/v2.0/reference/flux/stdlib/sql/from.md @@ -39,6 +39,7 @@ The following drivers are available: - postgres - snowflake - sqlite3 – _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#query-an-sqlite-database)._ +- sqlserver, mssql ### dataSourceName The data source name (DSN) or connection string used to connect to the SQL database. @@ -61,6 +62,12 @@ username[:password]@hostname:port/dbname/schemaname?account=¶m # SQLite Driver DSN file:/path/to/test.db?cache=shared&mode=ro + +# MS SQL Server Driver DSNs +sqlserver://username:password@localhost:1234?database=examplebdb +server=localhost;user id=username;database=examplebdb; +server=localhost;user id=username;database=examplebdb;azure auth=ENV +server=localhost;user id=username;database=examplebdbr;azure tenant id=77e7d537;azure client id=58879ce8;azure client secret=0123456789 ``` ### query @@ -139,3 +146,18 @@ sql.from( query: "SELECT * FROM example_table" ) ``` + +### Query a SQL Server database +```js +import "sql" +import "influxdata/influxdb/secrets" + +username = secrets.get(key: "SQLSERVER_USER") +password = secrets.get(key: "SQLSERVER_PASS") + +sql.from( + driverName: "sqlserver", + dataSourceName: "sqlserver://${username}:${password}@localhost:1234?database=examplebdb", + query: "GO SELECT * FROM Example.Table" +) +``` diff --git a/content/v2.0/reference/flux/stdlib/sql/to.md b/content/v2.0/reference/flux/stdlib/sql/to.md index 4d94200ef..f4a4a071d 100644 --- a/content/v2.0/reference/flux/stdlib/sql/to.md +++ b/content/v2.0/reference/flux/stdlib/sql/to.md @@ -38,6 +38,7 @@ The following drivers are available: - postgres - snowflake - sqlite3 – _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#write-data-to-an-sqlite-database)._ +- sqlserver, mssql ### dataSourceName The data source name (DSN) or connection string used to connect to the SQL database. @@ -60,6 +61,12 @@ username[:password]@hostname:port/dbname/schemaname?account=¶m # SQLite Driver DSN file:/path/to/test.db?cache=shared&mode=rw + +# MS SQL Server Driver DSNs +sqlserver://username:password@localhost:1234?database=examplebdb +server=localhost;user id=username;database=examplebdb; +server=localhost;user id=username;database=examplebdb;azure auth=ENV +server=localhost;user id=username;database=examplebdbr;azure tenant id=77e7d537;azure client id=58879ce8;azure client secret=0123456789 ``` ### table @@ -148,3 +155,18 @@ sql.to( table: "example_table" ) ``` + +### Write data to a SQL Server database +```js +import "sql" +import "influxdata/influxdb/secrets" + +username = secrets.get(key: "SQLSERVER_USER") +password = secrets.get(key: "SQLSERVER_PASS") + +sql.to( + driverName: "sqlserver", + dataSourceName: "sqlserver://${username}:${password}@localhost:1234?database=examplebdb", + table: "Example.Table" +) +``` From 3987e698fc7cda7cb53c41636eda754ef73e8f5c Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Wed, 20 May 2020 13:51:08 -0700 Subject: [PATCH 02/55] Add note about user-specific tokens (addresses #1028 ) --- content/v2.0/security/tokens/create-token.md | 5 +++++ content/v2.0/security/tokens/view-tokens.md | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/content/v2.0/security/tokens/create-token.md b/content/v2.0/security/tokens/create-token.md index f5c1b93b2..882b70f52 100644 --- a/content/v2.0/security/tokens/create-token.md +++ b/content/v2.0/security/tokens/create-token.md @@ -14,6 +14,11 @@ weight: 201 Create authentication tokens using the InfluxDB user interface (UI) or the `influx` command line interface (CLI). + +Tokens are visible only to the user who created them and stop working when the user is deactivated. We recommend creating a generic IT user to create and manage tokens for writing data. + +## + ## Create a token in the InfluxDB UI 1. In the navigation menu on the left, select **Data (Load Data)** > **Tokens**. diff --git a/content/v2.0/security/tokens/view-tokens.md b/content/v2.0/security/tokens/view-tokens.md index 7e2730e50..c583e4e70 100644 --- a/content/v2.0/security/tokens/view-tokens.md +++ b/content/v2.0/security/tokens/view-tokens.md @@ -14,6 +14,10 @@ weight: 202 View authentication tokens using the InfluxDB user interface (UI) or the `influx` command line interface (CLI). +{{% note %}} +Tokens are visible only to the user who created them and stop working when the user is deactivated. We recommend creating a generic IT user to create and manage tokens for writing data. +{{% note %}} + ## View tokens in the InfluxDB UI 1. In the navigation menu on the left, select **Data (Load Data)** > **Tokens**. From 021d77113a70136ddd3969e71f86867a007e2d46 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 26 May 2020 16:58:11 -0600 Subject: [PATCH 03/55] added sql server auth info to sql docs --- content/v2.0/query-data/flux/sql.md | 5 ++++ .../v2.0/reference/flux/stdlib/sql/from.md | 27 +++++++++++++++++++ content/v2.0/reference/flux/stdlib/sql/to.md | 27 +++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/content/v2.0/query-data/flux/sql.md b/content/v2.0/query-data/flux/sql.md index 8d0a4db3e..74a416c43 100644 --- a/content/v2.0/query-data/flux/sql.md +++ b/content/v2.0/query-data/flux/sql.md @@ -116,12 +116,17 @@ sql.from( {{% code-tab-content %}} ```js +import "sql" + sql.from( driverName: "sqlserver", dataSourceName: "sqlserver://user:password@localhost:1234?database=examplebdb", query: "GO SELECT * FROM Example.Table" ) ``` + +_For information about authenticating with SQL Server using ADO-style parameters, +see [SQL Server ADO authentication](/v2.0/reference/flux/stdlib/sql/from/#sql-server-ado-authentication)._ {{% /code-tab-content %}} {{< /code-tabs-wrapper >}} diff --git a/content/v2.0/reference/flux/stdlib/sql/from.md b/content/v2.0/reference/flux/stdlib/sql/from.md index e92e04474..17299a638 100644 --- a/content/v2.0/reference/flux/stdlib/sql/from.md +++ b/content/v2.0/reference/flux/stdlib/sql/from.md @@ -161,3 +161,30 @@ sql.from( query: "GO SELECT * FROM Example.Table" ) ``` + +#### SQL Server ADO authentication +Use one of the the following methods to provide SQL Server authentication credentials as +[ActiveX Data Objects (ADO)](https://docs.microsoft.com/en-us/sql/ado/guide/ado-introduction?view=sql-server-ver15) +connection string parameters: + +##### Retrieve authentication credentials from environment variables +``` +azure auth=ENV +``` + +##### Retrieve authentication credentials from a file +``` +azure auth=c:\secure\azure.auth +``` + +##### Specify authentication credentials in the connection string +``` +azure tenant id=77...;azure client id=58...;azure client secret=0cf123.. +azure tenant id=77...;azure client id=58...;azure certificate path=C:\secure\...;azure certificate password=xY... +azure tenant id=77...;azure client id=58...;azure username=some@myorg;azure password=a1... +``` + +##### Use a Managed identity in an Azure VM +``` +azure auth=MSI +``` diff --git a/content/v2.0/reference/flux/stdlib/sql/to.md b/content/v2.0/reference/flux/stdlib/sql/to.md index f4a4a071d..4f816d798 100644 --- a/content/v2.0/reference/flux/stdlib/sql/to.md +++ b/content/v2.0/reference/flux/stdlib/sql/to.md @@ -170,3 +170,30 @@ sql.to( table: "Example.Table" ) ``` + +#### SQL Server ADO authentication +Use one of the the following methods to provide SQL Server authentication credentials as +[ActiveX Data Objects (ADO)](https://docs.microsoft.com/en-us/sql/ado/guide/ado-introduction?view=sql-server-ver15) +connection string parameters: + +##### Retrieve authentication credentials from environment variables +``` +azure auth=ENV +``` + +##### Retrieve authentication credentials from a file +``` +azure auth=c:\secure\azure.auth +``` + +##### Specify authentication credentials in the connection string +``` +azure tenant id=77...;azure client id=58...;azure client secret=0cf123.. +azure tenant id=77...;azure client id=58...;azure certificate path=C:\secure\...;azure certificate password=xY... +azure tenant id=77...;azure client id=58...;azure username=some@myorg;azure password=a1... +``` + +##### Use a Managed identity in an Azure VM +``` +azure auth=MSI +``` From 6c8749c509c21a8bbb3ee4ecb9dc429d61833976 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 26 May 2020 17:05:13 -0600 Subject: [PATCH 04/55] added warning about reading sql server creds from a file --- content/v2.0/reference/flux/stdlib/sql/from.md | 7 +++++++ content/v2.0/reference/flux/stdlib/sql/to.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/sql/from.md b/content/v2.0/reference/flux/stdlib/sql/from.md index 17299a638..432569d76 100644 --- a/content/v2.0/reference/flux/stdlib/sql/from.md +++ b/content/v2.0/reference/flux/stdlib/sql/from.md @@ -173,6 +173,13 @@ azure auth=ENV ``` ##### Retrieve authentication credentials from a file +{{% warn %}} +**InfluxDB OSS** and **{{< cloud-name "short" >}}** user interfaces do _**not**_ provide +access to the underlying file system and do not support reading credentials from a file. +To retrieve SQL Server credentials from a file, execute the query in the +[Flux REPL](/v2.0/reference/cli/influx/repl/) on your local machine. +{{% /warn %}} + ``` azure auth=c:\secure\azure.auth ``` diff --git a/content/v2.0/reference/flux/stdlib/sql/to.md b/content/v2.0/reference/flux/stdlib/sql/to.md index 4f816d798..7cc25aafc 100644 --- a/content/v2.0/reference/flux/stdlib/sql/to.md +++ b/content/v2.0/reference/flux/stdlib/sql/to.md @@ -182,6 +182,13 @@ azure auth=ENV ``` ##### Retrieve authentication credentials from a file +{{% warn %}} +**InfluxDB OSS** and **{{< cloud-name "short" >}}** user interfaces do _**not**_ provide +access to the underlying file system and do not support reading credentials from a file. +To retrieve SQL Server credentials from a file, execute the query in the +[Flux REPL](/v2.0/reference/cli/influx/repl/) on your local machine. +{{% /warn %}} + ``` azure auth=c:\secure\azure.auth ``` From 7cc5de7f4a7accf4294610865bf077721aa4e54a Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 27 May 2020 09:00:01 -0600 Subject: [PATCH 05/55] updated sql server info to address PR feedback --- content/v2.0/query-data/flux/sql.md | 4 ++-- .../v2.0/reference/flux/stdlib/sql/_index.md | 4 ++-- .../v2.0/reference/flux/stdlib/sql/from.md | 24 ++++++++++++++----- content/v2.0/reference/flux/stdlib/sql/to.md | 24 ++++++++++++++----- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/content/v2.0/query-data/flux/sql.md b/content/v2.0/query-data/flux/sql.md index 74a416c43..a079e4438 100644 --- a/content/v2.0/query-data/flux/sql.md +++ b/content/v2.0/query-data/flux/sql.md @@ -5,7 +5,7 @@ list_title: Query SQL data description: > The Flux `sql` package provides functions for working with SQL data sources. Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, - SQLite, and MS SQL Server. + SQLite, and Microsoft SQL Server. v2.0/tags: [query, flux, sql] menu: v2_0: @@ -32,7 +32,7 @@ The [Flux](/v2.0/reference/flux) `sql` package provides functions for working wi [`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), [Snowflake](https://www.snowflake.com/), [SQLite](https://www.sqlite.org/index.html), -and [MS SQL Server](https://www.microsoft.com/en-us/sql-server/default.aspx), +and [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/default.aspx), and use the results with InfluxDB dashboards, tasks, and other operations. - [Query a SQL data source](#query-a-sql-data-source) diff --git a/content/v2.0/reference/flux/stdlib/sql/_index.md b/content/v2.0/reference/flux/stdlib/sql/_index.md index 0b393d83d..fd8230e9a 100644 --- a/content/v2.0/reference/flux/stdlib/sql/_index.md +++ b/content/v2.0/reference/flux/stdlib/sql/_index.md @@ -3,7 +3,7 @@ title: Flux SQL package list_title: SQL package description: > The Flux SQL package provides tools for working with data in SQL databases such - as MySQL, PostgreSQL, Snowflake, SQLite, and MS SQL Server. + as MySQL, PostgreSQL, Snowflake, SQLite, and Microsoft SQL Server. Import the `sql` package. aliases: - /v2.0/reference/flux/functions/sql/ @@ -18,7 +18,7 @@ related: --- SQL Flux functions provide tools for working with data in SQL databases such as -MySQL, PostgreSQL, Snowflake, SQLite, and MS SQL Server. +MySQL, PostgreSQL, Snowflake, SQLite, and Microsoft SQL Server. Import the `sql` package: ```js diff --git a/content/v2.0/reference/flux/stdlib/sql/from.md b/content/v2.0/reference/flux/stdlib/sql/from.md index 432569d76..b8d5f35d4 100644 --- a/content/v2.0/reference/flux/stdlib/sql/from.md +++ b/content/v2.0/reference/flux/stdlib/sql/from.md @@ -63,7 +63,7 @@ username[:password]@hostname:port/dbname/schemaname?account=¶m # SQLite Driver DSN file:/path/to/test.db?cache=shared&mode=ro -# MS SQL Server Driver DSNs +# Microsoft SQL Server Driver DSNs sqlserver://username:password@localhost:1234?database=examplebdb server=localhost;user id=username;database=examplebdb; server=localhost;user id=username;database=examplebdb;azure auth=ENV @@ -163,10 +163,15 @@ sql.from( ``` #### SQL Server ADO authentication -Use one of the the following methods to provide SQL Server authentication credentials as +Use one of the following methods to provide SQL Server authentication credentials as [ActiveX Data Objects (ADO)](https://docs.microsoft.com/en-us/sql/ado/guide/ado-introduction?view=sql-server-ver15) connection string parameters: +- [Retrieve authentication credentials from environment variables](#retrieve-authentication-credentials-from-environment-variables) +- [Retrieve authentication credentials from a file](#retrieve-authentication-credentials-from-a-file) +- [Specify authentication credentials in the connection string](#specify-authentication-credentials-in-the-connection-string) +- [Use a Managed identity in an Azure VM](#use-a-managed-identity-in-an-azure-vm) + ##### Retrieve authentication credentials from environment variables ``` azure auth=ENV @@ -180,18 +185,25 @@ To retrieve SQL Server credentials from a file, execute the query in the [Flux REPL](/v2.0/reference/cli/influx/repl/) on your local machine. {{% /warn %}} -``` -azure auth=c:\secure\azure.auth +```powershel +azure auth=C:\secure\azure.auth ``` ##### Specify authentication credentials in the connection string -``` +```powershell +# Example of providing tenant ID, client ID, and client secret token azure tenant id=77...;azure client id=58...;azure client secret=0cf123.. + +# Example of providing tenant ID, client ID, certificate path and certificate password azure tenant id=77...;azure client id=58...;azure certificate path=C:\secure\...;azure certificate password=xY... + +# Example of providing tenant ID, client ID, and Azure username and password azure tenant id=77...;azure client id=58...;azure username=some@myorg;azure password=a1... ``` -##### Use a Managed identity in an Azure VM +##### Use a managed identity in an Azure VM +_For information about managed identities, see [Microsoft managed identities](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview)._ + ``` azure auth=MSI ``` diff --git a/content/v2.0/reference/flux/stdlib/sql/to.md b/content/v2.0/reference/flux/stdlib/sql/to.md index 7cc25aafc..7fbeb1cca 100644 --- a/content/v2.0/reference/flux/stdlib/sql/to.md +++ b/content/v2.0/reference/flux/stdlib/sql/to.md @@ -62,7 +62,7 @@ username[:password]@hostname:port/dbname/schemaname?account=¶m # SQLite Driver DSN file:/path/to/test.db?cache=shared&mode=rw -# MS SQL Server Driver DSNs +# Microsoft SQL Server Driver DSNs sqlserver://username:password@localhost:1234?database=examplebdb server=localhost;user id=username;database=examplebdb; server=localhost;user id=username;database=examplebdb;azure auth=ENV @@ -172,10 +172,15 @@ sql.to( ``` #### SQL Server ADO authentication -Use one of the the following methods to provide SQL Server authentication credentials as +Use one of the following methods to provide SQL Server authentication credentials as [ActiveX Data Objects (ADO)](https://docs.microsoft.com/en-us/sql/ado/guide/ado-introduction?view=sql-server-ver15) connection string parameters: +- [Retrieve authentication credentials from environment variables](#retrieve-authentication-credentials-from-environment-variables) +- [Retrieve authentication credentials from a file](#retrieve-authentication-credentials-from-a-file) +- [Specify authentication credentials in the connection string](#specify-authentication-credentials-in-the-connection-string) +- [Use a Managed identity in an Azure VM](#use-a-managed-identity-in-an-azure-vm) + ##### Retrieve authentication credentials from environment variables ``` azure auth=ENV @@ -189,18 +194,25 @@ To retrieve SQL Server credentials from a file, execute the query in the [Flux REPL](/v2.0/reference/cli/influx/repl/) on your local machine. {{% /warn %}} -``` -azure auth=c:\secure\azure.auth +```powershell +azure auth=C:\secure\azure.auth ``` ##### Specify authentication credentials in the connection string -``` +```powershell +# Example of providing tenant ID, client ID, and client secret token azure tenant id=77...;azure client id=58...;azure client secret=0cf123.. + +# Example of providing tenant ID, client ID, certificate path and certificate password azure tenant id=77...;azure client id=58...;azure certificate path=C:\secure\...;azure certificate password=xY... + +# Example of providing tenant ID, client ID, and Azure username and password azure tenant id=77...;azure client id=58...;azure username=some@myorg;azure password=a1... ``` -##### Use a Managed identity in an Azure VM +##### Use a managed identity in an Azure VM +_For information about managed identities, see [Microsoft managed identities](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview)._ + ``` azure auth=MSI ``` From 1e5dd6dcda13d81cab1831a63684c7d931ce78ce Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Mon, 1 Jun 2020 15:17:13 -0700 Subject: [PATCH 06/55] add WIP UI info, addresses #1079 --- content/v2.0/organizations/buckets/view-buckets.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/content/v2.0/organizations/buckets/view-buckets.md b/content/v2.0/organizations/buckets/view-buckets.md index b0d001b00..df3da8f86 100644 --- a/content/v2.0/organizations/buckets/view-buckets.md +++ b/content/v2.0/organizations/buckets/view-buckets.md @@ -9,13 +9,18 @@ menu: weight: 202 --- +## View a list of buckets + ## View buckets in the InfluxDB UI 1. In the navigation menu on the left, select **Data (Load Data)** > **Buckets**. {{< nav-icon "data" >}} -2. Click a bucket to open it **Data Explorer**. + A list of buckets with their retention policies and IDs appears. + +2. Click a bucket to open it in the **Data Explorer**. +3. Click the bucket ID to copy it to the clipboard. ## View buckets using the influx CLI From 1519e49cd0cd71c7a8e2d0bf92f3ad7ac5ac60f7 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 17 Jun 2020 08:30:20 -0600 Subject: [PATCH 07/55] added flux 0.70 placholder release notes --- content/v2.0/reference/release-notes/flux.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/v2.0/reference/release-notes/flux.md b/content/v2.0/reference/release-notes/flux.md index ed3c14153..2a3232091 100644 --- a/content/v2.0/reference/release-notes/flux.md +++ b/content/v2.0/reference/release-notes/flux.md @@ -16,6 +16,11 @@ Though newer versions of Flux may be available, they will not be included with InfluxDB until the next InfluxDB v2.0 release._ {{% /note %}} +## v0.70.0 [unreleased] +_placholder_ + +--- + ## v0.69.2 [2020-06-10] ### Bug fixes From 30b01414e6c3ece55868388d1e9cb83a5659fbfe Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 18 Jun 2020 10:40:06 -0600 Subject: [PATCH 08/55] added flux teams package, resolves #1064 --- .../reference/flux/stdlib/contrib/_index.md | 2 +- .../flux/stdlib/contrib/discord/_index.md | 2 +- .../flux/stdlib/contrib/teams/_index.md | 32 ++++++++ .../flux/stdlib/contrib/teams/endpoint.md | 78 +++++++++++++++++++ .../flux/stdlib/contrib/teams/message.md | 78 +++++++++++++++++++ 5 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 content/v2.0/reference/flux/stdlib/contrib/teams/_index.md create mode 100644 content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md create mode 100644 content/v2.0/reference/flux/stdlib/contrib/teams/message.md diff --git a/content/v2.0/reference/flux/stdlib/contrib/_index.md b/content/v2.0/reference/flux/stdlib/contrib/_index.md index 5355284b8..7051d3edb 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/_index.md +++ b/content/v2.0/reference/flux/stdlib/contrib/_index.md @@ -5,7 +5,7 @@ description: > User-contributed packages and functions are contributed and maintained by members of the InfluxDB and Flux communities. menu: v2_0_ref: - name: User-contributed + name: Contributed parent: Flux standard library weight: 202 v2.0/tags: [contributed, functions, package] diff --git a/content/v2.0/reference/flux/stdlib/contrib/discord/_index.md b/content/v2.0/reference/flux/stdlib/contrib/discord/_index.md index 7bff095dd..ecd131b2e 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/discord/_index.md +++ b/content/v2.0/reference/flux/stdlib/contrib/discord/_index.md @@ -7,7 +7,7 @@ description: > menu: v2_0_ref: name: Discord - parent: User-contributed + parent: Contributed weight: 202 v2.0/tags: [functions, discord, package] --- diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/_index.md b/content/v2.0/reference/flux/stdlib/contrib/teams/_index.md new file mode 100644 index 000000000..7d8cad01f --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/_index.md @@ -0,0 +1,32 @@ +--- +title: Flux Microsoft Teams package +list_title: Microsoft Teams package +description: > + The Flux Microsoft Teams package provides functions for sending messages to a + [Microsoft Teams](https://www.microsoft.com/microsoft-365/microsoft-teams/group-chat-software) + channel using an [incoming webhook](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook). + Import the `contrib/sranka/teams` package. +menu: + v2_0_ref: + name: Teams + parent: Contributed +weight: 202 +v2.0/tags: [functions, teams, microsoft, package] +--- + +The Flux Microsoft Teams package provides functions for sending messages to a +[Microsoft Teams](https://www.microsoft.com/microsoft-365/microsoft-teams/group-chat-software) +channel using an [incoming webhook](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook). +Import the `contrib/sranka/teams` package: + +```js +import "contrib/sranka/teams" +``` + +{{< children type="functions" show="pages" >}} + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md new file mode 100644 index 000000000..119312c7d --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md @@ -0,0 +1,78 @@ +--- +title: teams.endpoint() function +description: > + The `teams.endpoint()` function sends a message to a Microsoft Teams channel + using data from table rows. +menu: + v2_0_ref: + name: teams.endpoint + parent: Teams +weight: 202 +--- + +The `teams.endpoint()` function sends a message to a Microsoft Teams channel +using data from table rows. + +_**Function type:** Output_ + +```js +import "contrib/sranka/teams" + +teams.endpoint( + url: "https://outlook.office.com/webhook/example-webhook" +) +``` + +## Parameters + +### url +Incoming webhook URL. + +_**Data type:** String_ + +## Usage +`teams.endpoint` is a factory function that outputs another function. +The output function requires a `mapFn` parameter. + +### mapFn +A function that builds the object used to generate the POST request. +Requires an `r` parameter. + +_**Data type:** Function_ + +`mapFn` accepts a table row (`r`) and returns an object that must include the +following fields: + +- `title` +- `text` +- `summary` + +_For more information, see [`teams.message()`](/v2.0/reference/flux/stdlib/contrib/teams/message/)._ + +## Examples + +##### Send critical statuses to a Microsoft Teams channel +```js +import "contrib/sranka/teams" + +url = "https://outlook.office.com/webhook/example-webhook" +endpoint = teams.endpoint(url: url) + +crit_statuses = from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses" and status == "crit") + +crit_statuses + |> endpoint(mapFn: (r) => ({ + title: "Disk Usage" + text: "Disk usage is: **${r.status}**.", + summary: "Disk Usage is ${r.status}" + }) + ) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/message.md b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md new file mode 100644 index 000000000..f2a384809 --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md @@ -0,0 +1,78 @@ +--- +title: teams.message() function +description: > + The `teams.message()` function sends a single message to a Microsoft Teams channel using + a [incoming webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3). +menu: + v2_0_ref: + name: teams.message + parent: Teams +weight: 202 +--- + +The `teams.message()` function sends a single message to a Microsoft Teams channel using +an [incoming webhook](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook). + +_**Function type:** Output_ + +```js +import "contrib/sranka/teams" + +teams.message( + url: "https://outlook.office.com/webhook/example-webhook", + title: "Example message title", + text: "Example message text", + summary: "", +) +``` + +## Parameters + +### url +Incoming webhook URL. + +_**Data type:** String_ + +### title +Message card title. + +_**Data type:** String_ + +### text +Message card text. + +_**Data type:** String_ + +### summary +Message card summary. +Default is `""`. +If no summary is provided, Flux generates the summary from the message text. + +_**Data type:** String_ + +## Examples + +##### Send the last reported status to a Microsoft Teams channel +```js +import "contrib/sranka/teams" + +lastReported = + from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses") + |> last() + |> findRecord(fn: (key) => true, idx: 0) + +teams.message( + url: "https://outlook.office.com/webhook/example-webhook", + title: "Disk Usage" + text: "Disk usage is: *${lastReported.status}*.", + summary: "Disk Usage is ${lastReported.status}" +) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} From 590703fa1ada90fb2cc7f227465d2136a91ca96a Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 18 Jun 2020 13:25:58 -0600 Subject: [PATCH 09/55] updated teams pkg with PR feedback --- content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md | 2 +- content/v2.0/reference/flux/stdlib/contrib/teams/message.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md index 119312c7d..2f37e7e25 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md @@ -66,7 +66,7 @@ crit_statuses |> endpoint(mapFn: (r) => ({ title: "Disk Usage" text: "Disk usage is: **${r.status}**.", - summary: "Disk Usage is ${r.status}" + summary: "Disk usage is ${r.status}" }) ) ``` diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/message.md b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md index f2a384809..e0fc5424c 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/teams/message.md +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md @@ -2,7 +2,7 @@ title: teams.message() function description: > The `teams.message()` function sends a single message to a Microsoft Teams channel using - a [incoming webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3). + an [incoming webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3). menu: v2_0_ref: name: teams.message @@ -67,7 +67,7 @@ teams.message( url: "https://outlook.office.com/webhook/example-webhook", title: "Disk Usage" text: "Disk usage is: *${lastReported.status}*.", - summary: "Disk Usage is ${lastReported.status}" + summary: "Disk usage is ${lastReported.status}" ) ``` From 41b3434c8995b773dfd9abd661b58aa4f1c846cf Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 10:22:58 -0600 Subject: [PATCH 10/55] added flux telegram package, resolves #1058 --- .../flux/stdlib/contrib/teams/message.md | 2 +- .../flux/stdlib/contrib/telegram/_index.md | 50 ++++++++ .../flux/stdlib/contrib/telegram/endpoint.md | 106 +++++++++++++++++ .../flux/stdlib/contrib/telegram/message.md | 107 ++++++++++++++++++ 4 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 content/v2.0/reference/flux/stdlib/contrib/telegram/_index.md create mode 100644 content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md create mode 100644 content/v2.0/reference/flux/stdlib/contrib/telegram/message.md diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/message.md b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md index e0fc5424c..f56bbc01b 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/teams/message.md +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/message.md @@ -2,7 +2,7 @@ title: teams.message() function description: > The `teams.message()` function sends a single message to a Microsoft Teams channel using - an [incoming webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3). + an [incoming webhook](https://docs.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook). menu: v2_0_ref: name: teams.message diff --git a/content/v2.0/reference/flux/stdlib/contrib/telegram/_index.md b/content/v2.0/reference/flux/stdlib/contrib/telegram/_index.md new file mode 100644 index 000000000..6c2d2171a --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/telegram/_index.md @@ -0,0 +1,50 @@ +--- +title: Flux Telegram package +list_title: Telegram package +description: > + The Flux Telegram package provides functions for sending messages to + [Telegram](https://telegram.org/) using the [Telegram Bot API](https://core.telegram.org/bots/api). + Import the `contrib/sranka/telegram` package. +menu: + v2_0_ref: + name: Telegram + parent: Contributed +weight: 202 +v2.0/tags: [functions, teams, microsoft, package] +--- + +The Flux Telegram package provides functions for sending messages to +[Telegram](https://telegram.org/) using the [Telegram Bot API](https://core.telegram.org/bots/api). +Import the `contrib/sranka/telegram` package: + +```js +import "contrib/sranka/telegram" +``` + +{{< children type="functions" show="pages" >}} + +## Set up a Telegram bot +The **Telegram Bot API** requires a **bot token** and a **channel ID**. +To set up a Telegram bot and obtain the required bot token and channel ID: + +1. [Create a new Telegram account](https://telegram.org/) or use an existing account. +2. [Create a Telegram bot](https://core.telegram.org/bots#creating-a-new-bot). + Telegram provides a **bot token** for the newly created bot. +3. Use the **Telegram application** to create a new channel. +4. [Add the new bot to the channel](https://stackoverflow.com/questions/33126743/how-do-i-add-my-bot-to-a-channel) as an **Administrator**. + Ensure the bot has permissions necessary to **post messages**. +5. Send a message to bot in the channel. +6. Send a request to `https://api.telegram.org/bot$token/getUpdates`. + + ```sh + curl https://api.telegram.org/bot$token/getUpdates + ``` + + Find your **channel ID** in the `id` field of the response. + + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md b/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md new file mode 100644 index 000000000..4e5736adb --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md @@ -0,0 +1,106 @@ +--- +title: telegram.endpoint() function +description: > + The `telegram.endpoint()` function sends a message to a Telegram channel + using data from table rows. +menu: + v2_0_ref: + name: telegram.endpoint + parent: Telegram +weight: 202 +--- + +The `telegram.endpoint()` function sends a message to a Telegram channel +using data from table rows. + +_**Function type:** Output_ + +```js +import "contrib/sranka/telegram" + +telegram.endpoint( + url: "https://api.telegram.org/bot", + token: "S3crEtTel3gRamT0k3n", + parseMode: "MarkdownV2", + disableWebPagePreview: false, +) +``` + +{{% note %}} +For information about retrieving your Telegram **bot token** and **channel ID**, +see [Set up a Telegram bot](/v2.0/reference/flux/stdlib/contrib/telegram/#set-up-a-telegram-bot). +{{% /note %}} + +## Parameters + +### url +URL of the Telegram bot endpoint. +Default is `https://api.telegram.org/bot`. + +_**Data type:** String_ + +### token +Required +Telegram bot token. + +_**Data type:** String_ + +### parseMode +[Parse mode](https://core.telegram.org/bots/api#formatting-options) of the message text. +Default is `"MarkdownV2"`. + +_**Data type:** String_ + +### disableWebPagePreview +Disable preview of web links in the sent message. +Default is `false`. + +_**Data type:** Boolean_ + +## Usage +`telegram.endpoint` is a factory function that outputs another function. +The output function requires a `mapFn` parameter. + +### mapFn +A function that builds the object used to generate the POST request. +Requires an `r` parameter. + +_**Data type:** Function_ + +`mapFn` accepts a table row (`r`) and returns an object that must include the +following fields: + +- `channel` +- `text` +- `silent` + +_For more information, see [`telegram.message()`](/v2.0/reference/flux/stdlib/contrib/telegram/message/)._ + +## Examples + +##### Send critical statuses to a Telegram channel +```js +import "influxdata/influxdb/secrets" +import "contrib/sranka/telegram" + +token = secrets.get(key: "TELEGRAM_TOKEN") +endpoint = telegram.endpoint(token: token) + +crit_statuses = from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses" and status == "crit") + +crit_statuses + |> endpoint(mapFn: (r) => ({ + channel: "-12345", + text: "Disk usage is **${r.status}**.", + silent: true + }) + ) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/v2.0/reference/flux/stdlib/contrib/telegram/message.md b/content/v2.0/reference/flux/stdlib/contrib/telegram/message.md new file mode 100644 index 000000000..e9e074f91 --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/contrib/telegram/message.md @@ -0,0 +1,107 @@ +--- +title: telegram.message() function +description: > + The `telegram.message()` function sends a single message to a Telegram channel using + the [`sendMessage` method of the Telegram Bot API](https://core.telegram.org/bots/api#sendmessage). +menu: + v2_0_ref: + name: telegram.message + parent: Telegram +weight: 202 +--- + +The `telegram.message()` function sends a single message to a Telegram channel using +the [`sendMessage` method of the Telegram Bot API](https://core.telegram.org/bots/api#sendmessage). + +_**Function type:** Output_ + +```js +import "contrib/sranka/telegram" + +telegram.message( + url: "https://api.telegram.org/bot", + token: "S3crEtTel3gRamT0k3n", + channel: "-12345", + text: "Example message text", + parseMode: "MarkdownV2", + disableWebPagePreview: false, + silent: true +) +``` + +{{% note %}} +For information about retrieving your Telegram **bot token** and **channel ID**, +see [Set up a Telegram bot](/v2.0/reference/flux/stdlib/contrib/telegram/#set-up-a-telegram-bot). +{{% /note %}} + +## Parameters + +### url +URL of the Telegram bot endpoint. +Default is `https://api.telegram.org/bot`. + +_**Data type:** String_ + +### token +Required +Telegram bot token. + +_**Data type:** String_ + +### channel +Required +Telegram channel ID. + +_**Data type:** String_ + +### text +Message text. + +_**Data type:** String_ + +### parseMode +[Parse mode](https://core.telegram.org/bots/api#formatting-options) of the message text. +Default is `"MarkdownV2"`. + +_**Data type:** String_ + +### disableWebPagePreview +Disable preview of web links in the sent message. +Default is `false`. + +_**Data type:** Boolean_ + +### silent +Send message [silently](https://telegram.org/blog/channels-2-0#silent-messages). +Default is `true`. + +_**Data type:** Boolean_ + +## Examples + +##### Send the last reported status to a Microsoft Teams channel +```js +import "influxdata/influxdb/secrets" +import "contrib/sranka/telegram" + +token = secrets.get(key: "TELEGRAM_TOKEN") + +lastReported = + from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses") + |> last() + |> findRecord(fn: (key) => true, idx: 0) + + telegram.message( + token: token, + channel: "-12345" + text: "Disk usage is **${lastReported.status}**.", + ) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@sranka](https://github.com/sranka) +**InfluxDB Slack:** [@sranka](https://influxdata.com/slack) +{{% /note %}} From b21df957bf478a4c0973daf073e1e1a632c423a0 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 12:43:25 -0600 Subject: [PATCH 11/55] added aws athena support to sql pkg, resolves #1078 --- content/v2.0/query-data/flux/sql.md | 7 +-- .../v2.0/reference/flux/stdlib/sql/_index.md | 13 +++-- .../v2.0/reference/flux/stdlib/sql/from.md | 47 ++++++++++++++++++- content/v2.0/reference/flux/stdlib/sql/to.md | 11 +++++ 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/content/v2.0/query-data/flux/sql.md b/content/v2.0/query-data/flux/sql.md index a079e4438..b7b4d9e0d 100644 --- a/content/v2.0/query-data/flux/sql.md +++ b/content/v2.0/query-data/flux/sql.md @@ -5,7 +5,7 @@ list_title: Query SQL data description: > The Flux `sql` package provides functions for working with SQL data sources. Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, - SQLite, and Microsoft SQL Server. + SQLite, Microsoft SQL Server, Amazon Athena. v2.0/tags: [query, flux, sql] menu: v2_0: @@ -32,8 +32,9 @@ The [Flux](/v2.0/reference/flux) `sql` package provides functions for working wi [`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), [Snowflake](https://www.snowflake.com/), [SQLite](https://www.sqlite.org/index.html), -and [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/default.aspx), -and use the results with InfluxDB dashboards, tasks, and other operations. +[Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/default.aspx), +and [Amazon Athena](https://aws.amazon.com/athena/) and use the results with +InfluxDB dashboards, tasks, and other operations. - [Query a SQL data source](#query-a-sql-data-source) - [Join SQL data with data in InfluxDB](#join-sql-data-with-data-in-influxdb) diff --git a/content/v2.0/reference/flux/stdlib/sql/_index.md b/content/v2.0/reference/flux/stdlib/sql/_index.md index fd8230e9a..53dadf6c5 100644 --- a/content/v2.0/reference/flux/stdlib/sql/_index.md +++ b/content/v2.0/reference/flux/stdlib/sql/_index.md @@ -3,7 +3,7 @@ title: Flux SQL package list_title: SQL package description: > The Flux SQL package provides tools for working with data in SQL databases such - as MySQL, PostgreSQL, Snowflake, SQLite, and Microsoft SQL Server. + as MySQL, PostgreSQL, Snowflake, SQLite, Microsoft SQL Server, and Amazon Athena. Import the `sql` package. aliases: - /v2.0/reference/flux/functions/sql/ @@ -17,8 +17,15 @@ related: - /v2.0/query-data/flux/sql/ --- -SQL Flux functions provide tools for working with data in SQL databases such as -MySQL, PostgreSQL, Snowflake, SQLite, and Microsoft SQL Server. +SQL Flux functions provide tools for working with data in SQL databases such as: + +- Amazon Athena +- Microsoft SQL Server +- MySQL +- PostgreSQL +- Snowflake +- SQLite + Import the `sql` package: ```js diff --git a/content/v2.0/reference/flux/stdlib/sql/from.md b/content/v2.0/reference/flux/stdlib/sql/from.md index b8d5f35d4..f48d16a92 100644 --- a/content/v2.0/reference/flux/stdlib/sql/from.md +++ b/content/v2.0/reference/flux/stdlib/sql/from.md @@ -35,6 +35,7 @@ _**Data type:** String_ The following drivers are available: +- awsathena - mysql - postgres - snowflake @@ -49,12 +50,16 @@ _**Data type:** String_ ##### Driver dataSourceName examples ```sh -# Postgres Driver DSN -postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full +# Amazon Athena Driver DSN +s3://myorgqueryresults/?accessID=AKIAJLO3F...®ion=us-west-1&secretAccessKey=NnQ7MUMp9PYZsmD47c%2BSsXGOFsd%2F... +s3://myorgqueryresults/?accessID=AKIAJLO3F...&db=dbname&missingAsDefault=false&missingAsEmptyString=false®ion=us-west-1&secretAccessKey=NnQ7MUMp9PYZsmD47c%2BSsXGOFsd%2F...&WGRemoteCreation=false # MySQL Driver DSN username:password@tcp(localhost:3306)/dbname?param=value +# Postgres Driver DSN +postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full + # Snowflake Driver DSNs username[:password]@accountname/dbname/schemaname?param1=value1¶mN=valueN username[:password]@accountname/dbname?param1=value1¶mN=valueN @@ -77,6 +82,13 @@ _**Data type:** String_ ## Examples +- [MySQL](#query-a-mysql-database) +- [Postgres](#query-a-postgres-database) +- [Snowflake](#query-a-snowflake-database) +- [SQLite](#query-an-sqlite-database) +- [Amazon Athena](#query-an-amazon-athena-database) +- [SQL Server](#query-a-sql-server-database) + {{% note %}} The examples below use [InfluxDB secrets](/v2.0/security/secrets/) to populate sensitive connection credentials. @@ -147,6 +159,37 @@ sql.from( ) ``` +### Query an Amazon Athena database +```js +import "sql" +import "influxdata/influxdb/secrets" + +region = us-west-1 +accessID = secrets.get(key: "ATHENA_ACCESS_ID") +secretKey = secrets.get(key: "ATHENA_SECRET_KEY") + +sql.from( + driverName: "awsathena", + dataSourceName: "s3://myorgqueryresults/?accessID=${accessID}®ion=${region}&secretAccessKey=${secretKey}", + query:"SELECT * FROM example_table" +) +``` + +##### Athena connection string +To query an Amazon Athena database, use the following query parameters in your Athena +S3 connection string (DSN): + +\* Required + +- **region** - AWS region \* +- **accessID** - AWS IAM access ID \* +- **secretAccessKey** - AWS IAM secret key \* +- **db** - database name +- **WGRemoteCreation** - controls workgroup and tag creation +- **missingAsDefault** - replace missing data with default values +- **missingAsEmptyString** - replace missing data with empty strings + + ### Query a SQL Server database ```js import "sql" diff --git a/content/v2.0/reference/flux/stdlib/sql/to.md b/content/v2.0/reference/flux/stdlib/sql/to.md index 7fbeb1cca..0dc69b006 100644 --- a/content/v2.0/reference/flux/stdlib/sql/to.md +++ b/content/v2.0/reference/flux/stdlib/sql/to.md @@ -86,6 +86,12 @@ If writing to a **SQLite** database, set `batchSize` to `999` or less. ## Examples +- [MySQL](#write-data-to-a-mysql-database) +- [Postgres](#write-data-to-a-postgres-database) +- [Snowflake](#write-data-to-a-snowflake-database) +- [SQLite](#write-data-to-an-sqlite-database) +- [SQL Server](#write-data-to-a-sql-server-database) + {{% note %}} The examples below use [InfluxDB secrets](/v2.0/security/secrets/) to populate sensitive connection credentials. @@ -216,3 +222,8 @@ _For information about managed identities, see [Microsoft managed identities](ht ``` azure auth=MSI ``` + +{{% warn %}} +### sql.to does not support Amazon Athena +The `sql.to` function does not support writing data to [Amazon Athena](https://aws.amazon.com/athena/). +{{% /warn %}} From 86fb65b0b11d263ec6bb313e462a7b549af94ce8 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 14:01:08 -0600 Subject: [PATCH 12/55] added warning to group fn about sort order, closes #1129 --- .../flux/stdlib/built-in/transformations/group.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md index 77fc61f9c..0af36fcff 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md @@ -32,6 +32,13 @@ group(columns: ["_time"], mode:"except") group() ``` +{{% warn %}} +#### Group does not guarantee sort order +`group()` does not guarantee the sort order of output records. +To ensure data is sorted correctly, use [`sort()`](/v2.0/reference/flux/stdlib/built-in/transformations/sort/) +after `group()`. +{{% /warn %}} + ## Parameters ### columns From 84daa2ec0b3e2cf83bf8e806f0a177cb47ed9368 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 14:07:31 -0600 Subject: [PATCH 13/55] add example to group sort warning --- .../reference/flux/stdlib/built-in/transformations/group.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md index 0af36fcff..abb897cad 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md @@ -37,6 +37,12 @@ group() `group()` does not guarantee the sort order of output records. To ensure data is sorted correctly, use [`sort()`](/v2.0/reference/flux/stdlib/built-in/transformations/sort/) after `group()`. + +```js +data + |> group() + |> sort(columns: ["_time"]) +``` {{% /warn %}} ## Parameters From b42c464166d81f5ba55c381bdebce07a59ca3977 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 14:49:30 -0600 Subject: [PATCH 14/55] moved derivative and difference out of aggregate functions, resolves #1059 --- content/v2.0/query-data/flux/rate.md | 2 +- .../transformations/{aggregates => }/derivative.md | 11 ++++++++--- .../transformations/{aggregates => }/difference.md | 11 ++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/derivative.md (84%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/difference.md (90%) diff --git a/content/v2.0/query-data/flux/rate.md b/content/v2.0/query-data/flux/rate.md index fb1a5825b..ec1535cd4 100644 --- a/content/v2.0/query-data/flux/rate.md +++ b/content/v2.0/query-data/flux/rate.md @@ -16,7 +16,7 @@ menu: name: Rate v2.0/tags: [query, rate] related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative/ + - /v2.0/reference/flux/stdlib/built-in/transformations/derivative/ - /v2.0/reference/flux/stdlib/experimental/aggregate/rate/ list_query_example: rate_of_change --- diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md similarity index 84% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md index 8594c0310..21a161c62 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md @@ -7,8 +7,10 @@ aliases: menu: v2_0_ref: name: derivative - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 +aliases: + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative related: - /v2.0/query-data/flux/rate/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#derivative, InfluxQL – DERIVATIVE() @@ -18,7 +20,7 @@ The `derivative()` function computes the rate of change per [`unit`](#unit) of t It assumes rows are ordered by the `_time` column. The output table schema is the same as the input table. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js @@ -30,6 +32,9 @@ derivative( ) ``` +#### Output tables +For each input table with `n` rows, `derivative()` outputs a table with `n - 1` rows. + ## Parameters ### unit diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/difference.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md similarity index 90% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/difference.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md index fb773a363..9f5e6c903 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/difference.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md @@ -7,8 +7,10 @@ aliases: menu: v2_0_ref: name: difference - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 +aliases: + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/difference related: - https://docs.influxdata.com/influxdb/latest/query_language/functions/#difference, InfluxQL – DIFFERENCE() --- @@ -16,7 +18,7 @@ related: The `difference()` function computes the difference between subsequent records. The user-specified columns of numeric type are subtracted while others are kept intact. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js @@ -27,6 +29,9 @@ difference( ) ``` +#### Output tables +For each input table with `n` rows, `difference()` outputs a table with `n - 1` rows. + ## Parameters ### nonNegative From 9b46c28e49d440376d8fa7fab264fa57974ef9a2 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 15:57:32 -0600 Subject: [PATCH 15/55] reorganize aggregate transformations to accurately repsresent true aggregates --- content/v2.0/query-data/flux/increase.md | 4 ++-- .../transformations/aggregates/_index.md | 12 ++++++---- .../chandemomentumoscillator.md | 17 ++++++++++--- .../transformations/{aggregates => }/cov.md | 7 +++--- .../{aggregates => }/covariance.md | 7 +++--- .../built-in/transformations/derivative.md | 6 ++--- .../built-in/transformations/difference.md | 5 ++-- .../{aggregates => }/doubleema.md | 15 ++++++------ .../exponentialmovingaverage.md | 13 +++++----- .../{aggregates => }/holtwinters.md | 7 +++--- .../{aggregates => }/increase.md | 17 +++++++++---- .../{aggregates => }/kaufmansama.md | 9 +++---- .../{aggregates => }/kaufmanser.md | 9 +++---- .../{aggregates => }/movingaverage.md | 15 ++++++------ .../{aggregates => }/pearsonr.md | 7 +++--- .../{aggregates => }/relativestrengthindex.md | 24 +++++++++++++------ .../{aggregates => }/timedmovingaverage.md | 15 ++++++------ .../{aggregates => }/tripleema.md | 15 ++++++------ .../tripleexponentialderivative.md | 17 ++++++------- 19 files changed, 132 insertions(+), 89 deletions(-) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/chandemomentumoscillator.md (85%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/cov.md (90%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/covariance.md (86%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/doubleema.md (83%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/exponentialmovingaverage.md (84%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/holtwinters.md (95%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/increase.md (80%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/kaufmansama.md (87%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/kaufmanser.md (86%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/movingaverage.md (77%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/pearsonr.md (89%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/relativestrengthindex.md (82%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/timedmovingaverage.md (82%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/tripleema.md (85%) rename content/v2.0/reference/flux/stdlib/built-in/transformations/{aggregates => }/tripleexponentialderivative.md (83%) diff --git a/content/v2.0/query-data/flux/increase.md b/content/v2.0/query-data/flux/increase.md index 35971ebe1..b84cb1f54 100644 --- a/content/v2.0/query-data/flux/increase.md +++ b/content/v2.0/query-data/flux/increase.md @@ -3,7 +3,7 @@ title: Calculate the increase seotitle: Calculate the increase in Flux list_title: Increase description: > - Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/) + Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/increase/) to track increases across multiple columns in a table. This function is especially useful when tracking changes in counter values that wrap over time or periodically reset. @@ -18,7 +18,7 @@ related: list_query_example: increase --- -Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/) +Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/increase/) to track increases across multiple columns in a table. This function is especially useful when tracking changes in counter values that wrap over time or periodically reset. diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md index 30f6441f4..fea978837 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md @@ -1,7 +1,9 @@ --- -title: Flux built-in aggregate functions -list_title: Built-in aggregate functions -description: Flux's built-in aggregate functions take values from an input table and aggregate them in some way. +title: Flux built-in aggregate transformations +list_title: Built-in aggregate transformations +description: > + Flux's aggregate transformations take values from an input table and aggregate them in some way. + Output tables contain a single row with the aggregated value. aliases: - /v2.0/reference/flux/functions/transformations/aggregates - /v2.0/reference/flux/functions/built-in/transformations/aggregates/ @@ -16,8 +18,8 @@ related: - /v2.0/query-data/flux/window-aggregate/ --- -Flux's built-in aggregate functions take values from an input table and aggregate them in some way. -The output table contains a single row with the aggregated value. +Flux's built-in aggregate transformations take values from an input tables and aggregate them in some way. +Output tables contain a single row with the aggregated value. Aggregate operations output a table for every input table they receive. You must provide a column to aggregate. diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/chandemomentumoscillator.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/chandemomentumoscillator.md similarity index 85% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/chandemomentumoscillator.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/chandemomentumoscillator.md index e3e03218a..80a28bf23 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/chandemomentumoscillator.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/chandemomentumoscillator.md @@ -5,11 +5,12 @@ description: > developed by Tushar Chande. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/chandemomentumoscillator/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/chandemomentumoscillator/ menu: v2_0_ref: name: chandeMomentumOscillator - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - https://docs.influxdata.com/influxdb/latest/query_language/functions/#triple-exponential-moving-average, InfluxQL CHANDE_MOMENTUM_OSCILLATOR() --- @@ -17,7 +18,7 @@ related: The `chandeMomentumOscillator()` function applies the technical momentum indicator developed by Tushar Chande. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js chandeMomentumOscillator( @@ -45,10 +46,16 @@ Defaults to `["_value"]`. _**Data type: Array of Strings**_ +## Output tables +For each input table with `x` rows, `chandeMomentumOscillator()` outputs a table +with `x - n` rows. + ## Examples #### Table transformation with a ten point Chande Momentum Oscillator +{{< flex >}} +{{% flex-content %}} ###### Input table | _time | _value | |:-----:|:------:| @@ -81,7 +88,9 @@ _**Data type: Array of Strings**_ | 0027 | 3 | | 0028 | 2 | | 0029 | 1 | +{{% /flex-content %}} +{{% flex-content %}} ###### Query ```js // ... @@ -110,3 +119,5 @@ _**Data type: Array of Strings**_ | 0027 | -100 | | 0028 | -100 | | 0029 | -100 | +{{% /flex-content %}} +{{< /flex >}} diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/cov.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/cov.md similarity index 90% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/cov.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/cov.md index af138115a..6cf522572 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/cov.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/cov.md @@ -4,17 +4,18 @@ description: The `cov()` function computes the covariance between two streams by aliases: - /v2.0/reference/flux/functions/transformations/aggregates/cov - /v2.0/reference/flux/functions/built-in/transformations/aggregates/cov/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/cov/ menu: v2_0_ref: name: cov - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 --- The `cov()` function computes the covariance between two streams by first joining the streams, then performing the covariance operation. -_**Function type:** Aggregate +_**Function type:** Transformation_ _**Output data type:** Float_ ```js diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/covariance.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/covariance.md similarity index 86% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/covariance.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/covariance.md index f4e7ecbbc..7760f859b 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/covariance.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/covariance.md @@ -4,16 +4,17 @@ description: The `covariance()` function computes the covariance between two col aliases: - /v2.0/reference/flux/functions/transformations/aggregates/covariance - /v2.0/reference/flux/functions/built-in/transformations/aggregates/covariance/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/covariance/ menu: v2_0_ref: name: covariance - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 --- The `covariance()` function computes the covariance between two columns. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md index 21a161c62..4b3a4c54d 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md @@ -32,9 +32,6 @@ derivative( ) ``` -#### Output tables -For each input table with `n` rows, `derivative()` outputs a table with `n - 1` rows. - ## Parameters ### unit @@ -61,6 +58,9 @@ Defaults to `"_time"`. _**Data type:** String_ +## Output tables +For each input table with `n` rows, `derivative()` outputs a table with `n - 1` rows. + ## Examples ```js from(bucket: "example-bucket") diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md index 9f5e6c903..62948590f 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/difference.md @@ -29,9 +29,6 @@ difference( ) ``` -#### Output tables -For each input table with `n` rows, `difference()` outputs a table with `n - 1` rows. - ## Parameters ### nonNegative @@ -60,6 +57,8 @@ _**Data type:** Boolean_ - Some value `v` minus `null` is `v` minus the last non-null value seen before `v`; or `null` if `v` is the first non-null value seen. +## Output tables +For each input table with `n` rows, `difference()` outputs a table with `n - 1` rows. ## Examples diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/doubleema.md similarity index 83% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/doubleema.md index 54799e1e1..edf424696 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/doubleema.md @@ -6,16 +6,17 @@ description: > the rate of `exponentialMovingAverage()`. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ menu: v2_0_ref: name: doubleEMA - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#double-exponential-moving-average, InfluxQL DOUBLE_EXPONENTIAL_MOVING_AVERAGE() --- @@ -23,7 +24,7 @@ The `doubleEMA()` function calculates the exponential moving average of values i the `_value` column grouped into `n` number of points, giving more weight to recent data at double the rate of [`exponentialMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/). -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js doubleEMA(n: 5) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage.md similarity index 84% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage.md index 960768f25..cbd7d8b32 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage.md @@ -5,16 +5,17 @@ description: > in the `_value` column grouped into `n` number of points, giving more weight to recent data. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ menu: v2_0_ref: name: exponentialMovingAverage - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/tripleema/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#exponential-moving-average, InfluxQL EXPONENTIAL_MOVING_AVERAGE() --- diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/holtwinters.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/holtwinters.md similarity index 95% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/holtwinters.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/holtwinters.md index 7ad44ac11..75e855131 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/holtwinters.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/holtwinters.md @@ -5,18 +5,19 @@ description: > aliases: - /v2.0/reference/flux/functions/transformations/aggregates/holtwinters - /v2.0/reference/flux/functions/built-in/transformations/aggregates/holtwinters/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/holtwinters/ menu: v2_0_ref: name: holtWinters - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters, InfluxQL HOLT_WINTERS() --- The `holtWinters()` function applies the Holt-Winters forecasting method to input tables. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/increase.md similarity index 80% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/increase.md index c1eba9af5..1481b6737 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/increase.md @@ -6,11 +6,12 @@ description: > aliases: - /v2.0/reference/flux/functions/transformations/aggregates/increase - /v2.0/reference/flux/functions/built-in/transformations/aggregates/increase/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/ menu: v2_0_ref: name: increase - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - /v2.0/query-data/flux/increase/ --- @@ -22,7 +23,7 @@ when they hit a threshold or are reset. In the case of a wrap/reset, we can assume that the absolute delta between two points will be at least their non-negative difference. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js @@ -37,6 +38,9 @@ Defaults to `["_value"]`. _**Data type:** Array of strings_ +## Output tables +For each input table with `n` rows, `derivative()` outputs a table with `n - 1` rows. + ## Examples ```js from(bucket: "example-bucket") @@ -48,6 +52,8 @@ from(bucket: "example-bucket") |> increase() ``` +{{< flex >}} +{{% flex-content %}} Given the following input table: | _time | _value | @@ -56,7 +62,8 @@ Given the following input table: | 00002 | 5 | | 00003 | 3 | | 00004 | 4 | - +{{% /flex-content %}} +{{% flex-content %}} `increase()` produces the following table: | _time | _value | @@ -64,6 +71,8 @@ Given the following input table: | 00002 | 4 | | 00003 | 4 | | 00004 | 5 | +{{% /flex-content %}} +{{< /flex >}} ## Function definition ```js diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmansama.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmansama.md similarity index 87% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmansama.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmansama.md index 2d76e185d..fcc99a883 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmansama.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmansama.md @@ -5,20 +5,21 @@ description: > using values in an input table. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/kaufmansama/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmansama/ menu: v2_0_ref: name: kaufmansAMA - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmanser/ + - /v2.0/reference/flux/stdlib/built-in/transformations/kaufmanser/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#kaufmans-adaptive-moving-average, InfluxQL KAUFMANS_ADAPTIVE_MOVING_AVERAGE() --- The `kaufmansAMA()` function calculates the Kaufman's Adaptive Moving Average (KAMA) using values in an input table. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js kaufmansAMA( diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmanser.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmanser.md similarity index 86% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmanser.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmanser.md index cac7b51c2..87787238d 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmanser.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/kaufmanser.md @@ -5,13 +5,14 @@ description: > values in an input table. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/kaufmanser/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmanser/ menu: v2_0_ref: name: kaufmansER - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/kaufmansama/ + - /v2.0/reference/flux/stdlib/built-in/transformations/kaufmansama/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#kaufmans-efficiency-ratio, InfluxQL KAUFMANS_EFFICIENCY_RATIO() --- @@ -19,7 +20,7 @@ The `kaufmansER()` function calculates the Kaufman's Efficiency Ratio (KER) usin values in an input table. The function operates on the `_value` column. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js kaufmansER(n: 10) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/movingaverage.md similarity index 77% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/movingaverage.md index cd8f97020..1fe3130ca 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/movingaverage.md @@ -4,24 +4,25 @@ description: > The `movingAverage()` function calculates the mean of values grouped into `n` number of points. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/movingaverage/ + - /v2.0/reference/flux/functions/built-in/transformations/movingaverage/ menu: v2_0_ref: name: movingAverage - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - /v2.0/query-data/flux/moving-average/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/tripleema/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#moving-average, InfluxQL MOVING_AVERAGE() --- The `movingAverage()` function calculates the mean of values in the `_values` column grouped into `n` number of points. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js movingAverage(n: 5) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/pearsonr.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/pearsonr.md similarity index 89% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/pearsonr.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/pearsonr.md index f5e4bc776..c3ac9d936 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/pearsonr.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/pearsonr.md @@ -4,17 +4,18 @@ description: The `pearsonr()` function computes the Pearson R correlation coeffi aliases: - /v2.0/reference/flux/functions/transformations/aggregates/pearsonr - /v2.0/reference/flux/functions/built-in/transformations/aggregates/pearsonr/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/pearsonr/ menu: v2_0_ref: name: pearsonr - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 --- The `pearsonr()` function computes the Pearson R correlation coefficient between two streams by first joining the streams, then performing the covariance operation normalized to compute R. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ _**Output data type:** Float_ ```js diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/relativestrengthindex.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/relativestrengthindex.md similarity index 82% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/relativestrengthindex.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/relativestrengthindex.md index 58a8cb856..42998011c 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/relativestrengthindex.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/relativestrengthindex.md @@ -5,22 +5,23 @@ description: > values in an input table. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/relativestrengthindex/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/relativestrengthindex/ menu: v2_0_ref: name: relativeStrengthIndex - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#relative-strength-index, InfluxQL RELATIVE_STRENGTH_INDEX() --- The `relativeStrengthIndex()` function measures the relative speed and change of values in an input table. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js relativeStrengthIndex( @@ -50,6 +51,10 @@ Columns to operate on. _Defaults to `["_value"]`_. _**Data type:** Array of Strings_ +## Output tables +For each input table with `x` rows, `relativeStrengthIndex()` outputs a table +with `x - n` rows. + ## Examples #### Calculate a five point relative strength index @@ -61,6 +66,8 @@ from(bucket: "example-bucket"): #### Table transformation with a ten point RSI +{{< flex >}} +{{% flex-content %}} ###### Input table: | _time | A | B | tag | |:-----:|:----:|:----:|:---:| @@ -82,7 +89,8 @@ from(bucket: "example-bucket"): | 0016 | 16 | 16 | tv | | 0017 | 17 | null | tv | | 0018 | 18 | 17 | tv | - +{{% /flex-content %}} +{{% flex-content %}} ###### Query: ```js // ... @@ -103,3 +111,5 @@ from(bucket: "example-bucket"): | 0016 | 90 | 90 | tv | | 0017 | 81 | 90 | tv | | 0018 | 72.9 | 81 | tv | +{{% flex-content %}} +{{< /flex >}} diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage.md similarity index 82% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage.md index 2d1b0be01..e65913828 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage.md @@ -5,23 +5,24 @@ description: > range at a specified frequency. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ menu: v2_0_ref: name: timedMovingAverage - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/tripleema/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#moving-average, InfluxQL MOVING_AVERAGE() --- The `timedMovingAverage()` function calculates the mean of values in a defined time range at a specified frequency. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js timedMovingAverage( diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/tripleema.md similarity index 85% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/tripleema.md index 140882c33..9810b3316 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/tripleema.md @@ -6,16 +6,17 @@ description: > than `exponentialMovingAverage()` and `doubleEMA()`. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ menu: v2_0_ref: name: tripleEMA - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#triple-exponential-moving-average, InfluxQL TRIPLE_EXPONENTIAL_MOVING_AVERAGE() --- @@ -25,7 +26,7 @@ data with less lag than [`exponentialMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/) and [`doubleEMA()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/). -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js tripleEMA(n: 5) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleexponentialderivative.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/tripleexponentialderivative.md similarity index 83% rename from content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleexponentialderivative.md rename to content/v2.0/reference/flux/stdlib/built-in/transformations/tripleexponentialderivative.md index 9d6aee924..1ac8d5bc3 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleexponentialderivative.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/tripleexponentialderivative.md @@ -5,18 +5,19 @@ description: > derivative (TRIX) of input tables using `n` points. aliases: - /v2.0/reference/flux/functions/built-in/transformations/aggregates/tripleexponentialderivative/ + - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleexponentialderivative/ menu: v2_0_ref: name: tripleExponentialDerivative - parent: built-in-aggregates -weight: 501 + parent: built-in-transformations +weight: 402 v2.0/tags: [technical analysis] related: - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/tripleema/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/ - - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/doubleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/tripleema/ + - /v2.0/reference/flux/stdlib/built-in/transformations/timedmovingaverage/ + - /v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/ - https://docs.influxdata.com/influxdb/latest/query_language/functions/#triple-exponential-derivative, InfluxQL TRIPLE_EXPONENTIAL_DERIVATIVE() --- @@ -24,7 +25,7 @@ The `tripleExponentialDerivative()` function calculates a triple exponential derivative ([TRIX](https://en.wikipedia.org/wiki/Trix_(technical_analysis))) of input tables using `n` points. -_**Function type:** Aggregate_ +_**Function type:** Transformation_ ```js tripleExponentialDerivative(n: 5) From ec3e1f8ea336c4cc1cbb73517c13b2671101fc17 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 16:02:01 -0600 Subject: [PATCH 16/55] typo fix in aggregate fn landing page --- .../flux/stdlib/built-in/transformations/aggregates/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md index fea978837..0a9435059 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/_index.md @@ -18,7 +18,7 @@ related: - /v2.0/query-data/flux/window-aggregate/ --- -Flux's built-in aggregate transformations take values from an input tables and aggregate them in some way. +Flux's built-in aggregate transformations take values from an input table and aggregate them in some way. Output tables contain a single row with the aggregated value. Aggregate operations output a table for every input table they receive. From 0f09dd6b1fe50dc3ced1687b9276a6051cc82980 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 04:56:50 -0600 Subject: [PATCH 17/55] updated sql athena changes to address PR feedback --- content/v2.0/query-data/flux/sql.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/query-data/flux/sql.md b/content/v2.0/query-data/flux/sql.md index b7b4d9e0d..850d0a074 100644 --- a/content/v2.0/query-data/flux/sql.md +++ b/content/v2.0/query-data/flux/sql.md @@ -5,7 +5,7 @@ list_title: Query SQL data description: > The Flux `sql` package provides functions for working with SQL data sources. Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, - SQLite, Microsoft SQL Server, Amazon Athena. + SQLite, Microsoft SQL Server, and Amazon Athena. v2.0/tags: [query, flux, sql] menu: v2_0: From 49eade32800fd665d3c2bc491b09e3379729f68b Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 05:26:19 -0600 Subject: [PATCH 18/55] update date.truncate with support for duration values --- .../reference/flux/stdlib/date/truncate.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index 762cfffcd..318b3a3ce 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -31,7 +31,7 @@ date.truncate( ### t The time to operate on. -_**Data type:** Time_ +_**Data type:** Time | Duration_ ### unit The unit of time to truncate to. @@ -44,6 +44,8 @@ For example: `1s`, `1m`, `1h`. {{% /note %}} ## Examples + +##### Truncate time values ```js import "date" @@ -57,3 +59,20 @@ date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1h) // Returns 2019-06-03T13:00:00.000000000Z ``` + +##### Truncate time values using durations +```js +import "date" + +option now = () => 2020-01-01T00:00:00Z + +date.truncate(t: -30s, unit: 1s) +// Returns 2019-12-31T23:59:30.000000000Z + +date.truncate(t: -1m, unit: 1m) +// Returns 2019-12-31T23:59:00.000000000Z + +date.truncate(t: -1h, unit: 1h) +// Returns 2019-12-31T23:00:00.000000000Z + +``` From 53662578153eab0a2bb7c4681486bfaa23a39f47 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 05:30:19 -0600 Subject: [PATCH 19/55] removed unnecessary newlines from data.truncate examples --- content/v2.0/reference/flux/stdlib/date/truncate.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index 318b3a3ce..e4805a24e 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -57,7 +57,6 @@ date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1m) date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1h) // Returns 2019-06-03T13:00:00.000000000Z - ``` ##### Truncate time values using durations @@ -74,5 +73,4 @@ date.truncate(t: -1m, unit: 1m) date.truncate(t: -1h, unit: 1h) // Returns 2019-12-31T23:00:00.000000000Z - ``` From 5a384deafb3055ca7ba317e6aef967c8f25aa333 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 11:41:23 -0600 Subject: [PATCH 20/55] updated now time in date.truncate duration examples --- content/v2.0/reference/flux/stdlib/date/truncate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index e4805a24e..9263d50b1 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -63,7 +63,7 @@ date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1h) ```js import "date" -option now = () => 2020-01-01T00:00:00Z +option now = () => 2020-01-01T00:00:30.500000000Z date.truncate(t: -30s, unit: 1s) // Returns 2019-12-31T23:59:30.000000000Z From a548088634a62384b3676b1ab46787f2011a82b7 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 11:44:03 -0600 Subject: [PATCH 21/55] updated description of t param in date.truncate --- content/v2.0/reference/flux/stdlib/date/truncate.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index 9263d50b1..43645f815 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -30,6 +30,8 @@ date.truncate( ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. _**Data type:** Time | Duration_ From 40f4ed3a3c6e9d0b27e70fb26815dd22e6b54b2b Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 14:11:22 -0600 Subject: [PATCH 22/55] updated other date pkg functions with durations and examples --- .../flux/stdlib/built-in/misc/now.md | 12 ++++++++- .../v2.0/reference/flux/stdlib/date/hour.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/microsecond.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/millisecond.md | 26 ++++++++++++++++++- .../v2.0/reference/flux/stdlib/date/month.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/monthday.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/nanosecond.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/quarter.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/truncate.md | 18 ++++++------- .../reference/flux/stdlib/date/weekday.md | 26 ++++++++++++++++++- .../v2.0/reference/flux/stdlib/date/year.md | 26 ++++++++++++++++++- .../reference/flux/stdlib/date/yearday.md | 26 ++++++++++++++++++- 12 files changed, 270 insertions(+), 20 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/built-in/misc/now.md b/content/v2.0/reference/flux/stdlib/built-in/misc/now.md index bcc5048c8..3b38aaf35 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/misc/now.md +++ b/content/v2.0/reference/flux/stdlib/built-in/misc/now.md @@ -12,7 +12,7 @@ related: - /v2.0/reference/flux/stdlib/system/time/ --- -The `now()` function returns the current time (UTC). +The `now()` function returns the current time (UTC) or the time defined in the `now` option. _**Function type:** Date/Time_ _**Output data type:** Time_ @@ -22,11 +22,21 @@ now() ``` ## Examples + +##### Use the current UTC time as a query boundary ```js data |> range(start: -10h, stop: now()) ``` +##### Return the now option time +```js +option now = () => 2020-01-01T00:00:00Z + +now() +// Returns 2020-01-01T00:00:00.000000000Z +``` + {{% note %}} #### now() vs system.time() `now()` returns the current UTC time. diff --git a/content/v2.0/reference/flux/stdlib/date/hour.md b/content/v2.0/reference/flux/stdlib/date/hour.md index efdf143e7..02bde42e7 100644 --- a/content/v2.0/reference/flux/stdlib/date/hour.md +++ b/content/v2.0/reference/flux/stdlib/date/hour.md @@ -29,5 +29,29 @@ date.hour(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the hour of a time value +```js +import "date" + +date.hour(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 12 +``` + +##### Return the hour of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.hour(t: -8h) + +// Returns 4 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/microsecond.md b/content/v2.0/reference/flux/stdlib/date/microsecond.md index bd4cbba76..3b6def9d0 100644 --- a/content/v2.0/reference/flux/stdlib/date/microsecond.md +++ b/content/v2.0/reference/flux/stdlib/date/microsecond.md @@ -29,5 +29,29 @@ date.microsecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the microsecond of a time value +```js +import "date" + +date.microsecond(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 293534 +``` + +##### Return the microsecond of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.microsecond(t: -1890us) + +// Returns 291644 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/millisecond.md b/content/v2.0/reference/flux/stdlib/date/millisecond.md index 6d7a6285e..31496d092 100644 --- a/content/v2.0/reference/flux/stdlib/date/millisecond.md +++ b/content/v2.0/reference/flux/stdlib/date/millisecond.md @@ -29,5 +29,29 @@ date.millisecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the millisecond of a time value +```js +import "date" + +date.millisecond(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 293 +``` + +##### Return the millisecond of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.millisecond(t: -150ms) + +// Returns 143 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/month.md b/content/v2.0/reference/flux/stdlib/date/month.md index 6612dedd4..01330e261 100644 --- a/content/v2.0/reference/flux/stdlib/date/month.md +++ b/content/v2.0/reference/flux/stdlib/date/month.md @@ -29,5 +29,29 @@ date.month(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the month of a time value +```js +import "date" + +date.month(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 2 +``` + +##### Return the month of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.month(t: -3mo) + +// Returns 11 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/monthday.md b/content/v2.0/reference/flux/stdlib/date/monthday.md index fabc7d31b..36684343f 100644 --- a/content/v2.0/reference/flux/stdlib/date/monthday.md +++ b/content/v2.0/reference/flux/stdlib/date/monthday.md @@ -29,5 +29,29 @@ date.monthDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the day of the month for a time value +```js +import "date" + +date.monthDay(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 11 +``` + +##### Return the day of the month for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.monthDay(t: -8d) + +// Returns 3 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/nanosecond.md b/content/v2.0/reference/flux/stdlib/date/nanosecond.md index 9d05b1f72..846aa0129 100644 --- a/content/v2.0/reference/flux/stdlib/date/nanosecond.md +++ b/content/v2.0/reference/flux/stdlib/date/nanosecond.md @@ -29,5 +29,29 @@ date.nanosecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the nanosecond for a time value +```js +import "date" + +date.nanosecond(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 293534940Z +``` + +##### Return the nanosecond for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.nanosecond(t: -2111984ns) + +// Returns 291422956 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/quarter.md b/content/v2.0/reference/flux/stdlib/date/quarter.md index a2f05b0f9..5a225a4a9 100644 --- a/content/v2.0/reference/flux/stdlib/date/quarter.md +++ b/content/v2.0/reference/flux/stdlib/date/quarter.md @@ -29,5 +29,29 @@ date.quarter(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the quarter for a time value +```js +import "date" + +date.quarter(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 1 +``` + +##### Return the quarter for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.quarter(t: -7mo) + +// Returns 3 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index 43645f815..f2ef1cb3b 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -51,14 +51,14 @@ For example: `1s`, `1m`, `1h`. ```js import "date" -date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1s) -// Returns 2019-06-03T13:59:01.000000000Z +date.truncate(t: 2019-06-03T13:59:01.000000000Z, unit: 1s) +// Returns 2019-06-03T13:59:01.000000000Z -date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1m) -// Returns 2019-06-03T13:59:00.000000000Z +date.truncate(t: 2019-06-03T13:59:01.000000000Z, unit: 1m) +// Returns 2019-06-03T13:59:00.000000000Z -date.truncate(t: "2019-06-03T13:59:01.000000000Z", unit: 1h) -// Returns 2019-06-03T13:00:00.000000000Z +date.truncate(t: 2019-06-03T13:59:01.000000000Z, unit: 1h) +// Returns 2019-06-03T13:00:00.000000000Z ``` ##### Truncate time values using durations @@ -68,11 +68,11 @@ import "date" option now = () => 2020-01-01T00:00:30.500000000Z date.truncate(t: -30s, unit: 1s) -// Returns 2019-12-31T23:59:30.000000000Z +// Returns 2019-12-31T23:59:30.000000000Z date.truncate(t: -1m, unit: 1m) -// Returns 2019-12-31T23:59:00.000000000Z +// Returns 2019-12-31T23:59:00.000000000Z date.truncate(t: -1h, unit: 1h) -// Returns 2019-12-31T23:00:00.000000000Z +// Returns 2019-12-31T23:00:00.000000000Z ``` diff --git a/content/v2.0/reference/flux/stdlib/date/weekday.md b/content/v2.0/reference/flux/stdlib/date/weekday.md index 6e6fdb18c..0afcf7c67 100644 --- a/content/v2.0/reference/flux/stdlib/date/weekday.md +++ b/content/v2.0/reference/flux/stdlib/date/weekday.md @@ -29,5 +29,29 @@ date.weekDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the day of the week for a time value +```js +import "date" + +date.weekDay(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 2 +``` + +##### Return the day of the week for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.weekDay(t: -84h) + +// Returns 6 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/year.md b/content/v2.0/reference/flux/stdlib/date/year.md index f911a5976..fd452ed2f 100644 --- a/content/v2.0/reference/flux/stdlib/date/year.md +++ b/content/v2.0/reference/flux/stdlib/date/year.md @@ -27,5 +27,29 @@ date.year(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the year for a time value +```js +import "date" + +date.year(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 2020 +``` + +##### Return the year for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.year(t: -14y) + +// Returns 2006 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/yearday.md b/content/v2.0/reference/flux/stdlib/date/yearday.md index 20df57afe..a7ff048fb 100644 --- a/content/v2.0/reference/flux/stdlib/date/yearday.md +++ b/content/v2.0/reference/flux/stdlib/date/yearday.md @@ -29,5 +29,29 @@ date.yearDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the day of the year for a time value +```js +import "date" + +date.yearDay(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 42 +``` + +##### Return the day of the year for a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.yearDay(t: -1mo) + +// Returns 11 +``` From 71a2903bd60977e0248de9e309308edc05f92880 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 24 Jun 2020 15:51:28 -0600 Subject: [PATCH 23/55] added duration support and examples to more data functions --- .../v2.0/reference/flux/stdlib/date/minute.md | 26 ++++++++++++++++++- .../v2.0/reference/flux/stdlib/date/second.md | 26 ++++++++++++++++++- .../v2.0/reference/flux/stdlib/date/week.md | 26 ++++++++++++++++++- 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/date/minute.md b/content/v2.0/reference/flux/stdlib/date/minute.md index 5e5ec0b34..d1e9db92c 100644 --- a/content/v2.0/reference/flux/stdlib/date/minute.md +++ b/content/v2.0/reference/flux/stdlib/date/minute.md @@ -29,5 +29,29 @@ date.minute(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the minute of a time value +```js +import "date" + +date.minute(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 21 +``` + +##### Return the minute of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.minute(t: -45m) + +// Returns 36 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/second.md b/content/v2.0/reference/flux/stdlib/date/second.md index e7cc28f7f..33493d457 100644 --- a/content/v2.0/reference/flux/stdlib/date/second.md +++ b/content/v2.0/reference/flux/stdlib/date/second.md @@ -29,5 +29,29 @@ date.second(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the second of a time value +```js +import "date" + +date.second(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 3 +``` + +##### Return the second of a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.second(t: -50s) + +// Returns 13 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/week.md b/content/v2.0/reference/flux/stdlib/date/week.md index dec8bddec..d508e7c10 100644 --- a/content/v2.0/reference/flux/stdlib/date/week.md +++ b/content/v2.0/reference/flux/stdlib/date/week.md @@ -29,5 +29,29 @@ date.week(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. +Use an absolute time or relative duration. +Durations are relative to `now()`. -_**Data type:** Time_ +_**Data type:** Time | Duration_ + +## Examples + +##### Return the week of the year +```js +import "date" + +date.week(t: 2020-02-11T12:21:03.293534940Z) + +// Returns 7 +``` + +##### Return the week of the year using a relative duration +```js +import "date" + +option now = () => 2020-02-11T12:21:03.293534940Z + +date.week(t: -12d) + +// Returns 5 +``` From 6e9449b1a84d56bb39608c0c226b56733d05ab2b Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 26 Jun 2020 10:49:07 -0600 Subject: [PATCH 24/55] hotfix: remove warning about templates not supporting tables --- content/v2.0/influxdb-templates/create.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/v2.0/influxdb-templates/create.md b/content/v2.0/influxdb-templates/create.md index 83a65c16b..658bff54a 100644 --- a/content/v2.0/influxdb-templates/create.md +++ b/content/v2.0/influxdb-templates/create.md @@ -50,11 +50,6 @@ In **InfluxDB Cloud**, your user account is an organization. 4. Export the template _(see [below](#export-a-template))_. -{{% warn %}} -InfluxDB templates do not support the [table visualization type](/v2.0/visualize-data/visualization-types/table/). -Dashboard cells that use table visualization are not included in exported templates. -{{% /warn %}} - ## Export a template Do one of the following to export a template: From 276969340519996c4646035a817b1f31a6f94caf Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 29 Jun 2020 13:37:26 -0600 Subject: [PATCH 25/55] add the ability to set custom influxdb urls, resolves #1116 --- assets/js/influxdb-url.js | 49 +++++++++++++++++-- ...cloud-selector.scss => _url-selector.scss} | 36 ++++++++++++++ assets/styles/styles-default.scss | 2 +- assets/styles/themes/_theme-dark.scss | 3 ++ assets/styles/themes/_theme-light.scss | 3 ++ data/influxdb_urls.yml | 2 + .../partials/footer/influxdb-url-modal.html | 35 +++++++++---- 7 files changed, 115 insertions(+), 15 deletions(-) rename assets/styles/layouts/{_cloud-selector.scss => _url-selector.scss} (82%) diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index 7d9e6c4fb..83e646784 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -58,7 +58,18 @@ function storeUrl(newUrl, prevUrl) { Cookies.set('influxdb_url', newUrl) } -// Preserver URLs in codeblocks that come just after or are inside a div +// Store custom URL session cookie – influxdb_custom_url +function storeCustomUrl(customUrl) { + Cookies.set('influxdb_custom_url', customUrl) + $('input#custom[type=radio]').val(customUrl) +} + +// Remove custom URL session cookie – influxdb_custom_url +function removeCustomUrl() { + Cookies.remove('influxdb_custom_url') +} + +// Preserve URLs in codeblocks that come just after or are inside a div // with the class, .keep-url function addPreserve() { $('.keep-url').each(function () { @@ -88,9 +99,6 @@ updateUrls(defaultUrl, getUrl()) // Append URL selector buttons to code blocks appendUrlSelector(getUrl()) -// Set active radio button on page load -setRadioButton(getUrl()) - // Update URLs whenever you focus on the browser tab $(window).focus(function() { updateUrls(getPrevUrl(), getUrl()) @@ -115,3 +123,36 @@ $('button.url-trigger, #callout-url-selector .close').click(function() { $('#callout-url-selector').fadeOut(200) } }) + +// Place cursor in custom URL field when custom radio is selected +$('input#custom[type="radio"]').click(function(e) { + $('input#custom-url-field').focus() +}) + +$("#custom-url").submit(function(e) { + e.preventDefault(); + $('#modal-close').trigger('click') +}); + +// Store the custom InfluxDB URL when exiting the field +$('#custom-url-field').blur(function() { + custUrl = $(this).val() + if (custUrl.length > 0 ) { + storeCustomUrl(custUrl) + updateUrls(getUrl(), custUrl) + storeUrl(custUrl, getPrevUrl()) + } else { + $('input#custom').val('http://example.com:8080') + removeCustomUrl(); + $('input[name="influxdb-loc"][value="' + defaultUrl + '"]').trigger('click') + } +}) + +// Populate the custom InfluxDB URL field on page load +if ( Cookies.get('influxdb_custom_url') != undefined ) { + $('input#custom').val(Cookies.get('influxdb_custom_url')) + $('#custom-url-field').val(Cookies.get('influxdb_custom_url')) +} + +// Set active radio button on page load +setRadioButton(getUrl()) diff --git a/assets/styles/layouts/_cloud-selector.scss b/assets/styles/layouts/_url-selector.scss similarity index 82% rename from assets/styles/layouts/_cloud-selector.scss rename to assets/styles/layouts/_url-selector.scss index f6e5d8ff7..e3d7bd521 100644 --- a/assets/styles/layouts/_cloud-selector.scss +++ b/assets/styles/layouts/_url-selector.scss @@ -136,6 +136,42 @@ } } + li.custom { + display: flex; + align-items: center; + } + #custom-url { + display: inline-block; + width: 100%; + padding-left: .5rem; + input { + &#custom-url-field { + font-family: $rubik; + font-weight: $medium; + background: $modal-field-bg; + border-radius: $radius; + border: 1px solid $sidebar-search-bg; + padding: .5em; + width: 100%; + color: $sidebar-search-text; + transition-property: border, box-shadow; + transition-duration: .2s; + box-shadow: 2px 2px 6px $sidebar-search-shadow; + &:focus { + outline: none; + border-color: $sidebar-search-highlight; + box-shadow: 1px 1px 10px rgba($sidebar-search-highlight, .5); + border-radius: $radius; + } + &::placeholder { + color: rgba($sidebar-search-text, .45); + font-weight: normal; + font-style: italic; + } + } + } + } + .radio { position: relative; display: inline-block; diff --git a/assets/styles/styles-default.scss b/assets/styles/styles-default.scss index 97fd6d5cd..46f68bf40 100644 --- a/assets/styles/styles-default.scss +++ b/assets/styles/styles-default.scss @@ -22,5 +22,5 @@ "layouts/algolia-search-overrides", "layouts/landing", "layouts/error-page", - "layouts/cloud-selector", + "layouts/url-selector", "layouts/feature-callouts"; diff --git a/assets/styles/themes/_theme-dark.scss b/assets/styles/themes/_theme-dark.scss index d4e35d921..d91f8ce91 100644 --- a/assets/styles/themes/_theme-dark.scss +++ b/assets/styles/themes/_theme-dark.scss @@ -182,6 +182,9 @@ $tooltip-color-alt: $br-chartreuse; $tooltip-bg: $br-chartreuse; $tooltip-text: $g2-kevlar; +// URL Modal colors +$modal-field-bg: $g1-raven; + // SVG colors $svg-table-header: $g6-smoke; $svg-table-stroke: $g0-obsidian; diff --git a/assets/styles/themes/_theme-light.scss b/assets/styles/themes/_theme-light.scss index eb3962855..ade4a6283 100644 --- a/assets/styles/themes/_theme-light.scss +++ b/assets/styles/themes/_theme-light.scss @@ -182,6 +182,9 @@ $tooltip-color-alt: $p-twilight !default; $tooltip-bg: $p-amethyst !default; $tooltip-text: $g20-white !default; +// URL Modal colors +$modal-field-bg: $g20-white !default; + // SVG colors $svg-table-header: $g15-platinum !default; $svg-table-stroke: $g7-graphite !default; diff --git a/data/influxdb_urls.yml b/data/influxdb_urls.yml index 202b9fd73..bb1b48fd2 100644 --- a/data/influxdb_urls.yml +++ b/data/influxdb_urls.yml @@ -5,6 +5,8 @@ oss: regions: - name: localhost:9999 url: http://localhost:9999 + - name: Custom + url: http://example.com:8080 cloud: product: InfluxDB Cloud diff --git a/layouts/partials/footer/influxdb-url-modal.html b/layouts/partials/footer/influxdb-url-modal.html index 97028500b..9b14f0ce5 100644 --- a/layouts/partials/footer/influxdb-url-modal.html +++ b/layouts/partials/footer/influxdb-url-modal.html @@ -14,16 +14,31 @@
{{ range .providers }}
-
{{ if .short_name}}{{ .short_name }}{{ else }}{{ .name }}{{ end }}
-
    - {{ range .regions }} -
  • - -
  • + {{ if eq .name "Custom" }} +
    Custom
    +
      +
    • + +
      + +
      +
    • +
    + {{ else }} +
    {{ if .short_name}}{{ .short_name }}{{ else }}{{ .name }}{{ end }}
    +
      + {{ range .regions }} +
    • + +
    • + {{ end }} {{ end }}
From e22dff45943fe3e555d7f74ef104b584811e7872 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 29 Jun 2020 13:52:54 -0600 Subject: [PATCH 26/55] added flux-0.70 release notes --- content/v2.0/reference/release-notes/flux.md | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/content/v2.0/reference/release-notes/flux.md b/content/v2.0/reference/release-notes/flux.md index 2a3232091..4bd6fd2d2 100644 --- a/content/v2.0/reference/release-notes/flux.md +++ b/content/v2.0/reference/release-notes/flux.md @@ -16,8 +16,25 @@ Though newer versions of Flux may be available, they will not be included with InfluxDB until the next InfluxDB v2.0 release._ {{% /note %}} -## v0.70.0 [unreleased] -_placholder_ +## v0.70.0 [2020-06-29] +### Features +- Update all `date` functions to accept time and duration types. +- Add [Microsoft Teams package](/v2.0/reference/flux/stdlib/contrib/teams/). +- Evaluate and store `now` in execution dependencies for `tableFind()`. +- Add `Timeable` constraint for time and duration types. +- Add [SQL Server support](/v2.0/reference/flux/stdlib/sql/from/#query-a-sql-server-database) to `sql` package. +- Add [Telegram package](/v2.0/reference/flux/stdlib/contrib/telegram/). +- Add [Amazon Athena support](/v2.0/reference/flux/stdlib/sql/from/#query-an-amazon-athena-database) to `sql` package. +- Add support for macOS builds. + +### Bug fixes +- Move semantic analysis to the finalize step. +- Fix check for stream equality. +- Fix the compiler's return type when `with` operator is used. +- Include `stdlib` Flux dependencies from the Flux `build.rs`. +- Include a hash of the sources for `libflux`. +- Flux test for [experimental `json.parse()`](/v2.0/reference/flux/stdlib/experimental/json/parse/). +- Reorder `go generate` call to `libflux` in `stdlib`. --- From 6ee959554c4a230048a878c27382fff4130294df Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 29 Jun 2020 16:36:31 -0600 Subject: [PATCH 27/55] updated custom url functionality --- assets/js/influxdb-url.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index 83e646784..dfa2d71b3 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -124,9 +124,9 @@ $('button.url-trigger, #callout-url-selector .close').click(function() { } }) -// Place cursor in custom URL field when custom radio is selected -$('input#custom[type="radio"]').click(function(e) { - $('input#custom-url-field').focus() +// Trigger radio button on custom URL field focus +$('input#custom-url-field').focus(function(e) { + $('input#custom[type="radio"]').trigger('click') }) $("#custom-url").submit(function(e) { From 7914a703dd43a34118bf03c65daee88af61b35a6 Mon Sep 17 00:00:00 2001 From: Kelly Date: Tue, 30 Jun 2020 09:15:48 -0700 Subject: [PATCH 28/55] fix numbering --- content/v2.0/visualize-data/dashboards/export-dashboard.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/v2.0/visualize-data/dashboards/export-dashboard.md b/content/v2.0/visualize-data/dashboards/export-dashboard.md index 4a0f8496a..31631991d 100644 --- a/content/v2.0/visualize-data/dashboards/export-dashboard.md +++ b/content/v2.0/visualize-data/dashboards/export-dashboard.md @@ -13,11 +13,9 @@ weight: 203 InfluxDB lets you export dashboards from the InfluxDB user interface (UI). -## Export a dashboard - 1. In the navigation menu on the left, select **Boards** (**Dashboards**). - {{< nav-icon "dashboards" >}} + {{< nav-icon "dashboards" >}} 2. Hover over a dashboard and click the gear icon (**{{< icon "gear" >}}**), and then select **Export**. From dabd5a7c0a9a3673df08dc4c63c43d1212bfff66 Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Tue, 30 Jun 2020 13:11:31 -0700 Subject: [PATCH 29/55] Remove img --- content/v2.0/organizations/buckets/view-buckets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/organizations/buckets/view-buckets.md b/content/v2.0/organizations/buckets/view-buckets.md index df3da8f86..0d0c93d7a 100644 --- a/content/v2.0/organizations/buckets/view-buckets.md +++ b/content/v2.0/organizations/buckets/view-buckets.md @@ -20,7 +20,7 @@ weight: 202 A list of buckets with their retention policies and IDs appears. 2. Click a bucket to open it in the **Data Explorer**. -3. Click the bucket ID to copy it to the clipboard. +3. Click the bucket ID to copy it to the clipboard. ## View buckets using the influx CLI From 9903286e6644f8062b53e51595599f95d8314ac8 Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Tue, 30 Jun 2020 13:11:58 -0700 Subject: [PATCH 30/55] Fix headings --- content/v2.0/organizations/buckets/view-buckets.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/v2.0/organizations/buckets/view-buckets.md b/content/v2.0/organizations/buckets/view-buckets.md index 0d0c93d7a..9d7eb0e54 100644 --- a/content/v2.0/organizations/buckets/view-buckets.md +++ b/content/v2.0/organizations/buckets/view-buckets.md @@ -11,7 +11,7 @@ weight: 202 ## View a list of buckets -## View buckets in the InfluxDB UI +### View buckets in the InfluxDB UI 1. In the navigation menu on the left, select **Data (Load Data)** > **Buckets**. @@ -20,9 +20,9 @@ weight: 202 A list of buckets with their retention policies and IDs appears. 2. Click a bucket to open it in the **Data Explorer**. -3. Click the bucket ID to copy it to the clipboard. +3. Click the bucket ID to copy it to the clipboard. -## View buckets using the influx CLI +### View buckets using the influx CLI Use the [`influx bucket list` command](/v2.0/reference/cli/influx/bucket/list) to view a buckets in an organization. From 2cf5f690477be4502afcf987abdf98d23e77d65d Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 30 Jun 2020 16:06:00 -0600 Subject: [PATCH 31/55] added http.pathEscape function, resolves #1165 --- .../reference/flux/stdlib/http/pathescape.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 content/v2.0/reference/flux/stdlib/http/pathescape.md diff --git a/content/v2.0/reference/flux/stdlib/http/pathescape.md b/content/v2.0/reference/flux/stdlib/http/pathescape.md new file mode 100644 index 000000000..f8b323c9f --- /dev/null +++ b/content/v2.0/reference/flux/stdlib/http/pathescape.md @@ -0,0 +1,44 @@ +--- +title: http.pathEscape() function +description: > + The `http.pathEscape()` function escapes special characters in a string (including `/`) + and replaces non-ASCII characters with hexadecimal representations (`%XX`). +v2_0_ref: + name: http.pathEscape + parent: HTTP +weight: 202 +--- + +The `http.pathEscape()` function escapes special characters in a string (including `/`) +and replaces non-ASCII characters with hexadecimal representations (`%XX`). + +_**Function type:** Transformation_ + +```js +import "http" + +http.pathEscape( + inputString: "/this/is/an/example-path.html" +) + +// Returns %2Fthis%2Fis%2Fan%2Fexample-path.html +``` + +## Parameters + +### inputString +The string to escape. + +_**Data type:** String_ + +## Examples + +##### URL-encode strings in a stream of tables +```js +import "http" + +data + |> map(fn: (r) => ({ r with + path: httpEscape(inputString: r.path) + })) +``` From 4fef50db7b2fb9f7ae15db04beae055ca0b2968e Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 30 Jun 2020 16:11:38 -0600 Subject: [PATCH 32/55] fixed frontmater in http.pathEscape doc --- content/v2.0/reference/flux/stdlib/http/pathescape.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/http/pathescape.md b/content/v2.0/reference/flux/stdlib/http/pathescape.md index f8b323c9f..536f19964 100644 --- a/content/v2.0/reference/flux/stdlib/http/pathescape.md +++ b/content/v2.0/reference/flux/stdlib/http/pathescape.md @@ -3,8 +3,9 @@ title: http.pathEscape() function description: > The `http.pathEscape()` function escapes special characters in a string (including `/`) and replaces non-ASCII characters with hexadecimal representations (`%XX`). -v2_0_ref: - name: http.pathEscape +menu: + v2_0_ref: + name: http.pathEscape parent: HTTP weight: 202 --- From 2271fb1b3af08049fdaadad4a13421055f6d196f Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 30 Jun 2020 16:31:42 -0600 Subject: [PATCH 33/55] added unix timestamp support to date functions, resolves #1163 --- .../v2.0/reference/flux/stdlib/date/hour.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/microsecond.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/millisecond.md | 14 ++++++++++++-- .../v2.0/reference/flux/stdlib/date/minute.md | 14 ++++++++++++-- .../v2.0/reference/flux/stdlib/date/month.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/monthday.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/nanosecond.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/quarter.md | 14 ++++++++++++-- .../v2.0/reference/flux/stdlib/date/second.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/truncate.md | 19 +++++++++++++++++-- .../v2.0/reference/flux/stdlib/date/week.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/weekday.md | 14 ++++++++++++-- .../v2.0/reference/flux/stdlib/date/year.md | 14 ++++++++++++-- .../reference/flux/stdlib/date/yearday.md | 14 ++++++++++++-- 14 files changed, 173 insertions(+), 28 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/date/hour.md b/content/v2.0/reference/flux/stdlib/date/hour.md index 02bde42e7..1475e1a1d 100644 --- a/content/v2.0/reference/flux/stdlib/date/hour.md +++ b/content/v2.0/reference/flux/stdlib/date/hour.md @@ -29,10 +29,11 @@ date.hour(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.hour(t: -8h) // Returns 4 ``` + +##### Return the hour of a nanosecond Unix timestamp +```js +import "date" + +date.hour(t: 1581423663293534940) + +// Returns 12 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/microsecond.md b/content/v2.0/reference/flux/stdlib/date/microsecond.md index 3b6def9d0..acadd5084 100644 --- a/content/v2.0/reference/flux/stdlib/date/microsecond.md +++ b/content/v2.0/reference/flux/stdlib/date/microsecond.md @@ -29,10 +29,11 @@ date.microsecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.microsecond(t: -1890us) // Returns 291644 ``` + +##### Return the microsecond of a nanosecond Unix timestamp +```js +import "date" + +date.microsecond(t: 1581423663293534940) + +// Returns 293534 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/millisecond.md b/content/v2.0/reference/flux/stdlib/date/millisecond.md index 31496d092..0febcb59b 100644 --- a/content/v2.0/reference/flux/stdlib/date/millisecond.md +++ b/content/v2.0/reference/flux/stdlib/date/millisecond.md @@ -29,10 +29,11 @@ date.millisecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.millisecond(t: -150ms) // Returns 143 ``` + +##### Return the millisecond of a nanosecond Unix timestamp +```js +import "date" + +date.millisecond(t: 1581423663293534940) + +// Returns 293 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/minute.md b/content/v2.0/reference/flux/stdlib/date/minute.md index d1e9db92c..2706460e6 100644 --- a/content/v2.0/reference/flux/stdlib/date/minute.md +++ b/content/v2.0/reference/flux/stdlib/date/minute.md @@ -29,10 +29,11 @@ date.minute(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.minute(t: -45m) // Returns 36 ``` + +##### Return the minute of a nanosecond Unix timestamp +```js +import "date" + +date.minute(t: 1581423663293534940) + +// Returns 21 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/month.md b/content/v2.0/reference/flux/stdlib/date/month.md index 01330e261..eaa2208fc 100644 --- a/content/v2.0/reference/flux/stdlib/date/month.md +++ b/content/v2.0/reference/flux/stdlib/date/month.md @@ -29,10 +29,11 @@ date.month(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.month(t: -3mo) // Returns 11 ``` + +##### Return the month of a nanosecond Unix timestamp +```js +import "date" + +date.month(t: 1581423663293534940) + +// Returns 2 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/monthday.md b/content/v2.0/reference/flux/stdlib/date/monthday.md index 36684343f..b1ac40d64 100644 --- a/content/v2.0/reference/flux/stdlib/date/monthday.md +++ b/content/v2.0/reference/flux/stdlib/date/monthday.md @@ -29,10 +29,11 @@ date.monthDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.monthDay(t: -8d) // Returns 3 ``` + +##### Return the day of the month for a nanosecond Unix timestamp +```js +import "date" + +date.monthDay(t: 1581423663293534940) + +// Returns 11 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/nanosecond.md b/content/v2.0/reference/flux/stdlib/date/nanosecond.md index 846aa0129..610ced7aa 100644 --- a/content/v2.0/reference/flux/stdlib/date/nanosecond.md +++ b/content/v2.0/reference/flux/stdlib/date/nanosecond.md @@ -29,10 +29,11 @@ date.nanosecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.nanosecond(t: -2111984ns) // Returns 291422956 ``` + +##### Return the nanosecond for a nanosecond Unix timestamp +```js +import "date" + +date.nanosecond(t: 1581423663293534940) + +// Returns 293534940Z +``` diff --git a/content/v2.0/reference/flux/stdlib/date/quarter.md b/content/v2.0/reference/flux/stdlib/date/quarter.md index 5a225a4a9..56edb7ed7 100644 --- a/content/v2.0/reference/flux/stdlib/date/quarter.md +++ b/content/v2.0/reference/flux/stdlib/date/quarter.md @@ -29,10 +29,11 @@ date.quarter(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.quarter(t: -7mo) // Returns 3 ``` + +##### Return the quarter for a nanosecond Unix timestamp +```js +import "date" + +date.quarter(t: 1581423663293534940) + +// Returns 1 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/second.md b/content/v2.0/reference/flux/stdlib/date/second.md index 33493d457..302700305 100644 --- a/content/v2.0/reference/flux/stdlib/date/second.md +++ b/content/v2.0/reference/flux/stdlib/date/second.md @@ -29,10 +29,11 @@ date.second(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.second(t: -50s) // Returns 13 ``` + +##### Return the second of a nanosecond Unix timestamp +```js +import "date" + +date.second(t: 1581423663293534940) + +// Returns 3 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index f2ef1cb3b..5f13e548b 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -30,10 +30,11 @@ date.truncate( ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ### unit The unit of time to truncate to. @@ -76,3 +77,17 @@ date.truncate(t: -1m, unit: 1m) date.truncate(t: -1h, unit: 1h) // Returns 2019-12-31T23:00:00.000000000Z ``` + +##### Truncate time values using nanosecond Unix timestamps +```js +import "date" + +date.truncate(t: 1559570341000000000, unit: 1s) +// Returns 2019-06-03T13:59:01.000000000Z + +date.truncate(t: 1559570341000000000, unit: 1m) +// Returns 2019-06-03T13:59:00.000000000Z + +date.truncate(t: 1559570341000000000, unit: 1h) +// Returns 2019-06-03T13:00:00.000000000Z +``` diff --git a/content/v2.0/reference/flux/stdlib/date/week.md b/content/v2.0/reference/flux/stdlib/date/week.md index d508e7c10..0eefcef9a 100644 --- a/content/v2.0/reference/flux/stdlib/date/week.md +++ b/content/v2.0/reference/flux/stdlib/date/week.md @@ -29,10 +29,11 @@ date.week(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.week(t: -12d) // Returns 5 ``` + +##### Return the week of the year using a nanosecond Unix timestamp +```js +import "date" + +date.week(t: 1581423663293534940) + +// Returns 7 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/weekday.md b/content/v2.0/reference/flux/stdlib/date/weekday.md index 0afcf7c67..437b01009 100644 --- a/content/v2.0/reference/flux/stdlib/date/weekday.md +++ b/content/v2.0/reference/flux/stdlib/date/weekday.md @@ -29,10 +29,11 @@ date.weekDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.weekDay(t: -84h) // Returns 6 ``` + +##### Return the day of the week for a nanosecond Unix timestamp +```js +import "date" + +date.weekDay(t: 1581423663293534940) + +// Returns 2 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/year.md b/content/v2.0/reference/flux/stdlib/date/year.md index fd452ed2f..3726c1cb8 100644 --- a/content/v2.0/reference/flux/stdlib/date/year.md +++ b/content/v2.0/reference/flux/stdlib/date/year.md @@ -27,10 +27,11 @@ date.year(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -53,3 +54,12 @@ date.year(t: -14y) // Returns 2006 ``` + +##### Return the year for a nanosecond Unix timestamp +```js +import "date" + +date.year(t: 1581423663293534940) + +// Returns 2020 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/yearday.md b/content/v2.0/reference/flux/stdlib/date/yearday.md index a7ff048fb..8e46b81cb 100644 --- a/content/v2.0/reference/flux/stdlib/date/yearday.md +++ b/content/v2.0/reference/flux/stdlib/date/yearday.md @@ -29,10 +29,11 @@ date.yearDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.yearDay(t: -1mo) // Returns 11 ``` + +##### Return the day of the year for a nanosecond Unix timestamp +```js +import "date" + +date.yearDay(t: 1581423663293534940) + +// Returns 42 +``` From 97fce1401ecf9617ce337a6c7cc0afdc9c200339 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 1 Jul 2020 09:04:53 -0600 Subject: [PATCH 34/55] fixed function call in http.pathEscape doc --- content/v2.0/reference/flux/stdlib/http/pathescape.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/stdlib/http/pathescape.md b/content/v2.0/reference/flux/stdlib/http/pathescape.md index 536f19964..1876c7d85 100644 --- a/content/v2.0/reference/flux/stdlib/http/pathescape.md +++ b/content/v2.0/reference/flux/stdlib/http/pathescape.md @@ -40,6 +40,6 @@ import "http" data |> map(fn: (r) => ({ r with - path: httpEscape(inputString: r.path) + path: http.pathEscape(inputString: r.path) })) ``` From 54309042125c05b06d01ea6e5bcca2f24fa31afe Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 1 Jul 2020 09:15:00 -0600 Subject: [PATCH 35/55] added flux 0.71 release notes --- content/v2.0/reference/release-notes/flux.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/content/v2.0/reference/release-notes/flux.md b/content/v2.0/reference/release-notes/flux.md index 4bd6fd2d2..75daef7f0 100644 --- a/content/v2.0/reference/release-notes/flux.md +++ b/content/v2.0/reference/release-notes/flux.md @@ -11,11 +11,21 @@ aliases: --- {{% note %}} -_The latest release of InfluxDB v2.0 beta includes **Flux v0.69.2**. +_The latest release of InfluxDB v2.0 OSS beta includes **Flux v0.69.2**. Though newer versions of Flux may be available, they will not be included with InfluxDB until the next InfluxDB v2.0 release._ {{% /note %}} +## v0.71.0 [2020-06-30] + +### Features +- Apply `Timeable` constraint to integer type to support integer values in + time-related function parameters. +- Implement schema mutation functions without performing any copies. +- Add [`http.pathEscape()` function](/v2.0/reference/flux/stdlib/http/pathescape/). + +--- + ## v0.70.0 [2020-06-29] ### Features - Update all `date` functions to accept time and duration types. From 312bafc07361061c0f8dfc3326301ddf3aa661df Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 1 Jul 2020 09:20:26 -0600 Subject: [PATCH 36/55] updated teams and telegram endpoint examples --- content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md | 2 +- content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md index 2f37e7e25..28288d498 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md +++ b/content/v2.0/reference/flux/stdlib/contrib/teams/endpoint.md @@ -68,7 +68,7 @@ crit_statuses text: "Disk usage is: **${r.status}**.", summary: "Disk usage is ${r.status}" }) - ) + )() ``` {{% note %}} diff --git a/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md b/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md index 4e5736adb..c331817de 100644 --- a/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md +++ b/content/v2.0/reference/flux/stdlib/contrib/telegram/endpoint.md @@ -96,7 +96,7 @@ crit_statuses text: "Disk usage is **${r.status}**.", silent: true }) - ) + )() ``` {{% note %}} From 7265768dbae06516e5b5891d5376d0be597a4412 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 09:05:53 -0600 Subject: [PATCH 37/55] dynamically change influxdb URL based on referrer, resolves #1115 --- assets/js/influxdb-url.js | 15 +++++++++++++++ layouts/partials/footer.html | 2 +- layouts/partials/footer/javascript.html | 12 +++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index dfa2d71b3..c58f9443a 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -124,6 +124,8 @@ $('button.url-trigger, #callout-url-selector .close').click(function() { } }) +///////////////////////////////// CUSTOM URLs ///////////////////////////////// + // Trigger radio button on custom URL field focus $('input#custom-url-field').focus(function(e) { $('input#custom[type="radio"]').trigger('click') @@ -156,3 +158,16 @@ if ( Cookies.get('influxdb_custom_url') != undefined ) { // Set active radio button on page load setRadioButton(getUrl()) + +/////////////////////////// Dynamically update URLs /////////////////////////// + +// Extract the protocol and hostname of refferrer +referrerHost = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g)[0] + +// Check if the referrerHost is one of the cloud URLs +// cloudUrls is built dynamically in layouts/partials/footer/javascript.html +if (cloudUrls.includes(referrerHost)) { + storeUrl(referrerHost, getUrl()) + updateUrls(getPrevUrl(), referrerHost) + setRadioButton(referrerHost) +} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 27e88acbf..b65d43017 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -21,5 +21,5 @@ - {{ partial "footer/javascript.html" }} + {{ partial "footer/javascript.html" . }} diff --git a/layouts/partials/footer/javascript.html b/layouts/partials/footer/javascript.html index 44e53db65..56ad03440 100644 --- a/layouts/partials/footer/javascript.html +++ b/layouts/partials/footer/javascript.html @@ -3,6 +3,16 @@ {{ $searchInteractions := resources.Get "js/search-interactions.js" }} {{ $telegrafFilters := resources.Get "js/telegraf-filters.js" }} {{ $influxdbURLs := resources.Get "js/influxdb-url.js" }} -{{ $footerjs := slice $versionSelector $contentInteractions $searchInteractions $telegrafFilters $influxdbURLs | resources.Concat "js/footer.bundle.js" | resources.Fingerprint}} +{{ $footerjs := slice $versionSelector $contentInteractions $searchInteractions $telegrafFilters $influxdbURLs | resources.Concat "js/footer.bundle.js" | resources.Fingerprint }} + + + + From 1f598cfe8fc5577b5fdbe4573f17d8cb0bf866a9 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 11:05:18 -0600 Subject: [PATCH 38/55] updated urls doc with custom url instructions --- content/v2.0/reference/urls.md | 41 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/content/v2.0/reference/urls.md b/content/v2.0/reference/urls.md index 738cd6b58..9b08c821f 100644 --- a/content/v2.0/reference/urls.md +++ b/content/v2.0/reference/urls.md @@ -12,15 +12,6 @@ menu: InfluxDB 2.0 is available both locally (OSS) or on multiple cloud providers in multiple regions (Cloud). -## InfluxDB OSS URL - -For InfluxDB OSS, the default URL is the following: - -{{< keep-url >}} -``` -http://localhost:9999/ -``` - ## InfluxDB Cloud URLs Each region has a unique InfluxDB Cloud URL and API endpoint. @@ -29,3 +20,35 @@ Use the URLs below to interact with your InfluxDB Cloud instances with the [`influx` CLI](/v2.0/reference/cli/influx/), or [Telegraf](/v2.0/write-data/use-telegraf/). {{< cloud_regions >}} + +## InfluxDB OSS URLs + +For InfluxDB OSS, the default URL is the following: + +{{< keep-url >}} +``` +http://localhost:9999/ +``` + +### Customize your InfluxDB OSS URL +To customize your InfluxDB host and port, use the +[`http-bind-address` configuration option](/v2.0/reference/config-options/#http-bind-address) +when starting `influxd`. + +```sh +# Syntax +influxd --http-bind-adress : + +# Example - Run InfluxDB at http://example.com:8080 +influxd --http-bind-address example.com:8080 + +# Example - Run InfluxDB at http://localhost:8080 +influxd --http-bind-address :8080 +``` + +{{% note %}} +#### Configure DNS Routing +You must configure DNS routing to successfully route requests to your custom hostname. +Methods for configuring DNS routing vary depending on your operating system and +network architecture and are not covered in this documentation. +{{% /note %}} From 987ce7b9caebaa0349b4854102a3a7c856e87608 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 11:08:01 -0600 Subject: [PATCH 39/55] fixed typo in js comment --- assets/js/influxdb-url.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index c58f9443a..0a1206183 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -161,7 +161,7 @@ setRadioButton(getUrl()) /////////////////////////// Dynamically update URLs /////////////////////////// -// Extract the protocol and hostname of refferrer +// Extract the protocol and hostname of refferer referrerHost = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g)[0] // Check if the referrerHost is one of the cloud URLs From 5bb99b0db35da7d907daa61690a06954af621718 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 14:26:41 -0600 Subject: [PATCH 40/55] fixed typo in urls doc --- content/v2.0/reference/urls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/urls.md b/content/v2.0/reference/urls.md index 9b08c821f..8b999e573 100644 --- a/content/v2.0/reference/urls.md +++ b/content/v2.0/reference/urls.md @@ -37,7 +37,7 @@ when starting `influxd`. ```sh # Syntax -influxd --http-bind-adress : +influxd --http-bind-address : # Example - Run InfluxDB at http://example.com:8080 influxd --http-bind-address example.com:8080 From 8d4fb3f6e02d58a5c9fe203c27f7796dbdd641d2 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 15:03:47 -0600 Subject: [PATCH 41/55] hotfix: quick updates to URL doc and js --- assets/js/influxdb-url.js | 2 +- content/v2.0/reference/urls.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index 0a1206183..955181d59 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -161,7 +161,7 @@ setRadioButton(getUrl()) /////////////////////////// Dynamically update URLs /////////////////////////// -// Extract the protocol and hostname of refferer +// Extract the protocol and hostname of referrer referrerHost = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g)[0] // Check if the referrerHost is one of the cloud URLs diff --git a/content/v2.0/reference/urls.md b/content/v2.0/reference/urls.md index 8b999e573..b82b8c5f2 100644 --- a/content/v2.0/reference/urls.md +++ b/content/v2.0/reference/urls.md @@ -47,7 +47,7 @@ influxd --http-bind-address :8080 ``` {{% note %}} -#### Configure DNS Routing +#### DNS Routing You must configure DNS routing to successfully route requests to your custom hostname. Methods for configuring DNS routing vary depending on your operating system and network architecture and are not covered in this documentation. From 6f1dd7ceba6935f791e4037b9ce2faa5b214e218 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 2 Jul 2020 15:11:29 -0600 Subject: [PATCH 42/55] hotfix: another typo in the urls doc --- content/v2.0/reference/urls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/urls.md b/content/v2.0/reference/urls.md index b82b8c5f2..f2bfd4d4d 100644 --- a/content/v2.0/reference/urls.md +++ b/content/v2.0/reference/urls.md @@ -47,7 +47,7 @@ influxd --http-bind-address :8080 ``` {{% note %}} -#### DNS Routing +#### Configure DNS routing You must configure DNS routing to successfully route requests to your custom hostname. Methods for configuring DNS routing vary depending on your operating system and network architecture and are not covered in this documentation. From 2784cf92e4cb798b881d8ca27d816b9b25a59c4c Mon Sep 17 00:00:00 2001 From: Kelly Date: Thu, 2 Jul 2020 15:12:01 -0700 Subject: [PATCH 43/55] fix 404s --- content/v2.0/get-started.md | 4 ++-- content/v2.0/write-data/best-practices/optimize-writes.md | 2 +- content/v2.0/write-data/no-code/scrape-data/_index.md | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/content/v2.0/get-started.md b/content/v2.0/get-started.md index 0febf8ead..72e97e079 100644 --- a/content/v2.0/get-started.md +++ b/content/v2.0/get-started.md @@ -572,7 +572,7 @@ and [Manually update Telegraf configurations](/v2.0/write-data/use-telegraf/manu #### Scrape data **InfluxDB OSS** lets you scrape Prometheus-formatted metrics from HTTP endpoints. -For details, see [Scrape data](/v2.0/write-data/scrape-data/). +For details, see [Scrape data](/v2.0/write-data/no-code/scrape-data/). #### API, CLI, and client libraries @@ -607,7 +607,7 @@ See [Monitor and alert](/v2.0/monitor-alert/). {{< cloud-name >}} is API-compatible and functionally compatible with InfluxDB OSS 2.0. The primary differences between InfluxDB OSS 2.0 and InfluxDB Cloud 2.0 are: -- [InfluxDB scrapers](/v2.0/write-data/scrape-data/) that collect data from specified +- [InfluxDB scrapers](/v2.0/write-data/no-code/scrape-data/) that collect data from specified targets are not available in {{< cloud-name "short" >}}. - {{< cloud-name "short" >}} instances are currently limited to a single organization. diff --git a/content/v2.0/write-data/best-practices/optimize-writes.md b/content/v2.0/write-data/best-practices/optimize-writes.md index d5456f161..c18cc7d62 100644 --- a/content/v2.0/write-data/best-practices/optimize-writes.md +++ b/content/v2.0/write-data/best-practices/optimize-writes.md @@ -15,7 +15,7 @@ Use these tips to optimize performance and system overhead when writing data to The following tools write to InfluxDB and employ write optimizations by default: - [Telegraf](/v2.0/write-data/use-telegraf/) -- [InfluxDB scrapers](/v2.0/write-data/scrape-data/) +- [InfluxDB scrapers](/v2.0/write-data/no-code/scrape-data/) - [InfluxDB client libraries](/v2.0/reference/api/client-libraries/) {{% /note %}} diff --git a/content/v2.0/write-data/no-code/scrape-data/_index.md b/content/v2.0/write-data/no-code/scrape-data/_index.md index 46ba45d04..6ea6bea1f 100644 --- a/content/v2.0/write-data/no-code/scrape-data/_index.md +++ b/content/v2.0/write-data/no-code/scrape-data/_index.md @@ -8,6 +8,7 @@ description: > aliases: - /v2.0/collect-data/scraper-metrics-endpoint - /v2.0/collect-data/scrape-data + - /v2.0/write-data/scrape-data - /v2.0/write-data/scrapable-endpoints v2.0/tags: [scraper] menu: From c51b96a157647d78d22309824e57ac9a81641ab6 Mon Sep 17 00:00:00 2001 From: Kelly Date: Thu, 2 Jul 2020 15:19:38 -0700 Subject: [PATCH 44/55] fix indent and upd 2 more --- content/v2.0/write-data/_index.md | 2 +- content/v2.0/write-data/no-code/scrape-data/_index.md | 2 +- .../no-code/scrape-data/manage-scrapers/update-a-scraper.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/v2.0/write-data/_index.md b/content/v2.0/write-data/_index.md index f15aa7720..3978acb48 100644 --- a/content/v2.0/write-data/_index.md +++ b/content/v2.0/write-data/_index.md @@ -149,7 +149,7 @@ After [setting up InfluxDB v2.0](/v2.0/get-started/#set-up-influxdb), the "Let's start collecting data!" page displays options for collecting data. Click **Quick Start**. -InfluxDB creates and configures a new [scraper](/v2.0/write-data/scrape-data/). +InfluxDB creates and configures a new [scraper](/v2.0/write-data/no-code/scrape-data/). The target URL points to the `/metrics` HTTP endpoint of your local InfluxDB instance (for example, `http://localhost:9999/metrics`), which outputs internal InfluxDB metrics in the [Prometheus data format](https://prometheus.io/docs/instrumenting/exposition_formats/). diff --git a/content/v2.0/write-data/no-code/scrape-data/_index.md b/content/v2.0/write-data/no-code/scrape-data/_index.md index 6ea6bea1f..f55664707 100644 --- a/content/v2.0/write-data/no-code/scrape-data/_index.md +++ b/content/v2.0/write-data/no-code/scrape-data/_index.md @@ -8,7 +8,7 @@ description: > aliases: - /v2.0/collect-data/scraper-metrics-endpoint - /v2.0/collect-data/scrape-data - - /v2.0/write-data/scrape-data + - /v2.0/write-data/scrape-data - /v2.0/write-data/scrapable-endpoints v2.0/tags: [scraper] menu: diff --git a/content/v2.0/write-data/no-code/scrape-data/manage-scrapers/update-a-scraper.md b/content/v2.0/write-data/no-code/scrape-data/manage-scrapers/update-a-scraper.md index e55f92a93..39c4177a2 100644 --- a/content/v2.0/write-data/no-code/scrape-data/manage-scrapers/update-a-scraper.md +++ b/content/v2.0/write-data/no-code/scrape-data/manage-scrapers/update-a-scraper.md @@ -16,7 +16,7 @@ Update a scraper in the InfluxDB user interface (UI). {{% note %}} Scraper **Target URLs** and **Buckets** cannot be updated. -To modify either, [create a new scraper](/v2.0/write-data/scrape-data/manage-scrapers/create-a-scraper). +To modify either, [create a new scraper](/v2.0/write-data/no-code/scrape-data/manage-scrapers/create-a-scraper). {{% /note %}} ## Update a scraper in the InfluxDB UI From 547a87e81eb25fd13075f5cd69407bfcd291c5d8 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 09:12:23 -0600 Subject: [PATCH 45/55] add Flux 0.71.1 release notes --- content/v2.0/reference/release-notes/flux.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/v2.0/reference/release-notes/flux.md b/content/v2.0/reference/release-notes/flux.md index 75daef7f0..ee24d468f 100644 --- a/content/v2.0/reference/release-notes/flux.md +++ b/content/v2.0/reference/release-notes/flux.md @@ -16,6 +16,13 @@ Though newer versions of Flux may be available, they will not be included with InfluxDB until the next InfluxDB v2.0 release._ {{% /note %}} +## v0.71.1 [2020-07-03] + +### Bug fixes +- Add a check to ensure `every` is non-negative. + +--- + ## v0.71.0 [2020-06-30] ### Features From 78c787a70b94586ffa8de9390efb860681e65f5b Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 10:09:49 -0600 Subject: [PATCH 46/55] add note and examples to influx transpile command, resolves #1156 --- .../v2.0/reference/cli/influx/transpile/_index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/v2.0/reference/cli/influx/transpile/_index.md b/content/v2.0/reference/cli/influx/transpile/_index.md index 4e7d94de0..5e19d0538 100644 --- a/content/v2.0/reference/cli/influx/transpile/_index.md +++ b/content/v2.0/reference/cli/influx/transpile/_index.md @@ -19,8 +19,23 @@ and includes absolute time ranges using the provided `--now` time. influx transpile [InfluxQL query] [flags] ``` +{{% note %}} +The provided InfluxQL query must contain a database and measurement and must be valid InfluxQL. +See the [InfluxQL documentation](https://docs.influxdata.com/influxdb/latest/query_language/) for more information. +{{% /note %}} + ## Flags | Flag | | Description | |:---- |:--- |:----------- | | `-h` | `--help` | Help for the `transpile` command | | | `--now` | RFC3339Nano timestamp to use as `now()` time (default is current UTC time) | + +## Examples +```sh +## Transpile an InfluxQL query that specifies the database, +## retention policy, and measurement. +influx transpile 'SELECT example-field FROM db.rp.measurement' + +## Transpile InfluxQL query using default retention policy +influx transpile 'SELECT example-field FROM db..measurement' +``` From de98567b9478df1b4083d5b57fbadbd47aa1ca16 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 13:50:25 -0600 Subject: [PATCH 47/55] updated influx transpile doc to address PR feedback --- content/v2.0/reference/cli/influx/transpile/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/reference/cli/influx/transpile/_index.md b/content/v2.0/reference/cli/influx/transpile/_index.md index 5e19d0538..5820b0d9c 100644 --- a/content/v2.0/reference/cli/influx/transpile/_index.md +++ b/content/v2.0/reference/cli/influx/transpile/_index.md @@ -20,7 +20,7 @@ influx transpile [InfluxQL query] [flags] ``` {{% note %}} -The provided InfluxQL query must contain a database and measurement and must be valid InfluxQL. +The InfluxQL query must be valid and contain both a database and measurement. See the [InfluxQL documentation](https://docs.influxdata.com/influxdb/latest/query_language/) for more information. {{% /note %}} From 491d02c0f890132923e9d219afc2e56c2ed713c4 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 14:12:02 -0600 Subject: [PATCH 48/55] hotfix: updated nonNegative default for derivative, resolves #1177 --- .../flux/stdlib/built-in/transformations/derivative.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md index 4b3a4c54d..9c912f5bb 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/derivative.md @@ -26,7 +26,7 @@ _**Output data type:** Float_ ```js derivative( unit: 1s, - nonNegative: false, + nonNegative: true, columns: ["_value"], timeSrc: "_time" ) @@ -41,8 +41,9 @@ Defaults to `1s`. _**Data type:** Duration_ ### nonNegative -Indicates if the derivative is allowed to be negative. -When set to `true`, if a value is less than the previous value, it is assumed the previous value should have been a zero. +Indicates if the derivative is allowed to be negative. Default is `true`. +When `true`, if a value is less than the previous value, it is assumed the +previous value should have been a zero. _**Data type:** Boolean_ From ef95ab7d94ba2a370daeb3822f70fe1ed6df742d Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 14:36:19 -0600 Subject: [PATCH 49/55] added tooltip shortcode, updated data elements doc with tooltip shortcode --- CONTRIBUTING.md | 12 +++++ .../reference/key-concepts/data-elements.md | 44 +++++++++---------- layouts/shortcodes/tooltip.html | 3 ++ 3 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 layouts/shortcodes/tooltip.html diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 420812f3f..d22beba73 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -546,6 +546,18 @@ The following options are available: - third - quarter +### Tooltips +Use the `{{< tooltips >}}` shortcode to add tooltips to text. +The **1st** argument is the text shown in the tooltip. +The **2nd** argument is the highlighted text that triggers the tooltip. + +```md +I like {{< tooltip "Butterflies are awesome!" "butterflies" >}}. +``` + +The example above renders as "I like butterflies" with "butterflies" highlighted. +When you hover over "butterflies," a tooltip appears with the text: "Butterflies are awesome!" + ### Reference content The InfluxDB documentation is "task-based," meaning content primarily focuses on what a user is **doing**, not what they are **using**. diff --git a/content/v2.0/reference/key-concepts/data-elements.md b/content/v2.0/reference/key-concepts/data-elements.md index 89cb7484f..09f62a8b1 100644 --- a/content/v2.0/reference/key-concepts/data-elements.md +++ b/content/v2.0/reference/key-concepts/data-elements.md @@ -31,12 +31,12 @@ _Hover over highlighted terms to get acquainted with InfluxDB terminology and la **bucket:** `my_bucket` -| _time | _measurement | location | scientist | _field | _value | -|:------------------- |:------------ |:------- |:------ |:-- |:------ | -| 2019-08-18T00:00:00Z | census | klamath | anderson | bees | 23 | -| 2019-08-18T00:00:00Z | census | portland | mullen | ants | 30 | -| 2019-08-18T00:06:00Z | census | klamath | anderson | bees | 28 | -| 2019-08-18T00:06:00Z | census | portland | mullen | ants | 32 | +| _time | _measurement | {{< tooltip "Tag key" "location" >}} | {{< tooltip "Tag key" "scientist" >}} | _field | _value | +|:------------------- |:------------ |:------- |:------ |:-- |:------ | +| 2019-08-18T00:00:00Z | census | klamath | anderson | bees | 23 | +| 2019-08-18T00:00:00Z | census | portland | mullen | ants | 30 | +| 2019-08-18T00:06:00Z | census | klamath | anderson | bees | 28 | +| {{< tooltip "Timestamp" "2019-08-18T00:06:00Z" >}} | {{< tooltip "measurement" "census" >}} | {{< tooltip "Tag value" "portland" >}} | {{< tooltip "Tag value" "mullen">}} | {{< tooltip "Field key" "ants" >}} | {{< tooltip "Field value" "32" >}} | ## Timestamp @@ -117,19 +117,19 @@ from(bucket: "bucket-name") InfluxDB scans every field value in the dataset for `bees` before the query returns a response. If our sample `census` data grew to millions of rows, to optimize your query, you could rearrange your [schema](/v2.0/reference/glossary/#schema) so the fields (`bees` and `ants`) becomes tags and the tags (`location` and `scientist`) become fields: -| _time | _measurement | bees | _field | _value | -|:------------------- |:------------ |:------- |:-- |:------ | -| 2019-08-18T00:00:00Z | census | 23 | location | klamath | -| 2019-08-18T00:00:00Z | census | 23 | scientist | anderson | -| 2019-08-18T00:06:00Z | census | 28 | location | klamath | -| 2019-08-18T00:06:00Z | census | 28 | scientist | anderson | +| _time | _measurement | {{< tooltip "Tag key" "bees" >}} | _field | _value | +|:------------------- |:------------ |:------- |:-- |:------ | +| 2019-08-18T00:00:00Z | census | 23 | location | klamath | +| 2019-08-18T00:00:00Z | census | 23 | scientist | anderson | +| 2019-08-18T00:06:00Z | census | {{< tooltip "Tag value" "28" >}} | {{< tooltip "Field key" "location" >}} | {{< tooltip "Field value" "klamath" >}} | +| 2019-08-18T00:06:00Z | census | 28 | scientist | anderson | -| _time | _measurement | ants | _field | _value | -|:------------------- |:------------ |:------- |:-- |:------ | -| 2019-08-18T00:00:00Z | census | 30 | location | portland | -| 2019-08-18T00:00:00Z | census | 30 | scientist | mullen | -| 2019-08-18T00:06:00Z | census | 32 | location | portland| -| 2019-08-18T00:06:00Z | census | 32 | scientist | mullen | +| _time | _measurement | {{< tooltip "Tag key" "ants" >}} | _field | _value | +|:------------------- |:------------ |:------- |:-- |:------ | +| 2019-08-18T00:00:00Z | census | 30 | location | portland | +| 2019-08-18T00:00:00Z | census | 30 | scientist | mullen | +| 2019-08-18T00:06:00Z | census | {{< tooltip "Tag value" "32" >}} | {{< tooltip "Field key" "location" >}} | {{< tooltip "Field value" "portland" >}} | +| 2019-08-18T00:06:00Z | census | 32 | scientist | mullen | Now that `bees` and `ants` are tags, InfluxDB doesn't have to scan all `_field` and `_value` columns. This makes your queries faster. @@ -137,10 +137,10 @@ Now that `bees` and `ants` are tags, InfluxDB doesn't have to scan all `_field` Now that you're familiar with measurements, field sets, and tag sets, it's time to discuss series keys and series. A **series key** is a collection of points that share a measurement, tag set, and field key. For example, the [sample data](#sample-data) includes two unique series keys: -| _measurement | tag set | _field | -|:------------- |:------------------------------- |:------ | -| census | location=klamath,scientist=anderson |bees| -| census | location=portland,scientist=mullen | ants | +| _measurement | tag set | _field | +|:------------- |:------------------------------- |:------ | +| census | {{< tooltip "Tag set" "location=klamath,scientist=anderson" >}} | {{< tooltip "Field key" "bees" >}} | +| census | location=portland,scientist=mullen | ants | A **series** includes timestamps and field values for a given series key. From the sample data, here's a **series key** and the corresponding **series**: diff --git a/layouts/shortcodes/tooltip.html b/layouts/shortcodes/tooltip.html new file mode 100644 index 000000000..29dcae824 --- /dev/null +++ b/layouts/shortcodes/tooltip.html @@ -0,0 +1,3 @@ +{{ $tooltip := .Get 0 }} +{{ $text := .Get 1 }} +{{ $text }} From fde89dcddfa0e606420c10face52f298425b6511 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 14:41:07 -0600 Subject: [PATCH 50/55] add links to line protocol tag information, closes #1151 --- content/v2.0/reference/key-concepts/data-elements.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/v2.0/reference/key-concepts/data-elements.md b/content/v2.0/reference/key-concepts/data-elements.md index 09f62a8b1..7fec5eaf8 100644 --- a/content/v2.0/reference/key-concepts/data-elements.md +++ b/content/v2.0/reference/key-concepts/data-elements.md @@ -83,11 +83,13 @@ Tags include tag keys and tag values that are stored as strings and metadata. ### Tag key The tag keys in the sample data are `location` and `scientist`. +_For information about tag key requirements, see [Line protocol – Tag set](/v2.0/reference/syntax/line-protocol/#tag-set)._ ### Tag value The tag key `location` has two tag values: `klamath` and `portland`. The tag key `scientist` also has two tag values: `anderson` and `mullen`. +_For information about tag value requirements, see [Line protocol – Tag set](/v2.0/reference/syntax/line-protocol/#tag-set)._ ### Tag set From 1877976fac1be4b67789c72d4ce0ded409baa760 Mon Sep 17 00:00:00 2001 From: pierwill Date: Mon, 6 Jul 2020 13:15:20 -0700 Subject: [PATCH 51/55] Update Vault doc to add more information on Cloud --- content/v2.0/security/secrets/use-vault.md | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/content/v2.0/security/secrets/use-vault.md b/content/v2.0/security/secrets/use-vault.md index 7642a6751..2e69ef8b8 100644 --- a/content/v2.0/security/secrets/use-vault.md +++ b/content/v2.0/security/secrets/use-vault.md @@ -6,19 +6,23 @@ menu: v2_0: parent: Store and use secrets weight: 201 -products: [oss] --- -[Vault](https://www.vaultproject.io/) secures, stores, and tightly controls access +[Vault](https://www.vaultproject.io/) secures, stores, and controls access to tokens, passwords, certificates, and other sensitive secrets. -Store sensitive secrets in Vault using the InfluxDB built-in Vault integration. +Store sensitive secrets in Vault using InfluxDB's built-in Vault integration. + +## Use Vault with {{< cloud-name >}} -{{% cloud %}} By default, all secrets added to **InfluxDB Cloud** are stored in the **InfluxDB Cloud Vault cluster**. -{{% /cloud %}} -## Start a Vault server +For more on adding and using secrets, see [Manage secrets](/v2.0/security/secrets/manage-secrets/). +Once added, use the [`secrets.get()`](/v2.0/reference/flux/stdlib/secrets/get/) function to retrieve secrets for use in Flux scripts. + +## Use Vault with InfluxDB OSS + +### Start a Vault server Start a Vault server and ensure InfluxDB has network access to the server. @@ -43,26 +47,26 @@ For this example, install Vault on your local machine and start a Vault dev serv vault server -dev ``` -## Provide Vault server address and token +### Provide Vault server address and token Use `influxd` Vault-related tags or [Vault environment variables](https://www.vaultproject.io/docs/commands/index.html#environment-variables) to provide connection credentials and other important Vault-related information to InfluxDB. -### Required credentials +#### Required credentials -#### Vault address +##### Vault address Provide the API address of your Vault server _(available in the Vault server output)_ using the [`--vault-addr` flag](/v2.0/reference/config-options/#vault-addr) when starting `influxd` or with the `VAULT_ADDR` environment variable. -#### Vault token +##### Vault token Provide your [Vault token](https://learn.hashicorp.com/vault/getting-started/authentication) (required to access your Vault server) using the [`--vault-token` flag](/v2.0/reference/config-options/#vault-token) when starting `influxd` or with the `VAULT_TOKEN` environment variable. _Your Vault server configuration may require other Vault settings._ -## Start InfluxDB +### Start InfluxDB Start the [`influxd` service](/v2.0/reference/cli/influxd/) with the `--secret-store` option set to `vault` any other necessary flags. @@ -89,6 +93,6 @@ If set, these flags override any [Vault environment variables](https://www.vault For more information, see [InfluxDB configuration options](/v2.0/reference/config-options/). -## Manage secrets through the InfluxDB API +### Manage secrets through the InfluxDB API Use the InfluxDB `/org/{orgID}/secrets` API endpoint to add tokens to Vault. For details, see [Manage secrets](/v2.0/security/secrets/manage-secrets/). From 32fc4ddd801ee6dafae91d59bf96af59117268a3 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 16:07:56 -0600 Subject: [PATCH 52/55] add gzip to optimize writes doc, closes #1134 --- .../best-practices/optimize-writes.md | 60 +++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/content/v2.0/write-data/best-practices/optimize-writes.md b/content/v2.0/write-data/best-practices/optimize-writes.md index c18cc7d62..4d67d84fd 100644 --- a/content/v2.0/write-data/best-practices/optimize-writes.md +++ b/content/v2.0/write-data/best-practices/optimize-writes.md @@ -11,16 +11,21 @@ v2.0/tags: [best practices, write] Use these tips to optimize performance and system overhead when writing data to InfluxDB. +- [Batch writes](#batch-writes) +- [Sort tags by key](#sort-tags-by-key) +- [Use the coarsest time precision possible](#use-the-coarsest-time-precision-possible) +- [Use gzip compression](#use-gzip-compression) +- [Synchronize hosts with NTP](#synchronize-hosts-with-ntp) +- [Write multiple data points in one request](#write-multiple-data-points-in-one-request) + {{% note %}} -The following tools write to InfluxDB and employ write optimizations by default: +The following tools write to InfluxDB and employ _most_ write optimizations by default: - [Telegraf](/v2.0/write-data/use-telegraf/) -- [InfluxDB scrapers](/v2.0/write-data/no-code/scrape-data/) - [InfluxDB client libraries](/v2.0/reference/api/client-libraries/) +- [InfluxDB scrapers](/v2.0/write-data/no-code/scrape-data/) {{% /note %}} ---- - ## Batch writes Write data in batches to minimize network overhead when writing data to InfluxDB. @@ -50,6 +55,53 @@ For better performance, use the coarsest precision possible for timestamps. _Specify timestamp precision when [writing to InfluxDB](/v2.0/write-data/#timestamp-precision)._ +## Use gzip compression + +Enable gzip compression when writing to InfluxDB to speed up data ingestion. +Benchmarks have shown up to a 5x speed improvement when data is compressed. + +{{< tabs-wrapper >}} +{{% tabs %}} +[Telegraf](#) +[Client libraries](#) +[InfluxDB API](#) +{{% /tabs %}} +{{% tab-content %}} +### Enable gzip compression in Telegraf + +In the `influxdb_v2` output plugin configuration in your `telegraf.conf`, set the +`content_encoding` option to `gzip`: + +```toml +[[outputs.influxdb_v2]] + urls = ["http://localhost:9999"] + # ... + content_encoding = "gzip" +``` +{{% /tab-content %}} +{{% tab-content %}} +### Enable gzip compression in InfluxDB client libraries + +Each [InfluxDB client library](/v2.0/reference/api/client-libraries/) provides +options for compressing write requests or enforces compression by default. +The method for enabling compression is different for each library. +For specific instructions, see the [InfluxDB client libraries documentation](/v2.0/reference/api/client-libraries/). +{{% /tab-content %}} +{{% tab-content %}} +### Use gzip compression with the InfluxDB API + +When using the InfluxDB API `/write` endpoint to write data, set the `Content-Encoding` +header to `gzip` to compress the request data. + +```sh +curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \ + --header "Authorization: Token YOURAUTHTOKEN" \ + --header "Content-Encoding: gzip" \ + --data-raw "mem,host=host1 used_percent=23.43234543 1556896326" +``` +{{% /tab-content %}} +{{< /tabs-wrapper >}} + ## Synchronize hosts with NTP Use the Network Time Protocol (NTP) to synchronize time between hosts. From a6725cc006f8dd39c621bbe42c6dab4bfd58d115 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 6 Jul 2020 16:36:35 -0600 Subject: [PATCH 53/55] updated write optimizations doc to address PR feedback --- content/v2.0/write-data/best-practices/optimize-writes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/write-data/best-practices/optimize-writes.md b/content/v2.0/write-data/best-practices/optimize-writes.md index 4d67d84fd..0d10a30e5 100644 --- a/content/v2.0/write-data/best-practices/optimize-writes.md +++ b/content/v2.0/write-data/best-practices/optimize-writes.md @@ -57,7 +57,7 @@ _Specify timestamp precision when [writing to InfluxDB](/v2.0/write-data/#timest ## Use gzip compression -Enable gzip compression when writing to InfluxDB to speed up data ingestion. +Use gzip compression to speed up writes to InfluxDB. Benchmarks have shown up to a 5x speed improvement when data is compressed. {{< tabs-wrapper >}} From 2fa6b41575a2e7f7ff0dfc7631674353048e86ed Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 7 Jul 2020 10:12:52 -0600 Subject: [PATCH 54/55] updated list of Flux pushdown functions, related to #1042 --- content/v2.0/query-data/optimize-queries.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/v2.0/query-data/optimize-queries.md b/content/v2.0/query-data/optimize-queries.md index 6a5e3226d..baacd1897 100644 --- a/content/v2.0/query-data/optimize-queries.md +++ b/content/v2.0/query-data/optimize-queries.md @@ -27,6 +27,10 @@ reduce the amount of memory necessary to run a query. - [range()](/v2.0/reference/flux/stdlib/built-in/transformations/range/) - [filter()](/v2.0/reference/flux/stdlib/built-in/transformations/filter/) - [group()](/v2.0/reference/flux/stdlib/built-in/transformations/group/) +- [count()](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/count/) +- [sum()](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/sum/) +- [first()](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first/) +- [last()](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last/) Use pushdown functions at the beginning of your query. Once a non-pushdown function runs, Flux pulls data into memory and runs all From d150b7c3da85003aefaf327229cca49db8c5a2dd Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 7 Jul 2020 15:00:54 -0600 Subject: [PATCH 55/55] add information about selectors handling empty tables, resolves #1183 --- .../flux/stdlib/built-in/transformations/aggregates/count.md | 2 +- .../flux/stdlib/built-in/transformations/aggregates/mode.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/bottom.md | 5 +++++ .../stdlib/built-in/transformations/selectors/distinct.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/first.md | 5 +++++ .../built-in/transformations/selectors/highestaverage.md | 5 +++++ .../built-in/transformations/selectors/highestcurrent.md | 5 +++++ .../stdlib/built-in/transformations/selectors/highestmax.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/last.md | 5 +++++ .../built-in/transformations/selectors/lowestaverage.md | 5 +++++ .../built-in/transformations/selectors/lowestcurrent.md | 5 +++++ .../stdlib/built-in/transformations/selectors/lowestmin.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/max.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/min.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/sample.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/top.md | 5 +++++ .../flux/stdlib/built-in/transformations/selectors/unique.md | 5 +++++ 17 files changed, 81 insertions(+), 1 deletion(-) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/count.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/count.md index 856079ef2..f2262f02f 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/count.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/count.md @@ -24,7 +24,7 @@ count(column: "_value") ``` {{% note %}} -#### Count empty tables +#### Empty tables `count()` returns `0` for empty tables. To keep empty tables in your data, set the following parameters for the following functions: diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mode.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mode.md index c07992cf5..9e4ff1d68 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mode.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mode.md @@ -27,6 +27,11 @@ If there are multiple modes, it returns all of them in a sorted table. Mode only considers non-null values. If there is no mode, `mode()` returns `null`. +{{% warn %}} +#### Empty tables +`mode()` drops empty tables. +{{% /warn %}} + ##### Supported data types - String diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/bottom.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/bottom.md index feee2b2c1..f722898db 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/bottom.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/bottom.md @@ -22,6 +22,11 @@ _**Output data type:** Object_ bottom(n:10, columns: ["_value"]) ``` +{{% warn %}} +#### Empty tables +`bottom()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct.md index b1ea29c68..d9873cc35 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct.md @@ -24,6 +24,11 @@ _**Output data type:** Object_ distinct(column: "host") ``` +{{% warn %}} +#### Empty tables +`distinct()` drops empty tables. +{{% /warn %}} + ## Parameters ### column diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first.md index 427d5a54a..7da75328c 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first.md @@ -23,6 +23,11 @@ _**Output data type:** Object_ first() ``` +{{% warn %}} +#### Empty tables +`first()` drops empty tables. +{{% /warn %}} + ## Examples ```js from(bucket:"example-bucket") diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestaverage.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestaverage.md index 7cf9d502c..f8f0c2748 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestaverage.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestaverage.md @@ -24,6 +24,11 @@ highestAverage( ) ``` +{{% warn %}} +#### Empty tables +`highestAverage()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestcurrent.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestcurrent.md index ca0a922b0..d9e35c4bd 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestcurrent.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestcurrent.md @@ -24,6 +24,11 @@ highestCurrent( ) ``` +{{% warn %}} +#### Empty tables +`highestCurrent()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestmax.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestmax.md index e9268edcf..1e60beabd 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestmax.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/highestmax.md @@ -24,6 +24,11 @@ highestMax( ) ``` +{{% warn %}} +#### Empty tables +`highestMax()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last.md index 4f370060f..4d5490c1a 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last.md @@ -23,6 +23,11 @@ _**Output data type:** Object_ last() ``` +{{% warn %}} +#### Empty tables +`last()` drops empty tables. +{{% /warn %}} + ## Examples ```js from(bucket:"example-bucket") diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestaverage.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestaverage.md index d1ea9fe7c..bea024aca 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestaverage.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestaverage.md @@ -24,6 +24,11 @@ lowestAverage( ) ``` +{{% warn %}} +#### Empty tables +`lowestAverage()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestcurrent.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestcurrent.md index eab20a443..34d2db69b 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestcurrent.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestcurrent.md @@ -24,6 +24,11 @@ lowestCurrent( ) ``` +{{% warn %}} +#### Empty tables +`lowestCurrent()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestmin.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestmin.md index 8a0cdc57a..1651afebc 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestmin.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/lowestmin.md @@ -24,6 +24,11 @@ lowestMin( ) ``` +{{% warn %}} +#### Empty tables +`lowestMin()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/max.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/max.md index 0c7956566..5fb669c00 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/max.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/max.md @@ -22,6 +22,11 @@ _**Output data type:** Object_ max(column: "_value") ``` +{{% warn %}} +#### Empty tables +`max()` drops empty tables. +{{% /warn %}} + ## Parameters ### column diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/min.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/min.md index 63a7bf673..8ff2002aa 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/min.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/min.md @@ -22,6 +22,11 @@ _**Output data type:** Object_ min(column: "_value") ``` +{{% warn %}} +#### Empty tables +`min()` drops empty tables. +{{% /warn %}} + ## Parameters ### column diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/sample.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/sample.md index acb8fd9d0..0c63938c6 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/sample.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/sample.md @@ -22,6 +22,11 @@ _**Output data type:** Object_ sample(n:5, pos: -1) ``` +{{% warn %}} +#### Empty tables +`sample()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/top.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/top.md index 630bf8f4e..03d24faf0 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/top.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/top.md @@ -20,6 +20,11 @@ _**Output data type:** Object_ top(n:10, columns: ["_value"]) ``` +{{% warn %}} +#### Empty tables +`top()` drops empty tables. +{{% /warn %}} + ## Parameters ### n diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/unique.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/unique.md index 899ca0bd2..6ff514cc7 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/unique.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/selectors/unique.md @@ -21,6 +21,11 @@ _**Output data type:** Object_ unique(column: "_value") ``` +{{% warn %}} +#### Empty tables +`unique()` drops empty tables. +{{% /warn %}} + ## Parameters ### column