2.5 KiB
title | description | aliases | menu | weight | flux/v0.x/tags | related | introduced | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
increase() function | The `increase()` function calculates the cumulative sum of **non-negative** differences between subsequent values. |
|
|
102 |
|
|
0.71.0 |
The increase()
function calculates the cumulative sum of non-negative differences
between subsequent values.
A main use case is tracking changes in counter values which may wrap over time
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.
increase(columns: ["_value"])
Parameters
columns
Columns to use in the operation.
Default is ["_value"]
.
tables
Input data.
Default is piped-forward data (<-
).
Output tables
For each input table with n
rows, increase()
outputs a table with n - 1
rows.
Examples
{{% flux/sample-example-intro %}}
import "sampledata"
sampledata.int()
|> increase()
{{< expand-wrapper >}} {{% expand "View input and output" %}} {{< flex >}} {{% flex-content %}}
Input data
{{% flux/sample "int" %}}
{{% /flex-content %}} {{% flex-content %}}
Output data
_time | tag | _value |
---|---|---|
2021-01-01T00:00:00Z | t1 | 0 |
2021-01-01T00:00:10Z | t1 | 12 |
2021-01-01T00:00:20Z | t1 | 19 |
2021-01-01T00:00:30Z | t1 | 29 |
2021-01-01T00:00:40Z | t1 | 44 |
2021-01-01T00:00:50Z | t1 | 48 |
_time | tag | _value |
---|---|---|
2021-01-01T00:00:00Z | t2 | 0 |
2021-01-01T00:00:10Z | t2 | 4 |
2021-01-01T00:00:20Z | t2 | 4 |
2021-01-01T00:00:30Z | t2 | 26 |
2021-01-01T00:00:40Z | t2 | 39 |
2021-01-01T00:00:50Z | t2 | 40 |
{{% /flex-content %}} {{< /flex >}} {{% /expand %}} {{< /expand-wrapper >}}