Skip to content

fix(postgresql_metrics source): Support PG17#23544

Open
biggerfisch wants to merge 3 commits intovectordotdev:masterfrom
biggerfisch:01-08-25_enhancement_postgresql_metrics_pg_17
Open

fix(postgresql_metrics source): Support PG17#23544
biggerfisch wants to merge 3 commits intovectordotdev:masterfrom
biggerfisch:01-08-25_enhancement_postgresql_metrics_pg_17

Conversation

@biggerfisch
Copy link

Summary

Fixes the postgresql_metrics source to support PostgreSQL 17.

In PG17, several metric values were moved from pg_stat_bgwriter to a new view,
pg_stat_checkpointer. This caused the existing queries here that feed the metrics to break, as
they relied on those columns being present.

To fix this, the source now inspects the version of the server and dynamically decides what metrics
to expect and what views may be queried for them.

Since the metric names include the name of the view they were sourced from, this does mean that
after this change ships, a user upgrading to PG 17 from a lower version would see some metrics
disappear and similar ones appear. However, without this change, no new metrics would appear (and
indeed, all of the pg_stat_bgwriter metrics would disappear), so this is not a net behavior
regression IMHO.

Vector configuration

Did not test outside of integration testing yet at this time.

How did you test this PR?

Updated integration tests to test against PostgreSQL versions 13.1 (the existing test setup) and
17.5 (the latest version that should now be supported). The updated tests consider the version under
test and expect different metrics to be present based on the version.

Did not test outside of integration testing yet at this time.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Closes: #22094

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run cargo vdev build licenses to regenerate the license inventory and commit the changes (if any). More details here.

@biggerfisch biggerfisch requested review from a team as code owners August 6, 2025 21:13
@github-actions github-actions bot added domain: sources Anything related to the Vector's sources domain: ci Anything related to Vector's CI environment domain: external docs Anything related to Vector's external, public documentation labels Aug 6, 2025
git-thuerk-done
git-thuerk-done previously approved these changes Aug 6, 2025
@biggerfisch
Copy link
Author

Hi @vectordotdev/vector - is this something that can be reviewed? TYVM!

Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Thanks!

@pront pront enabled auto-merge August 19, 2025 20:40
@pront pront disabled auto-merge August 19, 2025 20:50
@pront pront enabled auto-merge August 19, 2025 20:50
@thomasqueirozb
Copy link
Contributor

Hi @biggerfisch, this branch now has some merge conflicts and it seems like you didn't allow pushes to your fork, therefore I cannot fix them. Please fix these and then we can merge, thanks!

@thomasqueirozb thomasqueirozb added the meta: awaiting author Pull requests that are awaiting their author. label Aug 29, 2025
@pront pront disabled auto-merge February 20, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: ci Anything related to Vector's CI environment domain: external docs Anything related to Vector's external, public documentation domain: sources Anything related to the Vector's sources meta: awaiting author Pull requests that are awaiting their author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postgresql_metrics Vector source does not work with PostgreSQL 17

4 participants