wal: handle Aurora's pg_ls_waldir() unsupported error gracefully#1312
Open
megative wants to merge 1 commit into
Open
wal: handle Aurora's pg_ls_waldir() unsupported error gracefully#1312megative wants to merge 1 commit into
megative wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1309.
Amazon Aurora PostgreSQL rejects
pg_ls_waldir()withfeature_not_supported(Postgres error class0A). Thewalcollector 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: returnsnilfromUpdatewithout emitting metrics on Aurora. Other database errors still propagate normally.Design notes
NaNsentinel.0AAND"Aurora"substring in the message, so non-Aurora users see no behavior change.pg_wal.go/pg_wal_test.go); no overlap with @dannotripp'spg_replicationfix.Test plan
go build ./...,go vet ./...,go test ./...clean.TestPgWALCollectorAuroraverifies the Aurora fallback: collector returnsniland emits zero metrics when the query returns the Aurora-specific error.pg_wal_segments/pg_wal_sizestill emit normally.walcollector still reportssuccess=1and continues to emitpg_wal_segments(andpg_wal_size_byteswhen non-NULL).