Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.9 KB
Raw Blame

pgcollector — Postgres telemetry collector

rust/pgcollector scrapes telemetry from our RDS/Aurora clusters (pgstat*, Aurora stat functions, pg_proctab, CloudWatch-exported logs) into a stats Postgres. rust/pgapi (pgapi.md) serves the data. Design, catalog and deployment details live in the crate: DESIGN.md, docs/deploy.md, docs/telemetry-sources.md.

Contract

  • Inputs: one pg_monitor-tier user per monitored cluster, discovered from PGCOLLECTOR_SERVER_<ID>_URL / _READER_URL / _LOG_GROUP env vars (one golden-chart psql: entry per cluster), plus a TOML config for the sink and defaults. pgbouncer: false everywhere: sessions set GUCs.
  • Output: partitioned ts_* time series, cur_* current state, events, collector_runs in the stats database, daily partitions, retention_days. A collector adds columns to its table when its SELECT gains a column. Statement-bearing tables carry a tags jsonb column parsed from query comments (/* key=value */); see docs/query-tags.md for the accepted shapes and the key vocabulary.
  • Load: every session runs with statement_timeout = 5s / lock_timeout = 1s; per-collector cost is tabulated in docs/deploy.md "Load profile". Per-backend collectors ship off by default.
  • Security: TLS required for sink and targets unless the URL says sslmode=disable/prefer; the collector's own statements are kept out of the server log; statement text taken from logs and pg_stat_activity is stored with string literals redacted; pg_stat_statements text is already normalised by Postgres.
  • Ops: /healthz, /readyz, /metrics on :9187; --check, --once, --parse-log for validation.