fix(postgresql_metrics source): Support PG17#23544
Open
biggerfisch wants to merge 3 commits intovectordotdev:masterfrom
Open
fix(postgresql_metrics source): Support PG17#23544biggerfisch wants to merge 3 commits intovectordotdev:masterfrom
biggerfisch wants to merge 3 commits intovectordotdev:masterfrom
Conversation
git-thuerk-done
previously approved these changes
Aug 6, 2025
Author
|
Hi @vectordotdev/vector - is this something that can be reviewed? TYVM! |
pront
reviewed
Aug 19, 2025
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! |
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 the
postgresql_metricssource to support PostgreSQL 17.In PG17, several metric values were moved from
pg_stat_bgwriterto a new view,pg_stat_checkpointer. This caused the existing queries here that feed the metrics to break, asthey 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_bgwritermetrics would disappear), so this is not a net behaviorregression 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
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Closes: #22094
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.cargo fmt --allcargo clippy --workspace --all-targets -- -D warningscargo nextest run --workspace(alternatively, you can runcargo test --all)git merge origin masterandgit push.Cargo.lock), pleaserun
cargo vdev build licensesto regenerate the license inventory and commit the changes (if any). More details here.