The change in the counter during the time period specified by the bounds in the CounterSummary. To calculate the extrapolated delta, any counter resets are accounted for and the observed values are extrapolated to the bounds using the method specified, then the values are subtracted to compute the delta.

The bounds must be specified for the extrapolated_delta function to work, the bounds can be provided in the counter_agg call, or by using the with_bounds utility function to set the bounds.

extrapolated_delta(
summary CounterSummary,
method TEXT
) RETURNS DOUBLE PRECISION

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

NameTypeDescription
summaryCounterSummaryThe input CounterSummary from a counter_agg call
methodTEXTThe extrapolation method to use. Not case-sensitive.

Currently, the only allowed value of method is prometheus, as we have only implemented extrapolation following the Prometheus extrapolation protocol.

NameTypeDescription
extrapolated_deltaDOUBLE PRECISIONThe delta computed from the CounterSummary
SELECT
id,
bucket,
extrapolated_delta(
with_bounds(
summary,
toolkit_experimental.time_bucket_range('15 min'::interval, bucket)
),'prometheus'
)
FROM (
SELECT
id,
time_bucket('15 min'::interval, ts) AS bucket,
counter_agg(ts, val) AS summary
FROM foo
GROUP BY id, time_bucket('15 min'::interval, ts)
) t;

Found an issue on this page?

Report an issue!

Keywords

Related Content