Skip to content

wal: handle Aurora's pg_ls_waldir() unsupported error gracefully#1312

Open
megative wants to merge 1 commit into
prometheus-community:masterfrom
megative:fix/wal-aurora-fallback
Open

wal: handle Aurora's pg_ls_waldir() unsupported error gracefully#1312
megative wants to merge 1 commit into
prometheus-community:masterfrom
megative:fix/wal-aurora-fallback

Conversation

@megative

Copy link
Copy Markdown

Summary

Fixes #1309.

Amazon Aurora PostgreSQL rejects pg_ls_waldir() with feature_not_supported (Postgres error class 0A). The wal collector currently treats this as fatal, aborting every scrape on Aurora and producing no WAL metrics.

This PR detects the Aurora-specific error fingerprint (class 0A + "Aurora" in the message) and short-circuits cleanly: returns nil from Update without emitting metrics on Aurora. Other database errors still propagate normally.

Design notes

Test plan

  • go build ./..., go vet ./..., go test ./... clean.
  • New test TestPgWALCollectorAurora verifies the Aurora fallback: collector returns nil and emits zero metrics when the query returns the Aurora-specific error.
  • Vanilla PostgreSQL 17 unaffected — pg_wal_segments / pg_wal_size still emit normally.
  • Live-tested against Aurora PostgreSQL 17.7.0 — wal collector still reports success=1 and continues to emit pg_wal_segments (and pg_wal_size_bytes when non-NULL).

On Amazon Aurora PostgreSQL, pg_ls_waldir() returns a feature_not_supported error (Postgres error class "0A"). The wal collector currently treats this as fatal, aborting every scrape on Aurora instances and producing no WAL metrics.

Detect the Aurora-specific error fingerprint (class "0A" + "Aurora" in the message) and short-circuit cleanly: return nil from Update without emitting metrics, matching the pattern reviewers suggested for the analogous pg_replication fix in prometheus-community#1274 (non-emission over NaN).

Other database errors still propagate normally.

Fixes prometheus-community#1309.

Signed-off-by: Pavel K <megativ3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: wal collector crashes on Aurora PostgreSQL

1 participant