Documentation

experimental.integral() function

The experimental.integral() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.integral() function computes the area under the curve per unit of time of subsequent non-null records. The curve is defined using _time as the domain and record values as the range. Input tables must have _time and _value columns.

integral(
  unit: 10s,
  interpolate: ""
)

Parameters

unit

(Required) Time duration used to compute the integral.

Data type: Duration

interpolate

Type of interpolation to use. Defaults to "".

Use one of the following interpolation options:

  • empty string for no interpolation
  • linear

Data type: String

Examples

Calculate the integral
from(bucket: "example-bucket")
  |> range(start: -5m)
  |> filter(fn: (r) =>
    r._measurement == "cpu" and
    r._field == "usage_system"
  )
  |> integral(unit:10s)
Calculate the integral with linear interpolation
from(bucket: "example-bucket")
  |> range(start: -5m)
  |> filter(fn: (r) =>
    r._measurement == "cpu" and
    r._field == "usage_system"
  )
  |> integral(unit:10s, interpolate: "linear")

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.