Skip to content

Conversation

@The-East-Wind
Copy link

@The-East-Wind The-East-Wind commented Oct 27, 2025

This PR aims to resolve #6657

I'm creating this as a draft PR to confirm if the approach to fixing this is correct.

This has some rough edges which I'll be polishing once the approach is validated.

Stats removed in Pg 17 and their alternatives:

< Pg17 Pg17+
pg_stat_bgwriter.checkpoints_timed pg_stat_checkpointer.num_timed
pg_stat_bgwriter.checkpoints_req pg_stat_checkpointer.num_requested
pg_stat_bgwriter.buffers_backend SUM(pg_stat_io.writes)
pg_stat_bgwriter.buffers_checkpoint pg_stat_checkpointer.buffers_written

Reference: https://www.postgresql.org/docs/17/monitoring-stats.html

Rough edges:

  1. Move the version check condition out of the consumer function to the registration level to avoid condition execution everytime consumer is invoked.
  2. Implement a better pattern to have multiple stat sources (different views, tables, etc.) for the same metric and choosing one of them based on some condition (server version in this case).
  3. Implemet a better pattern to easily map the metrics to their sources.
  4. See if some form of parametrisation can be done to the integration tests to run the same tests against multiple postgres containers with different versions instead of creating duplicate integration test classes.

Copy link
Member

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

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

The general approach here looks good to me. I'm not sure if @jonatan-ivanov has any thoughts on it or not.

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.

PostgreSQLDatabaseMetrics polls unexisting columns in Postgresql17

3 participants