deriv(value: numeric or duration) -> value

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.

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

Examples

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


Did this page help you?