Versions:

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.

rate(
    summary CounterSummary
) 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

SELECT
    id,
    rate(summary)
FROM (
    SELECT
        id,
        counter_agg(ts, val) AS summary
    FROM foo
    GROUP BY id
) t

Found an issue on this page?

Report an issue!

Related Content