deriv

Description

Calculate the average per-second derivative of the argument across the group.

deriv may produce negative values when the input time-series decreases over time.

When the argument is a metric defined using set_metric, deriv behaves differently according to the specified metric type:

  • for gauge metrics, deriv will retain the default behavior and calculate the per-second derivative. Negatives may be produced when the value is decreasing.

  • for cumulativeCounter metrics, deriv will assume the values to be monotonically increasing, and treats decreasing values as counter resets. Negatives will not be produced for cumulativeCounter metrics.

  • for delta metrics, deriv will sum up the values and then divide by the frame size to calculate average per-second derivative. Negatives may be produced upon negative delta values.

Return type

float or duration

Domain

This is an aggregate function (aggregates rows over a group in aggregate verbs.)

This is a window function (calculates over a group of multiple input rows using windowing.)

Categories

Usage

deriv(value)

Argument

Type

Optional

Repeatable

Restrictions

value

numeric or duration

no

no

none

Examples

align 5m, requests: deriv(m("failures"))

Computes the derivative of “failures” metric for each 5m time bins. The derivative can be positive or negative.