Samples
Create a counter aggregate for eachid and each 15-minute interval. Then add bounds to the counter aggregate, so you
can calculate the extrapolated rate.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Add bounds to a counter aggregate
id and each 15-minute interval. Then add bounds to the counter aggregate, so you
can calculate the extrapolated rate.
SELECT
id,
bucket,
extrapolated_rate(
with_bounds(
summary,
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
with_bounds(
summary CounterSummary,
bounds TSTZRANGE,
) RETURNS CounterSummary
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
summary | CounterSummary | - | ✔ | A counter aggregate created using counter_agg |
bounds | TSTZRANGE | - | ✔ | A range of timestamptz giving the smallest and largest allowed times in the counter aggregate |
| Column | Type | Description |
|---|---|---|
| with_bounds | CounterSummary | A new counter aggregate with the bounds applied |