derive(set[], options={})

Given an arbitrary number of series, performs the derivative on each series to return a set of equal length. This is generally useful when the specified series are absolute counters where each value is the previous value plus some delta and you want to examine the rate of change. The derivative operation results in a series where each value is the delta from the previous step in the original series. The options map may be included with the following key:

  • detect_reset - Boolean that toggles the method by which the delta from the previous sample is calculated. When set to false (the default), the delta is calculated as the simple subtraction of current - previous. If set to true the counter is assumed to be always increasing and any time the current value is less than the previous value is considered a reset of the counter. When resets are encountered the delta is calculated as the current value, otherwise it’s current - previous as before.

Example:

The following expression returns the estimated AWS daily charges for the us-east-1 region by finding the derivative over 1 day (86400 seconds):

derive(
   series("AWS.Billing.EstimatedCharges.total",
   {"region": "*"}",
   {function:"max",period: "86400"}),
   {detect_reset:"true"}
)

The chart displays the count of AWS.Billing.EstimatedCharges.total (total monthly charges) and the billing rate per day (created by the composite metric):

daily-estimated-charges