Skip to content

Commit

Permalink
Adds pg17 files to postgres_exporter (#435)
Browse files Browse the repository at this point in the history
* Adds pg17 files to postgres_exporter

* Adds a changelog fragment.

* fix: move bgwriter query from global to versioned general for postgres_exporter

---------

Co-authored-by: Anthony Landreth <[email protected]>
Co-authored-by: Keith Fiske <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 5fe6ceb commit 4e94297
Show file tree
Hide file tree
Showing 14 changed files with 960 additions and 40 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/435.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- postgres_exporter - Files to help transition off of postgres_exporter.
38 changes: 36 additions & 2 deletions postgres_exporter/common/pg11/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,42 @@
#
###

# There are currently no PG11 only queries that are not already in queries_global.yml
# This file is kept to allow consistent setting of QUERY_FILE_LIST in sysconfig with future PG versions
ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"

###
#
Expand Down
36 changes: 36 additions & 0 deletions postgres_exporter/common/pg12/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@
#
###

ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"

ccp_data_checksum_failure:
query: "SELECT datname AS dbname
Expand Down
36 changes: 36 additions & 0 deletions postgres_exporter/common/pg13/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@
#
###

ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"

ccp_data_checksum_failure:
query: "SELECT datname AS dbname
Expand Down
36 changes: 36 additions & 0 deletions postgres_exporter/common/pg14/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@
#
###

ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"

ccp_data_checksum_failure:
query: "SELECT datname AS dbname
Expand Down
37 changes: 37 additions & 0 deletions postgres_exporter/common/pg15/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@
#
###

ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"


ccp_data_checksum_failure:
query: "SELECT datname AS dbname
Expand Down
37 changes: 37 additions & 0 deletions postgres_exporter/common/pg16/queries_general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@
#
###

ccp_stat_bgwriter:
query: "SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, buffers_checkpoint, buffers_clean, maxwritten_clean, buffers_backend, buffers_backend_fsync, buffers_alloc, stats_reset FROM pg_catalog.pg_stat_bgwriter"
metrics:
- checkpoints_timed:
usage: "GAUGE"
description: "Number of scheduled checkpoints that have been performed"
- checkpoints_req:
usage: "GAUGE"
description: "Number of requested checkpoints that have been performed"
- checkpoint_write_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
- checkpoint_sync_time:
usage: "GAUGE"
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
- buffers_checkpoint:
usage: "GAUGE"
description: "Number of buffers written during checkpoints"
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_backend:
usage: "GAUGE"
description: "Number of buffers written directly by a backend"
- buffers_backend_fsync:
usage: "GAUGE"
description: "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)"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"
- stats_reset:
usage: "GAUGE"
description: "Time at which these statistics were last reset"


ccp_data_checksum_failure:
query: "SELECT datname AS dbname
Expand Down
44 changes: 44 additions & 0 deletions postgres_exporter/common/pg17/queries_general.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###
#
# Begin File: PG17 queries_general.yml
#
# Copyright © 2017-2024 Crunchy Data Solutions, Inc. All Rights Reserved.
#
###

ccp_stat_bgwriter:
query: "SELECT buffers_clean, maxwritten_clean, buffers_alloc FROM pg_catalog.pg_stat_bgwriter"
metrics:
- buffers_clean:
usage: "GAUGE"
description: "Number of buffers written by the background writer"
- maxwritten_clean:
usage: "GAUGE"
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
- buffers_alloc:
usage: "GAUGE"
description: "Number of buffers allocated"


ccp_data_checksum_failure:
query: "SELECT datname AS dbname
, checksum_failures AS count
, coalesce(extract(epoch from (clock_timestamp() - checksum_last_failure)), 0) AS time_since_last_failure_seconds
FROM pg_catalog.pg_stat_database;"
metrics:
- dbname:
usage: "LABEL"
description: "Database name"
- count:
usage: "GAUGE"
description: "Total number of checksum failures on this database"
- time_since_last_failure_seconds:
usage: "GAUGE"
description: "Time interval in seconds since the last checksum failure was encountered"


###
#
# End File: PG17 queries_general.yml
#
###
Loading

0 comments on commit 4e94297

Please sign in to comment.