Skip to content

feat: add transaction ID age to postgres_exporter - #2375

Merged
valigula merged 3 commits into
developfrom
andres/INDATA-1261-add-max-transaction-id-age-metric
Aug 31, 2026
Merged

feat: add transaction ID age to postgres_exporter#2375
valigula merged 3 commits into
developfrom
andres/INDATA-1261-add-max-transaction-id-age-metric

Conversation

@valigula

@valigula valigula commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

feature INDATA-1261
related https://github.com/supabase/salt/pull/825

What is the current behavior?

What is the new behavior?

Add pg_wraparound custom metric to postgres_exporter that tracks the maximum transaction ID age across all databases. This enables proactive monitoring of wraparound risk before it reaches critical thresholds.

  • New queries.yml with max(age(datfrozenxid)) query
  • Deployed to /opt/postgres_exporter/ via Ansible

Additional context

Test

@valigula
valigula requested review from a team as code owners August 18, 2026 12:41
@valigula
valigula requested a lite review from Copilot August 18, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a custom postgres_exporter metric to monitor wraparound risk by exporting the maximum age(datfrozenxid) across all databases, deployed via Ansible.

Changes:

  • Deploy a new queries.yml containing the pg_wraparound custom query/metric definition.
  • Copy queries.yml into /opt/postgres_exporter/ during exporter provisioning.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ansible/tasks/internal/postgres-exporter.yml Copies the new custom queries.yml into the exporter install directory during provisioning.
ansible/files/queries.yml Defines the pg_wraparound extended query exporting max transaction ID age across databases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ansible/tasks/internal/postgres-exporter.yml Outdated
Comment thread ansible/files/queries.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@valigula
valigula marked this pull request as draft August 21, 2026 15:52
postgres_exporter (v0.15.0, pinned in this repo's Ansible) already ships
a database_wraparound collector reading both datfrozenxid and datminmxid
from pg_database, covering XID and MultiXactId wraparound risk. It is
defaultDisabled (registered via collector.database_wraparound.go), so it
needs an explicit --collector.database_wraparound flag to turn on.

Supersedes the custom pg_wraparound query added in the previous commits
on this branch: that approach only tracked XID age and missed
MultiXactId wraparound, a separate, independently-reachable shutdown
condition. Mirrors the same pivot in supabase/salt#825.

Exposes per-database:
- pg_database_wraparound_age_datfrozenxid_seconds (XID age)
- pg_database_wraparound_age_datminmxid_seconds (MultiXactId age)

Related: INDATA-1261
@valigula
valigula force-pushed the andres/INDATA-1261-add-max-transaction-id-age-metric branch from 801c69c to 8be6636 Compare August 26, 2026 07:19
@valigula
valigula marked this pull request as ready for review August 27, 2026 15:29
@valigula
valigula added this pull request to the merge queue Aug 31, 2026
Merged via the queue into develop with commit fe79ba8 Aug 31, 2026
72 of 74 checks passed
@valigula
valigula deleted the andres/INDATA-1261-add-max-transaction-id-age-metric branch August 31, 2026 14:09
hunleyd added a commit that referenced this pull request Sep 1, 2026
…pgbackrest-archive-async-spool-path-defaults-onto-the-10gb-root-volume

* origin/develop:
  AMI: Clean up messy apt handling (#2351)
  feat: enable built-in database_wraparound collector in postgres_exporter (#2375)
  chore: bump postgres_release to cut fresh AMIs (includes #2399) (#2406)
  fix : idle and max connection duration timeouts to Envoy HTTP listeners (#2403)
  fix(cron): revoke TRIGGER on cron.job_run_details with CASCADE (#2399)
  ci: fix update-flake-lock workflow (app token + update-flake-lock action) (#2281)
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.

4 participants