Skip to content

Bug: wal collector crashes on Aurora PostgreSQL #1309

Description

@megative

Summary

The wal collector fails on Amazon Aurora PostgreSQL where
pg_ls_waldir() is not exposed, aborting the scrape every interval
and emitting no WAL metrics.

Root Cause

The collector calls pg_ls_waldir() to count and size WAL segments.
On Aurora the function returns:

ERROR: pg_ls_waldir() is currently not supported for Aurora

The collector treats any scan error as fatal, propagating it up and
killing the collector for that scrape.

Impact

Expected Behavior

When the underlying function returns the Aurora-specific
feature_not_supported error, the collector should degrade gracefully:
skip emitting pg_wal_segments / pg_wal_size instead of failing the
whole scrape.

Proposed Solution

Detect the Aurora-specific error (PostgreSQL error class 0A
(feature_not_supported) with "Aurora" in the message) inside
collector/pg_wal.go and short-circuit cleanly (skip emitting the
metrics, return without error). This mirrors the approach in #1274
which fixes the same class of bug for the replication collector.

Sketch:

err := row.Scan(&segments, &size)
if err != nil {
    if isAuroraUnsupportedFunction(err) {
        return nil // Aurora doesn't support pg_ls_waldir; skip silently
    }
    return err
}

isAuroraUnsupportedFunction is a tiny helper that checks
pqErr.Code.Class() == "0A" && strings.Contains(pqErr.Message, "Aurora").

Environment

  • postgres_exporter v0.19.x / current main
  • Amazon Aurora PostgreSQL versions where pg_ls_waldir() is restricted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions