How catrilao/pg_guardian works
PG Guardian is a PostgreSQL background-worker extension that periodically runs registered analyzers against the connected database and logs findings. The implemented path is currently the storage analyzer: the worker initializes its SPI plan, then runs it on a timed loop and processes matching relation names. The README lists other possible analysis areas, but the sampled tree exposes only storage analysis; those areas are not represented as implemented components. The graph reflects the available source and documented worker architecture.
Main entry points: storage.c Storage analyzer · pg_guardian.c Background worker · analyzer.c Plan and execute
Components 10
Worker runtime
- Background worker
src/pg_guardian.c - Worker configuration
src/pg_guardian.c
Analyzer framework
- Plan and execute
src/analyzer.c
Storage analysis
- Storage settings
src/analyzers/storage.c - Storage analyzer
src/analyzers/storage.c - Logged relation names
src/analyzers/storage.c
Other components
- PostgreSQL server
- Monitored database
- PostgreSQL SPI
- Relation catalog
Connections 14
- PostgreSQL server → Background worker: loads extension
- Background worker → Worker configuration: registers settings
- Background worker → Storage analyzer: registers analyzer
- Storage analyzer → Storage settings: registers settings
- Background worker → Monitored database: connects to
- Background worker → Storage analyzer: initializes and schedules
- Storage analyzer → Plan and execute: initializes plan
- Plan and execute → PostgreSQL SPI: prepares query
- Background worker → Storage analyzer: dispatches execution
- Storage analyzer → Plan and execute: executes plan
- Plan and execute → PostgreSQL SPI: executes query
- PostgreSQL SPI → Relation catalog: reads relations
- Plan and execute → Storage analyzer: passes results
- Storage analyzer → Logged relation names: logs names