Skip to content

Collector: sampled active-session wait states over an interval #306

Description

@fheikens

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort:MMedium effort (8-24 hours)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions