prometheus-community / prometheus-community/postgres_exporter
Bug: Replication collector crashes on Aurora PostgreSQL
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 835
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 10
Description
Summary
The replication collector (pg_replication) fails on every scrape cycle when
running against Amazon Aurora PostgreSQL. This causes the entire collection
cycle to abort with an error, producing no metrics for that scrape interval.
Root Cause
Aurora PostgreSQL does not support pg_last_xact_replay_timestamp(). When the
replication collector executes its primary query, which calls this function,
Aurora returns:
ERROR: pg_last_xact_replay_timestamp() is currently not supported for Aurora
Because the collector treats any scan error as fatal, this error propagates up
and terminates the scrape. No replication metrics (including is_replica, which
Aurora can answer) are emitted.
Impact
- Any postgres_exporter deployment targeting Aurora PostgreSQL instances loses
all replication metrics on every scrape. - The error appears in exporter logs on every scrape interval, producing noise.
pg_replication_is_replica, which is useful for distinguishing writer from
reader instances, is never emitted even though Aurora supports
pg_is_in_recovery().
Expected Behavior
The collector should degrade gracefully on Aurora: emit NaN for the
time-based metrics that rely on pg_last_xact_replay_timestamp(), and still
emit pg_replication_is_replica using the supported pg_is_in_recovery()
function.
Environment
- postgres_exporter v0.19.x
- Amazon Aurora PostgreSQL (any version)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the pg_replication collector and inspect its primary query, especially the use of pg_last_xact_replay_timestamp() and pg_is_in_recovery(). Reproduce the Aurora error if an Aurora instance is available, then verify that unsupported time-based metrics become NaN while pg_replication_is_replica is still emitted and the scrape continues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, go, postgres
- Domain
- databases, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100