cloudnative-pg
cloudnative-pg copied to clipboard
feat: add metrics for pg_stat_checkpointer in v17+
Closes #3411
:exclamation: By default, the pull request is configured to backport to all release branches.
- To stop backporting this pr, remove the label: backport-requested :arrow_backward: or add the label 'do not backport'
- To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y
IMHO, this patch should have first fixed the issue for 17 then added pg_stat_checkpointer.
Because the query mapping needs to be unique (even though the 2 queries are mutually exclusive), I've distinguished the bgwriter metric's name in the following way:
- for PG17 and onward:
pg_stat_background_writer
- for PG16 and lower:
pg_stat_bgwriter
(retaining the same name)
I've also thought about including and serving the 4 remaining bgwriter columns directly from the pg_stat_checkpointer
query (on PG17+) but I figured it would be even more confusing this way, so I opted for the previous solution.
Tests running on: https://github.com/cloudnative-pg/postgres-trunk-containers/actions/runs/8881859306
/test depth=push limit=local test_level=4 feature_type=observability
@sxd, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/8939199640
I don't like the idea to generate metrics with different names from the same table, although on different postgres version.
Additionally, such changes should affect the grafana dashboard as well.
Superseded by https://github.com/cloudnative-pg/cloudnative-pg/pull/4779
:exclamation: By default, the pull request is configured to backport to all release branches.
- To stop backporting this pr, remove the label: backport-requested :arrow_backward: or add the label 'do not backport'
- To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y