gauge_agg()

warning

Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.

Only DOUBLE PRECISION values are accepted for the value parameter. For gauge data stored as other numeric types, cast it to DOUBLE PRECISION when using the function.

note
important

Bounds are required for extrapolation, but not for other accessor functions.

important

Create a gauge summary from time-series data that has a timestamp, ts, and a gauge value, val. Get the instantaneous rate of change from the last 2 time intervals using the irate_right accessor:

  1. WITH t as (
  2. SELECT
  3. time_bucket('1 day'::interval, ts) as dt,
  4. gauge_agg(ts, val) AS gs
  5. FROM foo
  6. WHERE id = 'bar'
  7. )
  8. SELECT
  9. dt,
  10. irate_right(gs)