Summary
Add a collector that periodically samples active-session wait states over a short interval and reports an aggregated distribution, so downstream analysis can identify sustained bottlenecks. A single point-in-time snapshot of active sessions is already collected, but wait states are instantaneous — a distribution requires sampling over time.
Collect
- Over a bounded window, take N samples (configurable interval and count) of active backends'
wait_event_type / wait_event and state from pg_stat_activity.
- Report an aggregated top-N distribution (counts per
wait_event_type / wait_event over the window), not raw per-sample rows.
- If
pg_wait_sampling is available, prefer its aggregated view; otherwise fall back to the internal poll.
Notes
- Read-only, aggregate; no query text or identifiers needed for the distribution. Bounded sampling cost; follows the
*_v1 contract.
Why
Enables interval-based wait analysis (which resource class dominates during a slow period) that a single snapshot cannot provide.
Summary
Add a collector that periodically samples active-session wait states over a short interval and reports an aggregated distribution, so downstream analysis can identify sustained bottlenecks. A single point-in-time snapshot of active sessions is already collected, but wait states are instantaneous — a distribution requires sampling over time.
Collect
wait_event_type/wait_eventandstatefrompg_stat_activity.wait_event_type/wait_eventover the window), not raw per-sample rows.pg_wait_samplingis available, prefer its aggregated view; otherwise fall back to the internal poll.Notes
*_v1contract.Why
Enables interval-based wait analysis (which resource class dominates during a slow period) that a single snapshot cannot provide.