rate()

The rate of change of the counter over the observed time period. This is the raw or simple rate, equivalent to delta(summary) or time_delta(summary). After accounting for resets, the last value is subtracted from the first value and divided by the duration between the last observed time and the first observed time.

  1. rate(
  2. summary CounterSummary
  3. ) RETURNS DOUBLE PRECISION

For more information about counter aggregation functions, see the hyperfunctions documentation.

Required arguments

NameTypeDescription
summaryCounterSummaryThe input CounterSummary from a counter_agg call

Returns

NameTypeDescription
rateDOUBLE PRECISIONThe per second observed rate computed from the CounterSummary

Sample usage

  1. SELECT
  2. id,
  3. rate(summary)
  4. FROM (
  5. SELECT
  6. id,
  7. counter_agg(ts, val) AS summary
  8. FROM foo
  9. GROUP BY id
  10. ) t