Skip to content

postgres-exporter stat_replication collector fails every scrape (upstream slot_name bug) #41

Description

@Atsilut

Summary

With the monitoring Compose profile, postgres-exporter logs this error on every Prometheus scrape (~15s):

level=ERROR source=collector.go:227 msg="collector failed" name=stat_replication err="pq: column \"slot_name\" does not exist"

Postgres logs the same failing query against pg_stat_replication.

This is not a Tangle Postgres or version-pinning issue. It is an upstream bug in prometheuscommunity/postgres-exporter affecting the default-enabled stat_replication collector.

Root cause

PR prometheus-community/postgres_exporter#1306 (shipped in v0.20.0) rewrote the collector with an explicit column list that includes slot_name from pg_stat_replication:

SELECT application_name, client_addr::text, state, slot_name, ...
FROM pg_stat_replication

slot_name is not a column on pg_stat_replication on any supported PostgreSQL version (including our compose postgres:latest / pinned postgres:18.4). The column lives on pg_replication_slots and must be joined.

Upstream tracking:

v0.20.0 does not include the fix. Local compose using :latest and CI/prod pins using v0.19.1 are both affected (v0.19.1 has the same broken collector after the standalone refactor landed in the release line).

Impact on Tangle

  • Log spam in postgres-exporter and db containers when --profile monitoring is active
  • pg_stat_replication_* metrics are missing from Prometheus
  • Other postgres-exporter collectors (connections, activity, settings, etc.) still work
  • Low practical impact for local dev: compose db is single-node with no replication

Affected wiring:

  • docker-compose.ymlpostgres-exporter service (monitoring profile)
  • docker/versions.prod.envPOSTGRES_EXPORTER_IMAGE=prometheuscommunity/postgres-exporter:v0.19.1
  • infra/azure/parameters.prod.json — same pin for ACA tangle-study-postgres-exporter

Reproduction

docker compose --profile monitoring up
# watch postgres-exporter / db logs

Confirmed with prometheuscommunity/postgres-exporter:latest reporting version 0.20.0.

Proposed workaround

Disable the broken collector until upstream ships a fix:

postgres-exporter:
  command: ["--no-collector.stat_replication"]

Alternative: ignore the errors locally (harmless for dev).

Resolution criteria

  • Upstream merges and releases a fix (likely via PR #1313)
  • Bump POSTGRES_EXPORTER_IMAGE in docker/versions.prod.env / infra/azure/parameters.prod.json
  • Remove workaround if added
  • Verify pg_scrape_collector_success{collector="stat_replication"} = 1 after upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions