extrapolated_rate()

The rate of change in the counter computed over the time period specified by the bounds in the CounterSummary, extrapolating to the edges. It is an extrapolated_delta divided by the duration in seconds.

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

2. extrapolated_rate(

4. summary CounterSummary,

6. method TEXT

8. ) RETURNS DOUBLE PRECISION

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

Required arguments

Name Type Description
summary CounterSummary The input CounterSummary from a counter_agg call
method TEXT The 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.

Returns

Name Type Description
extrapolated_rate DOUBLE PRECISION The per-second rate of change of the counter computed from the CounterSummary extrapolated to the bounds specified there.

Sample usage

2. SELECT

4. id,

6. bucket,

8. extrapolated_rate(

10. with_bounds(

12. summary,

14. time_bucket_range('15 min'::interval, bucket)

16. )

18. )

20. FROM (

22. SELECT

24. id,

26. time_bucket('15 min'::interval, ts) AS bucket,

28. counter_agg(ts, val) AS summary

30. FROM foo

32. GROUP BY id, time_bucket('15 min'::interval, ts)

34. ) t