resolved merge conflicts, deleted old collect data docs

pull/81/head
Scott Anderson 2019-03-07 10:13:20 -07:00
commit d519ba5b38
20 changed files with 315 additions and 36 deletions

View File

@ -337,7 +337,7 @@ Below is a list of available icons (some are aliases):
### InfluxDB UI left navigation icons
In many cases, documentation references an item in the left nav of the InfluxDB UI.
To provide a visual example of the the navigation item using the `nav-icon` shortcode.
Provide a visual example of the the navigation item using the `nav-icon` shortcode.
```
{{< nav-icon "Tasks" >}}

View File

@ -269,6 +269,7 @@
////////////////// Blockquotes, Notes, Warnings, & Messages //////////////////
blockquote,
.feedback,
.note,
.warn,
.enterprise-msg {
@ -383,6 +384,11 @@
}
}
.feedback {
border-color: rgba($article-note-base, .75);
background: rgba($article-text, .05);
}
///////////////////////////////// Enterprise /////////////////////////////////
.enterprise-msg {

View File

@ -51,6 +51,9 @@ The InfluxDB UI provides multiple ways to create a task:
### Import a task
1. Click on the **Tasks** icon in the left navigation menu.
{{< nav-icon "tasks" >}}
2. Click **Import** in the upper right.
3. Drag and drop or select a file to upload.
4. Click **Upload Task**.

View File

@ -1,6 +1,5 @@
---
title: Create custom Flux functions
seotitle: Create custom Flux functions
description: Create your own custom Flux functions to transform and manipulate data.
v2.0/tags: [functions, custom, flux]
menu:

View File

@ -1,6 +1,5 @@
---
title: Group data with Flux
seotitle: How to group data with Flux
title: Group data in InfluxDB with Flux
description: >
This guide walks through grouping data with Flux by providing examples and
illustrating how data is shaped throughout the process.

View File

@ -1,6 +1,5 @@
---
title: Create histograms with Flux
seotitle: How to create histograms with Flux
description: This guide walks through using the `histogram()` function to create cumulative histograms with Flux.
v2.0/tags: [histogram]
menu:

View File

@ -1,6 +1,6 @@
---
title: Join data with Flux
seotitle: How to join data with Flux
seotitle: Join data in InfluxDB with Flux
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:

View File

@ -0,0 +1,253 @@
---
title: Transform data with mathematic operations
seotitle: Transform data with mathematic operations in Flux
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
---
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,
supports mathematic expressions in data transformations.
This article describes how to use [Flux arithmetic operators](/v2.0/reference/flux/language/operators/#arithmetic-operator)
to "map" over data and transform values using mathematic operations.
##### Basic mathematic operations
```js
// Examples executed using the Flux REPL
> 9 + 9
18
> 22 - 14
8
> 6 * 5
30
> 21 / 7
3
```
<p style="font-size:.85rem;font-style:italic;margin-top:-2rem;">See <a href="/v2.0/reference/cli/influx/repl">Flux read-eval-print-loop (REPL)</a>.</p>
{{% note %}}
#### Operands must be the same type
Operands in Flux mathematic operations must be the same data type.
For example, integers cannot be used in operations with floats.
Otherwise, you will get an error similar to:
```
Error: type error: float != int
```
To convert operands to the same type, use [type-conversion functions](/v2.0/reference/flux/functions/built-in/transformations/type-conversions/)
or manually format operands.
The operand data type determines the output data type.
For example:
```js
100 // Parsed as an integer
100.0 // Parsed as a float
// Example evaluations
> 20 / 8
2
> 20.0 / 8.0
2.5
```
{{% /note %}}
## Custom mathematic functions
Flux lets you [create custom functions](/v2.0/query-data/guides/custom-functions) that use mathematic operations.
View the examples below.
###### Custom multiplication function
```js
multiply = (x, y) => x * y
multiply(x: 10, y: 12)
// Returns 120
```
###### Custom percentage function
```js
percent = (sample, total) => (sample / total) * 100.0
percent(sample: 20.0, total: 80.0)
// Returns 25.0
```
### Transform values in a data stream
To transform multiple values in an input stream, your function needs to:
- [Handle piped-forward data](/v2.0/query-data/guides/custom-functions/#functions-that-manipulate-piped-forward-data).
- Use the [`map()` function](/v2.0/reference/flux/functions/built-in/transformations/map) to iterate over each row.
The example `multiplyByX()` function below includes:
- A `tables` parameter that represents the input data stream (`<-`).
- An `x` parameter which is the number by which values in the `_value` column are multiplied.
- A `map()` function that iterates over each row in the input stream.
It uses the `_time` value of the input stream to define the `_time` value in the output stream.
It also multiples the `_value` column by `x`.
```js
multiplyByX = (x, tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
_value: r._value * x
})
)
data
|> multiplyByX(x: 10)
```
## Examples
### Convert bytes to gigabytes
To convert active memory from bytes to gigabytes (GB), divide the `active` field
in the `mem` measurement by 1,073,741,824.
The `map()` function iterates over each row in the piped-forward data and defines
a new `_value` by dividing the original `_value` by 1073741824.
```js
from(bucket: "default")
|> range(start: -10m)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "active"
)
|> map(fn: (r) => ({
_time: r._time,
_value: r._value / 1073741824
})
)
```
You could turn that same calculation into a function:
```js
bytesToGB = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
_value: r._value / 1073741824
})
)
data
|> bytesToGB()
```
#### Include partial gigabytes
Because the original metric (bytes) is an integer, the output of the operation is an integer and does not include partial GBs.
To calculate partial GBs, convert the `_value` column and its values to floats using the
[`float()` function](/v2.0/reference/flux/functions/built-in/transformations/type-conversions/float)
and format the denominator in the division operation as a float.
```js
bytesToGB = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
_value: float(v: r._value) / 1073741824.0
})
)
```
### Calculate a percentage
To calculate a percentage, use simple division, then multiply the result by 100.
{{% note %}}
Operands in percentage calculations should always be floats.
{{% /note %}}
```js
> 1.0 / 4.0 * 100.0
25.0
```
#### User vs system CPU usage
The example below calculates the percentage of total CPU used by the `user` vs the `system`.
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[Comments](#)
[No Comments](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```js
// Custom function that converts usage_user and
// usage_system columns to floats
usageToFloat = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
usage_user: float(v: r.usage_user),
usage_system: float(v: r.usage_system)
})
)
// Define the data source and filter user and system CPU usage
// from 'cpu-total' in the 'cpu' measurement
from(bucket: "default")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "cpu" and
r._field == "usage_user" or
r._field == "usage_system" and
r.cpu == "cpu-total"
)
// Pivot the output tables so usage_user and usage_system are in each row
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
// Convert usage_user and usage_system to floats
|> usageToFloat()
// Map over each row and calculate the percentage of
// CPU used by the user vs the system
|> map(fn: (r) => ({
_time: r._time,
usage_user: r.usage_user / (r.usage_user + r.usage_system) * 100.0,
usage_system: r.usage_system / (r.usage_user + r.usage_system) * 100.0
})
)
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```js
usageToFloat = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
usage_user: float(v: r.usage_user),
usage_system: float(v: r.usage_system)
})
)
from(bucket: "default")
|> range(start: timeRangeStart, stop: timeRangeStop)
|> filter(fn: (r) =>
r._measurement == "cpu" and
r._field == "usage_user" or
r._field == "usage_system" and
r.cpu == "cpu-total"
)
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
|> usageToFloat()
|> map(fn: (r) => ({
_time: r._time,
usage_user: r.usage_user / (r.usage_user + r.usage_system) * 100.0,
usage_system: r.usage_system / (r.usage_user + r.usage_system) * 100.0
})
)
```
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}

View File

@ -1,13 +1,12 @@
---
title: Use regular expressions in Flux
seotitle: How to use regular expressions in Flux
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: 209
weight: 210
---
Regular expressions (regexes) are incredibly powerful when matching patterns in large collections of data.

View File

@ -1,6 +1,6 @@
---
title: Sort and limit data with Flux
seotitle: How to sort and limit data with Flux
seotitle: Sort and limit data in InfluxDB with Flux
description: >
This guide walks through sorting and limiting data with Flux and outlines how
it shapes your data in the process.

View File

@ -1,6 +1,6 @@
---
title: Window and aggregate data with Flux
seotitle: How to window and aggregate data with Flux
seotitle: Window and aggregate data in InfluxDB with Flux
description: >
This guide walks through windowing and aggregating data with Flux and outlines
how it shapes your data in the process.

View File

@ -1,6 +1,6 @@
---
title: v1.tagValues() function
description: placeholder
description: The `v1.tagValues()` function returns a list unique values for a given tag.
menu:
v2_0_ref:
name: v1.tagValues
@ -12,7 +12,6 @@ v2.0/tags: [tags]
The `v1.tagValues()` function returns a list unique values for a given tag.
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"

View File

@ -6,6 +6,22 @@ menu:
name: Release notes
weight: 1
---
## v2.0.0-alpha.6 [2019-03-??]
### Features
- Add labels to cloned tasks.
- Add ability to filter resources by clicking a label.
### Bug Fixes
- Prevent clipping of code snippets in Firefox.
- Prevent clipping of cell edit menus in dashboards.
### UI Improvements
- Make code snippet copy functionality easier to use.
- Always show live preview in note cell editor.
- Redesign scraper creation workflow.
- Show warning in Telegraf and scraper lists when user has no buckets.
## v2.0.0-alpha.4 [2019-02-21]

View File

@ -12,10 +12,13 @@ draft: true
**To view tokens**:
1. Click the ?? icon in the navigation bar.
1. Click the **Influx** tab in the navigation bar.
{{< nav-icon "admin" >}}
2. In the right panel labeled **My Settings**, click **Tokens**. All of your account's tokens appear.
3. Click on a token name from the list to view the token and a summary of access permissions.
<<SCREENSHOT>>
**To copy a token**:
@ -24,14 +27,3 @@ draft: true
**To delete a token**:
* Hover over the name of a token in the list, then click **Delete**.
#### Tokens (/tokens)
* Table with Description, Last Used, and Organization columns
* Click on token name in Description column for Edit Token overlay
* Unlikely that user will use it, mostly in case of emergency
* Click on org name in Organization column to open organization page
* Generate token upper right
* Opens generate token overlay (tgo!)
* Also very unlikely that user will manually generate a token

View File

@ -15,6 +15,9 @@ to view tokens.
## View tokens in the InfluxDB UI
1. Click the **Influx** icon in the navigation bar.
{{< nav-icon "admin" >}}
2. In the right panel labeled **My Settings**, click **Tokens**. All of your account's tokens appear.
3. Click on a token name from the list to view the token and a summary of access permissions.

View File

@ -17,16 +17,18 @@ Create, edit, and manage dashboards from the **Dashboards** tab in the left navi
**To create a dashboard**:
1. Click the **Dashboards** icon in the navigation bar.
{{< nav-icon "dashboards" >}}
2. Click the **+Create Dashboard** button in the upper right.
3. Enter a name for your dashboard in the **Name this dashboard** field in the upper left.
#### Add data to your dashboard
1. From your dashboard, click **Add Cell** in the upper right. The Data Explorer overlay opens.
1. From your dashboard, click **Add Cell** (**{{< icon "add-cell" >}}**) in the upper right. The Data Explorer overlay opens.
2. Create a query in the Data Explorer following the instructions in [Explore metrics](/v2.0/visualize-data/explore-metrics).
3. Enter a name for your cell in the upper left.
4. Click the checkmark icon to save the cell to your dashboard.
4. Click the checkmark icon (**{{< icon "checkmark" >}}**) to save the cell to your dashboard.
You can also send data to your dashboard directly from the Data Explorer. For details, [Explore metrics](/v2.0/visualize-data/explore-metrics).
#### Add a note to your dashboard

View File

@ -27,13 +27,16 @@ analyzing, and acting on time series data.
See [Get started with Flux](/v2.0/query-data/get-started) to learn more about Flux.
1. Click the **Data Explorer** icon in the sidebar.
{{< nav-icon "data-explorer" >}}
2. Use the Flux builder in the bottom panel to select a bucket and filters such as measurement, field or tag.
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.
3. Use the **Functions** list to review the available Flux functions.
Click on a function from the list to add it to your query.
4. Click **Submit** to run your query. You can then preview your graph in the above pane.
5. To work on multiple queries at once, click the **+** to add another tab.
5. To work on multiple queries at once, click the {{< icon "plus" >}} to add another tab.
* Click the eye icon on a tab to hide or show a query's visualization.
* Click on the name of the query in the tab to rename it.

View File

@ -15,6 +15,9 @@ Like dashboards and buckets, data sources are scoped by organization. When you f
**To add data to a bucket**:
1. Click in the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}
2. Select the **Buckets** tab.
3. Next to the name of a bucket, click **Add Data**.
4. Select **Streaming**, **Line Protocol**, or **Scraping** from the data source options.
@ -24,6 +27,9 @@ Like dashboards and buckets, data sources are scoped by organization. When you f
**To manage Telegraf configurations**:
1. Click in the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}
2. Select the **Telegraf** tab. A list of existing Telegraf configurations appears.
3. To add a new Telegraf configuration:
* Click **Create Configuration** in the upper right.

View File

@ -31,7 +31,7 @@ To select this view, select the **Graph** option from the visualization dropdown
#### Graph Controls
To view **Graph** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Graph** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Geometry**: Select from the following options:
- **Line**: Display a time series in a line graph.
@ -73,7 +73,7 @@ To select this view, select the **Graph + Single Stat** option from the visualiz
#### Graph + Single Stat Controls
To view **Graph + Single Stat** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Graph + Single Stat** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Line Colors**: Select the a color scheme to use for your graph.
@ -112,7 +112,7 @@ To select this view, select the **Histogram** option from the visualization drop
#### Histogram Controls
To view **Histogram** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Histogram** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Data** section:
* **Column**: The column to select data from.
@ -135,7 +135,7 @@ To select this view, select the **Single Stat** option from the visualization dr
#### Single Stat Controls
To view **Single Stat** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Single Stat** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Customize Single-Stat** section:
* **Prefix**: Prefix to be added to the single stat.
@ -157,7 +157,7 @@ To select this view, select the **Gauge** option from the visualization dropdown
#### Gauge Controls
To view **Gauge** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Gauge** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Customize Gauge** section:
* **Prefix**: Prefix to be added to the gauge.
@ -182,7 +182,7 @@ To select this view, select the **Table** option from the visualization dropdown
#### Table Controls
To view **Table** controls, click the settings (gear) icon next to the visualization dropdown in the upper right.
To view **Table** controls, click the settings icon ({{< icon "gear" >}}) next to the visualization dropdown in the upper right.
* **Customize Table** section:
* **Default Sort Field**: Select the default sort field. Default is **time**.

View File

@ -1,5 +1,5 @@
<hr/>
<div class="note">
<div class="feedback">
<h4>Bug Reports and Feedback</h4>
<p>
Thank you for being willing to help test InfluxDB v2.0 alpha!