Calculate the change in a counter over a time period. Data points at the exact boundaries of the time period aren't needed. The function interpolates the counter values at the boundaries from adjacent CounterSummaries if needed.
interpolated_delta(summary CounterSummary,start TIMESTAMPTZ,interval INTERVAL,prev CounterSummary,next CounterSummary) RETURNS DOUBLE PRECISION
For more information about counter aggregation functions, see the hyperfunctions documentation.
|The input |
|The start of the interval which the delta should be computed over (if there is a preceeding point)|
|The length of the interval which the delta should cover|
|The delta between the first and last points of the time interval. If exact values are missing in the raw data for the first and last points, these values are interpolated linearly from the neighboring |
SELECTid,bucket,interpolated_delta(summary,bucket,'15 min',LAG(summary) OVER (PARTITION BY id ORDER by bucket),LEAD(summary) OVER (PARTITION BY id ORDER by bucket))FROM (SELECTid,time_bucket('15 min'::interval, ts) AS bucket,counter_agg(ts, val) AS summaryFROM fooGROUP BY id, time_bucket('15 min'::interval, ts)) t
Found an issue on this page?Report an issue!