pg_argus
pg_argus · Schedule read-only SQL metric collection and OTLP export
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102464 | pg_argus | pg_argus | 0.3.0 | STAT | Apache-2.0 | Rust |
PostgreSQL · 18, 19
Usage
Sources:
- README.md
- crates/pg_argus/Cargo.toml
- crates/pg_argus/pg_argus.control
- crates/pg_argus/src/lib.rs
- crates/pg_argus/src/status.rs
- crates/pg_argus/src/guc.rs
- crates/pg_argus/src/collector.rs
- docs/design.md
pg_argus runs scheduled SQL queries inside PostgreSQL and exports their results as OpenTelemetry metrics over OTLP/HTTP. Release 0.3.0 unifies the repository crates and packages under one release version. Its independent SQL/control version is 1.0. Supported platforms are Linux amd64 and arm64 with PostgreSQL 18 or 19; this remains an early preview.
Enable Collection
After installing the matching library, create a monitoring role as an administrator. The collector uses the configured role’s database privileges; it does not use a client password or consume a normal client connection slot.
Add the library to the existing preload list and configure the endpoint and query files:
Increase max_worker_processes by 2 plus pg_argus.max_collectors (default 2), then restart PostgreSQL. Preserve other entries already in shared_preload_libraries. Query files use the CloudNativePG Monitoring custom-query format. Grant the monitoring role access to each monitored database and the objects its queries need; CloudNativePG may require explicit database CONNECT grants.
Observe Workers
Preloading starts collection. Creating the extension is optional and supplies the status function in the fixed argus schema; it requires a superuser and an already preloaded library.
The launcher schedules per-database collectors and maintains the current shared-memory samples. A separate exporter performs network I/O. Collectors use read-only transactions with statement and lock limits. A superuser monitoring role is rejected. Set pg_argus.metric_prefix to cnpg when using dashboards expecting CloudNativePG metric names.
Operational Limits
This source is a preview whose production readiness remains under review. Only metrics are implemented in the reviewed revision: query events and server-log export are design work, even though status columns reserve space for them. Export failures do not block SQL collection, but samples are not a durable delivery queue. Protect query files, TLS material and endpoint configuration as server configuration, and avoid sensitive query results or unbounded label cardinality.