increase() function

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.

*Function type: Transformation
**
Output data type:* Float

  1. increase(columns: ["_value"])

Parameters

columns

The columns to use in the operation. 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

  1. from(bucket: "example-bucket")
  2. |> range(start: -24h)
  3. |> filter(fn: (r) =>
  4. r._measurement == "system" and
  5. r._field == "n_users"
  6. )
  7. |> increase()

Given the following input table:

_time_value
000011
000025
000033
000044

increase() produces the following table:

_time_value
000024
000034
000045

Function definition

  1. increase = (tables=<-, column="_value") =>
  2. tables
  3. |> difference(nonNegative: true, column:column)
  4. |> cumulativeSum()

Related articles