Skip to main content

Module pg_stats

Module pg_stats 

Source
Expand description

periodic self-observability collector for the metadata Postgres’s pg_stat_* views Periodic self-observability collector for the metadata Postgres: samples the standard pg_stat_* catalog views (plus index/table sizes) and emits the readings as micromegas metrics through the process’s own tracing sink. This turns questions that today can only be answered by connecting to the DB (e.g. which indexes are dead weight) into hard evidence queryable via FlightSQL.

The collector emits raw cumulative counters exactly as Postgres reports them and never resets any statistic (no pg_stat_reset* call anywhere in this module) — deltas and rates are a query-time concern, and pg_db_stats_reset_timestamp lets that analysis segment on counter-reset boundaries.

Modeled on object-cache-srv::saturation_monitor: a pure sampling function (collect_pg_stats) split from the scheduling plumbing (PgStatsTask), so it can be driven directly by tests.

Structs§

PgStatsTask
Cron task wiring: runs collect_pg_stats against the lakehouse’s metadata DB pool once per tick.

Functions§

collect_pg_stats
Samples all pg_stat_* families and emits them as metrics. Never issues a pg_stat_reset* call — only SELECTs.