Skip to content

Commit

Permalink
Add support for PG17 (#429)
Browse files Browse the repository at this point in the history
* feat: add support for PG17 bgw metrics

* feat: support pg17 bgwriter metrics

* docs: add changelog fragment
  • Loading branch information
keithf4 authored Sep 4, 2024
1 parent 42fb5f6 commit 3b74eed
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 50 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/428.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
major_changes:
- sql_exporter - add support for PG17
- grafana - add support for new metrics in PG17
14 changes: 7 additions & 7 deletions grafana/postgres/PG_Details.json
Original file line number Diff line number Diff line change
Expand Up @@ -2007,12 +2007,12 @@
"type": "prometheus",
"uid": "${ccp_datasource}"
},
"expr": "irate(ccp_stat_bgwriter_buffers_backend{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"expr": "irate(ccp_stat_io_bgwriter_writes{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "Backend",
"metric": "pg_stat_bgwriter_buffers_backend",
"legendFormat": "Writes",
"metric": "ccp_stat_io_bgwriter_writes",
"refId": "B",
"step": 120
},
Expand All @@ -2021,12 +2021,12 @@
"type": "prometheus",
"uid": "${ccp_datasource}"
},
"expr": "irate(ccp_stat_bgwriter_buffers_backend_fsync{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"expr": "irate(ccp_stat_io_bgwriter_fsyncs{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "FSync",
"metric": "pg_stat_bgwriter_buffers_backend_fsync",
"metric": "ccp_stat_io_bgwriter_fsyncs",
"refId": "C",
"step": 120
},
Expand All @@ -2035,12 +2035,12 @@
"type": "prometheus",
"uid": "${ccp_datasource}"
},
"expr": "irate(ccp_stat_bgwriter_buffers_checkpoint{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"expr": "irate(ccp_stat_checkpointer_buffers_written{cluster_name=\"[[pgcluster]]\", job=~\"[[pgnodes]]\"}[5m])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "CheckPoint",
"metric": "pg_stat_bgwriter_buffers_checkpoint",
"metric": "ccp_stat_checkpointer_buffers_written",
"refId": "D",
"step": 120
},
Expand Down
98 changes: 55 additions & 43 deletions sql_exporter/common/crunchy_global_collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,6 @@ metrics:
query_ref: ccp_settings_pending_restart


- metric_name: ccp_stat_bgwriter_checkpoints_timed
type: gauge
help: "Number of scheduled checkpoints that have been performed"
values: [checkpoints_timed]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_checkpoints_req
type: gauge
help: "Number of requested checkpoints that have been performed"
values: [checkpoints_req]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_checkpoint_write_time
type: gauge
help: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
values: [checkpoint_write_time]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_checkpoint_sync_time
type: gauge
help: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
values: [checkpoint_sync_time]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_buffers_checkpoint
type: gauge
help: "Number of buffers written during checkpoints"
values: [buffers_checkpoint]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_buffers_clean
type: gauge
help: "Number of buffers written by the background writer"
Expand All @@ -214,22 +189,52 @@ metrics:
help: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
values: [maxwritten_clean]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_buffers_backend
type: gauge
help: "Number of buffers written directly by a backend"
values: [buffers_backend]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_buffers_backend_fsync
type: gauge
help: "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)"
values: [buffers_backend_fsync]
query_ref: ccp_stat_bgwriter
- metric_name: ccp_stat_bgwriter_buffers_alloc
type: gauge
help: "Number of buffers allocated"
values: [buffers_alloc]
query_ref: ccp_stat_bgwriter


- metric_name: ccp_stat_checkpointer_num_timed
type: gauge
help: "Number of scheduled checkpoints that have been performed"
values: [num_timed]
query_ref: ccp_stat_checkpointer
- metric_name: ccp_stat_checkpointer_num_requested
type: gauge
help: "Number of requested checkpoints that have been performed"
values: [num_requested]
query_ref: ccp_stat_checkpointer
- metric_name: ccp_stat_checkpointer_write_time
type: gauge
help: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are written to disk, in milliseconds"
values: [write_time]
query_ref: ccp_stat_checkpointer
- metric_name: ccp_stat_checkpointer_sync_time
type: gauge
help: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are synchronized to disk, in milliseconds"
values: [sync_time]
query_ref: ccp_stat_checkpointer
- metric_name: ccp_stat_checkpointer_buffers_written
type: gauge
help: "Number of buffers written during checkpoints and restartpoints"
values: [buffers_written]
query_ref: ccp_stat_checkpointer


- metric_name: ccp_stat_io_bgwriter_writes
type: gauge
help: "Number of write operations by background writers"
values: [writes]
query_ref: ccp_stat_io_bgwriter
- metric_name: ccp_stat_io_bgwriter_fsyncs
type: gauge
help: "Number of fsync calls by background writers"
values: [fsyncs]
query_ref: ccp_stat_io_bgwriter


- metric_name: ccp_stat_database_xact_commit
type: gauge
help: "Number of transactions in this database that have been committed"
Expand Down Expand Up @@ -480,18 +485,25 @@ queries:
- query_name: ccp_stat_bgwriter
query: |
SELECT checkpoints_timed
, checkpoints_req
, checkpoint_write_time
, checkpoint_sync_time
, buffers_checkpoint
, buffers_clean
SELECT buffers_clean
, maxwritten_clean
, buffers_backend
, buffers_backend_fsync
, buffers_alloc
FROM pgmonitor_ext.ccp_stat_bgwriter
- query_name: ccp_stat_checkpointer
query: |
SELECT num_timed
, num_requested
, write_time
, sync_time
, buffers_written
FROM pgmonitor_ext.ccp_stat_checkpointer
- query_name: ccp_stat_io_bgwriter
query: |
SELECT writes
, fsyncs
FROM pgmonitor_ext.ccp_stat_io_bgwriter
- query_name: ccp_stat_database
query: |
Expand Down

0 comments on commit 3b74eed

Please sign in to comment.