toDuration() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.65 is the most recent stable version of Flux.

toDuration() was removed in Flux 0.37.

The toDuration() function converts a value to a duration.

Function type: Type conversion
Output data type: Duration

toDuration()

To convert values in a column other than _value, define a custom function patterned after the function definition, but replace _value with your desired column.

Examples

from(bucket: "telegraf")
  |> filter(fn:(r) =>
    r._measurement == "mem" and
    r._field == "used"
  )
  |> toDuration()

Function definition

toDuration = (tables=<-) =>
  tables
    |> map(fn:(r) => ({ r with _value: duration(v: r._value) }))