stateDuration() function
*Function type: Transformation
**Output data type:* Duration
As the first point in the given state has no previous point, its state duration will be 0.
Make sure fn
parameter names match each specified parameter. To learn why, see Match parameter names.
A single argument function that evaluates true or false to identify the state of the record. Records are passed to the function. Those that evaluate to true
increment the state duration. Those that evaluate to reset the state duration.
The name of the column added to each record that contains the state duration.
*Data type: String*
*Data type: Duration*
Examples
from("monitor/autogen")
|> filter(fn: (r) => r._measurement == "http")
fn: (r) => r.http_response_code == "500",
column: "server_error_duration"
)