Merge pull request #798 from influxdata/restructure-query-guides

Restructure query guides
pull/800/head
Scott Anderson 2020-03-06 13:53:34 -07:00 committed by GitHub
commit 61aa167cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 113 additions and 98 deletions

View File

@ -45,4 +45,4 @@ Guidelines used to estimate costs for default configurations:
- **Professional**. For teams monitoring multiple disparate systems or use cases.
- **Enterprise**. For teams monitoring multiple domains and use cases accessing a variety of dashboards.
5. Adjust the default configuration values to match your number of devices, plugins, metrics, and so on. The **Projected Usage** costs are automatically updated as you adjust your configuration.
6. Click **Get started with InfluxDB Cloud** [to get started](https://v2.docs.influxdata.com/v2.0/cloud/get-started/).
6. Click **Get started with InfluxDB Cloud** [to get started](/v2.0/cloud/get-started/).

View File

@ -2,7 +2,7 @@
title: Execute queries
seotitle: Different ways to query InfluxDB
description: There are multiple ways to query data from InfluxDB including the InfluxDB UI, CLI, and API.
weight: 102
weight: 103
menu:
v2_0:
name: Execute queries

View File

@ -1,15 +1,17 @@
---
title: Common Flux queries
description: >
placeholder
weight: 103
title: Query data with Flux
description: Guides that walk through both common and complex queries and use cases for Flux.
weight: 102
v2.0/tags: [flux, query]
menu:
v2_0:
name: Query with Flux
parent: Query data
name: Common queries
v2.0/tags: [query]
alias:
- /v2.0/query-data/guides/
---
The following guides walk through both common and complex queries and use cases for Flux.
{{% note %}}
#### Example data variable
@ -27,21 +29,8 @@ data = from(bucket: "example-bucket")
```
{{% /note %}}
{{< children >}}
## Flux query guides
---
- [x] SELECT-like commands
- [x] Median
- [x] Percentile
- [ ] Cumulative Sum
- [ ] Moving Average
- [ ] Increase
- [ ] Rate
- [ ] Delta
- [ ] Window
- [ ] First/Last
- [ ] Histogram
- [ ] Gap filling
- [ ] Last observation carried forward
- [ ] Last point
{{< children >}}

View File

@ -1,15 +1,18 @@
---
title: Query using conditional logic
seotitle: Query using conditional logic in Flux
list_title: Use conditional logic
description: >
This guide describes how to use Flux conditional expressions, such as `if`,
`else`, and `then`, to query and transform data.
v2.0/tags: [conditionals, flux]
menu:
v2_0:
name: Query using conditionals
parent: How-to guides
weight: 209
name: Use conditional logic
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/conditional-logic/
---
Flux provides `if`, `then`, and `else` conditional expressions that allow for powerful and flexible Flux queries.

View File

@ -4,11 +4,11 @@ seotitle: Query cumulative sum in Flux
list_title: Cumulative sum
description: >
Use the `cumulativeSum()` function to calculate a running total of values.
weight: 204
weight: 210
menu:
v2_0:
parent: Common queries
name: Cumulative sum
parent: Query with Flux
name: Query the cumulative sum
v2.0/tags: [query, cumulative sum]
---
@ -40,7 +40,7 @@ to calculate a running total of values.
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/common-queries/#example-data-variable).
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
##### Calculate the running total of values

View File

@ -5,8 +5,10 @@ v2.0/tags: [functions, custom, flux]
menu:
v2_0:
name: Create custom functions
parent: How-to guides
weight: 208
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/custom-functions/
---
Flux's functional syntax allows for custom functions.

View File

@ -7,6 +7,8 @@ menu:
name: Custom aggregate functions
parent: Create custom functions
weight: 301
aliases:
- /v2.0/query-data/guides/custom-functions/custom-aggregate/
---
To aggregate your data, use the Flux

View File

@ -8,8 +8,10 @@ v2.0/tags: [exists]
menu:
v2_0:
name: Check if a value exists
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/exists/
---
Use the Flux `exists` operator to check if an object contains a key or if that

View File

@ -1,5 +1,6 @@
---
title: Group data in InfluxDB with Flux
list_title: Group data
description: >
This guide walks through grouping data with Flux by providing examples and
illustrating how data is shaped throughout the process.
@ -7,8 +8,10 @@ v2.0/tags: [group]
menu:
v2_0:
name: Group data
parent: How-to guides
weight: 203
parent: Query with Flux
weight: 202
aliases:
- /v2.0/query-data/guides/group-data/
---
With Flux, you can group data by any column in your queried data set.

View File

@ -1,12 +1,15 @@
---
title: Create histograms with Flux
list_title: Create histograms
description: This guide walks through using the `histogram()` function to create cumulative histograms with Flux.
v2.0/tags: [histogram]
menu:
v2_0:
name: Create histograms
parent: How-to guides
weight: 208
parent: Query with Flux
weight: 210
aliases:
- /v2.0/query-data/guides/histograms/
---
Histograms provide valuable insight into the distribution of your data.

View File

@ -1,13 +1,16 @@
---
title: Join data with Flux
seotitle: Join data in InfluxDB with Flux
list_title: Join data
description: This guide walks through joining data with Flux and outlines how it shapes your data in the process.
v2.0/tags: [join, flux]
menu:
v2_0:
name: Join data
parent: How-to guides
weight: 205
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/join/
---
The [`join()` function](/v2.0/reference/flux/stdlib/built-in/transformations/join) merges two or more

View File

@ -1,12 +1,15 @@
---
title: Manipulate timestamps with Flux
list_title: Manipulate timestamps
description: >
Use Flux to process and manipulate timestamps.
menu:
v2_0:
name: Manipulate timestamps
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/manipulate-timestamps/
---
Every point stored in InfluxDB has an associated timestamp.

View File

@ -1,13 +1,16 @@
---
title: Transform data with mathematic operations
seotitle: Transform data with mathematic operations in Flux
list_title: Transform data with math
description: This guide describes how to use Flux to transform data with mathematic operations.
v2.0/tags: [math, flux]
menu:
v2_0:
name: Transform data with math
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 205
aliases:
- /v2.0/query-data/guides/mathematic-operations/
---
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,

View File

@ -1,18 +1,18 @@
---
title: Query median values
seotitle: Query median values in Flux
title: Find median values
seotitle: Find median values in Flux
list_title: Median
description: >
Use the `median()` function to return a value representing the `0.5` quantile
(50th percentile) or median of input data.
weight: 202
weight: 210
menu:
v2_0:
parent: Common queries
name: Median
parent: Query with Flux
name: Find the median
v2.0/tags: [query, median]
related:
- /v2.0/query-data/common-queries/percentile-quantile/
- /v2.0/query-data/flux/percentile-quantile/
---
Use the [`median()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/median/)
@ -99,7 +99,7 @@ Output tables consist of a single row containing the calculated median.
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/common-queries/#example-data-variable).
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
## Find the value that represents the median

View File

@ -6,8 +6,10 @@ v2.0/tags: [states, monitor, flux]
menu:
v2_0:
name: Monitor states
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/monitor-states/
---
Flux helps you monitor states in your metrics and events:
@ -24,7 +26,7 @@ If you're just getting started with Flux queries, check out the following:
## Find how long a state persists
1. Use the [`stateDuration()`](/v2.0/reference/flux/stdlib/built-in/transformations/stateduration/) function to calculate how long a column value has remained the same value (or state). Include the following information:
- **Column to search:** any tag key, tag value, field key, field value, or measurement.
- **Value:** the value (or state) to search for in the specified column.
- **State duration column:** a new column to store the state duration─the length of time that the specified value persists.
@ -83,7 +85,7 @@ _time _value door_closed
```js
|> stateCount
(fn: (r) =>
(fn: (r) =>
r._column_to_search == "value_to_search_for",
column: "state_count"`
)
@ -148,9 +150,9 @@ Detect state changes with the `monitor.stateChanges()` function. To use the `mon
{{< nav-icon "alerts" >}}
2. If you haven't already, [create a check](/v2.0/monitor-alert/checks/create/) that stores statuses (`CRIT`, `WARN`, `INFO`, `OK` or `ANY`) in the `_level` column. <!-- specify how to do this with monitor.check() function or in UI, with check threshold or deadman?
2. If you haven't already, [create a check](/v2.0/monitor-alert/checks/create/) that stores statuses (`CRIT`, `WARN`, `INFO`, `OK` or `ANY`) in the `_level` column. <!-- specify how to do this with monitor.check() function or in UI, with check threshold or deadman?
3. Import the InfluxDB `monitor` package.
4. In your query, the specify the check. <!--can users specify a Flux query with the `monitoring` bucket and _level field without specifying the check? does importing the monitor package create the `monitoring` bucket?
4. In your query, the specify the check. <!--can users specify a Flux query with the `monitoring` bucket and _level field without specifying the check? does importing the monitor package create the `monitoring` bucket?
5. Use the `monitor.stateChanges()` function and include the following information:
- `fromLevel` (optional; by default, this is set to `any`)

View File

@ -1,18 +1,18 @@
---
title: Query percentile and quantile values
title: Find percentile and quantile values
seotitle: Query percentile and quantile values in Flux
list_title: Percentile & quantile
description: >
Use the `quantile()` function to return all values within the `q` quantile or
percentile of input data.
weight: 203
weight: 210
menu:
v2_0:
parent: Common queries
name: Percentile & quantile
parent: Query with Flux
name: Query percentiles & quantiles
v2.0/tags: [query, percentile, quantile]
related:
- /v2.0/query-data/common-queries/query-median/
- /v2.0/query-data/flux/query-median/
---
Use the [`quantile()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile/)
@ -111,7 +111,7 @@ If calculating the `0.5` quantile or 50th percentile:
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/common-queries/#example-data-variable).
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
## Find the value representing the 99th percentile

View File

@ -8,7 +8,7 @@ description: >
weight: 201
menu:
v2_0:
parent: Common queries
parent: Query with Flux
v2.0/tags: [query, select, where]
---

View File

@ -1,12 +1,15 @@
---
title: Use regular expressions in Flux
list_title: Use regular expressions
description: This guide walks through using regular expressions in evaluation logic in Flux functions.
v2.0/tags: [regex]
menu:
v2_0:
name: Use regular expressions
parent: How-to guides
weight: 210
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/regular-expressions/
---
Regular expressions (regexes) are incredibly powerful when matching patterns in large collections of data.

View File

@ -1,5 +1,6 @@
---
title: Extract scalar values in Flux
list_title: Extract scalar values
description: >
Use Flux stream and table functions to extract scalar values from Flux query output.
This lets you, for example, dynamically set variables using query results.
@ -7,10 +8,12 @@ menu:
v2_0:
name: Extract scalar values
parent: How-to guides
weight: 210
weight: 220
v2.0/tags: [scalar]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/stream-table/
aliases:
- /v2.0/query-data/guides/scalar-values/
---
Use Flux [stream and table functions](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/)

View File

@ -1,6 +1,7 @@
---
title: Sort and limit data with Flux
seotitle: Sort and limit data in InfluxDB with Flux
list_title: Sort and limit data
description: >
This guide walks through sorting and limiting data with Flux and outlines how
it shapes your data in the process.
@ -8,8 +9,10 @@ v2.0/tags: [sort, limit]
menu:
v2_0:
name: Sort and limit data
parent: How-to guides
weight: 206
parent: Query with Flux
weight: 203
aliases:
- /v2.0/query-data/guides/sort-limit/
---
The [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)

View File

@ -7,8 +7,10 @@ description: >
v2.0/tags: [query, flux, sql]
menu:
v2_0:
parent: How-to guides
weight: 207
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/sql/
---
The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources.

View File

@ -1,15 +1,18 @@
---
title: Window and aggregate data with Flux
seotitle: Window and aggregate data in InfluxDB with Flux
list_title: Window & aggregate data
description: >
This guide walks through windowing and aggregating data with Flux and outlines
how it shapes your data in the process.
menu:
v2_0:
name: Window and aggregate data
parent: How-to guides
weight: 202
name: Window & aggregate data
parent: Query with Flux
weight: 204
v2.0/tags: [flux, aggregates]
aliases:
- /v2.0/query-data/guides/window-aggregate/
---
A common operation performed with time series data is grouping data into windows of time,

View File

@ -1,14 +0,0 @@
---
title: Flux how-to guides
description: Helpful guides that walk through both common and complex tasks and use cases for Flux.
weight: 103
v2.0/tags: [flux, query]
menu:
v2_0:
name: How-to guides
parent: Query data
---
The following guides walk through common query uses cases.
{{< children >}}

View File

@ -97,7 +97,7 @@ Function operators facilitate the creation of functions and control the flow of
---
_See [Custom functions](/v2.0/query-data/guides/custom-functions) for examples of function operators is use._
_See [Custom functions](/v2.0/query-data/flux/custom-functions) for examples of function operators is use._
---

View File

@ -928,7 +928,7 @@ Related entries: [bin](#bin)
### step-plot
In InfluxDB 1.x, a [step-plot graph](https://docs.influxdata.com/chronograf/v1.7/guides/visualization-types/#step-plot-graph) displays time series data in a staircase graph.
In InfluxDB 2.0, generate a similar graph using the step interpolation option for [line graphs](https://v2.docs.influxdata.com/v2.0/visualize-data/visualization-types/graph/#options).
In InfluxDB 2.0, generate a similar graph using the step interpolation option for [line graphs](/v2.0/visualize-data/visualization-types/graph/#options).
### stream
@ -997,7 +997,7 @@ Related entries: [function](#function)
A plugin-driven agent that collects, processes, aggregates, and writes metrics.
Related entries: [Automatically configure Telegraf](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/auto-config/), [Manually configure Telegraf](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/manual-config/), [Telegraf plugins](https://v2.docs.influxdata.com/v2.0/reference/telegraf-plugins/), [Use Telegraf to collect data](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/), [View a Telegraf configuration](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/auto-config/view-telegraf-config/)
Related entries: [Automatically configure Telegraf](/v2.0/write-data/use-telegraf/auto-config/), [Manually configure Telegraf](/v2.0/write-data/use-telegraf/manual-config/), [Telegraf plugins](/v2.0/reference/telegraf-plugins/), [Use Telegraf to collect data](/v2.0/write-data/use-telegraf/), [View a Telegraf configuration](/v2.0/write-data/use-telegraf/auto-config/view-telegraf-config/)
### time (data type)
@ -1026,12 +1026,12 @@ Related entries: [point](#point)
Tokens verify user and organization permissions in InfluxDB.
Related entries: [Create a token](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/).
Related entries: [Create a token](/v2.0/security/tokens/create-token/).
### tracing
By default, tracing is disabled in InfluxDB.
To enable tracing or set other InfluxDB configuration options, see [InfluxDB configuration options](https://v2.docs.influxdata.com/v2.0/reference/config-options/).
To enable tracing or set other InfluxDB configuration options, see [InfluxDB configuration options](/v2.0/reference/config-options/).
### transformation
@ -1115,4 +1115,4 @@ Related entries: [tsm](#tsm-time-structured-merge-tree)
### windowing
Grouping data based on specified time intervals.
For information about how to window in Flux, see [Window and aggregate data with Flux](https://v2.docs.influxdata.com/v2.0/query-data/guides/window-aggregate/).
For information about how to window in Flux, see [Window and aggregate data with Flux](/v2.0/query-data/flux/window-aggregate/).

View File

@ -162,11 +162,11 @@ A **point** includes the series key, a field value, and a timestamp. For example
## Bucket
All InfluxDB data is stored in a bucket. A **bucket** combines the concept of a database and a retention period (the duration of time that each data point persists). A bucket belongs to an organization. For more information about buckets, see [Manage buckets](https://v2.docs.influxdata.com/v2.0/organizations/buckets/).
All InfluxDB data is stored in a bucket. A **bucket** combines the concept of a database and a retention period (the duration of time that each data point persists). A bucket belongs to an organization. For more information about buckets, see [Manage buckets](/v2.0/organizations/buckets/).
## Organization
An InfluxDB **organization** is a workspace for a group of [users](/v2.0/users/). All [dashboards](/v2.0/visualize-data/dashboards/), [tasks](/v2.0/process-data/), buckets, and users belong to an organization. For more information about organizations, see [Manage organizations](https://v2.docs.influxdata.com/v2.0/organizations/).
An InfluxDB **organization** is a workspace for a group of [users](/v2.0/users/). All [dashboards](/v2.0/visualize-data/dashboards/), [tasks](/v2.0/process-data/), buckets, and users belong to an organization. For more information about organizations, see [Manage organizations](/v2.0/organizations/).
If you're just starting out, we recommend taking a look at the following guides:

View File

@ -16,7 +16,7 @@ InfluxDB 2.0 uses the following columnar table structure to store data:
- **Header row:** describes the data labels for each column in a row.
- **Data columns:** include the following columns: annotation, result, and table.
- **Data rows:** all rows that contain time series data. For details about the type of data stored in InfluxDB, see [InfluxDB data elements](/v2.0/reference/key-concepts/data-elements/).
- **Group keys** determine the contents of output tables in Flux by grouping records that share common values in specified columns. Learn more about [grouping your data with Flux](/v2.0/query-data/guides/group-data/).
- **Group keys** determine the contents of output tables in Flux by grouping records that share common values in specified columns. Learn more about [grouping your data with Flux](/v2.0/query-data/flux/group-data/).
For specifications on the InfluxDB 2.0 table structure, see [Tables](/v2.0/reference/syntax/annotated-csv/#tables).

View File

@ -34,7 +34,7 @@ See [Get started with Flux](/v2.0/query-data/get-started) to learn more about Fl
- Select a bucket to define your data source.
- Edit your time range with the [time range option](/select-time-range/) in the dropdown menu.
- Add filters to narrow your data by selecting attributes or columns in the dropdown menu.
- Select **Group** from the **Filter** dropdown menu to group data into tables. For more about how grouping data in Flux works, see [Group data](/v2.0/query-data/guides/group-data/).
- Select **Group** from the **Filter** dropdown menu to group data into tables. For more about how grouping data in Flux works, see [Group data](/v2.0/query-data/flux/group-data/).
3. Alternatively, click **Script Editor** to manually edit the query.
To switch back to the query builder, click **Query Builder**. Note that your updates from the Script Editor will not be saved.
4. Use the **Functions** list to review the available Flux functions.