Versions:

delta()

The change in the counter over the time period. This is the raw or simple delta computed by accounting for resets and subtracting the last seen value from the first.

delta(
    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
deltaDOUBLE PRECISIONThe delta computed from the CounterSummary

Sample usage

SELECT
    id,
    delta(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