-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add support for PG16 * chore: update changelog and docs
- Loading branch information
Showing
8 changed files
with
731 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
major_changes: | ||
- postgres_exporter - Add support for PostgreSQL 16 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### | ||
# | ||
# Begin File: PG16 queries_general.yml | ||
# | ||
# Copyright © 2017-2023 Crunchy Data Solutions, Inc. All Rights Reserved. | ||
# | ||
### | ||
|
||
|
||
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: PG16 queries_general.yml | ||
# | ||
### |
169 changes: 169 additions & 0 deletions
169
postgres_exporter/common/pg16/queries_pg_stat_statements.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
### | ||
# | ||
# Begin File: PG16 queries_pg_stat_statements.yml | ||
# | ||
# Copyright © 2017-2023 Crunchy Data Solutions, Inc. All Rights Reserved. | ||
# | ||
### | ||
|
||
ccp_pg_stat_statements_total: | ||
query: "SELECT pg_get_userbyid(s.userid) as role, | ||
d.datname AS dbname, | ||
sum(s.calls) AS calls_count, | ||
sum(s.total_exec_time) AS exec_time_ms, | ||
avg(s.mean_exec_time) AS mean_exec_time_ms, | ||
sum(s.rows) AS row_count | ||
FROM public.pg_stat_statements s | ||
JOIN pg_catalog.pg_database d | ||
ON d.oid = s.dbid | ||
GROUP BY 1,2" | ||
metrics: | ||
- role: | ||
usage: "LABEL" | ||
description: "Role that executed the statement" | ||
- dbname: | ||
usage: "LABEL" | ||
description: "Database in which the statement was executed" | ||
- calls_count: | ||
usage: "GAUGE" | ||
description: "Total number of queries run per user/database" | ||
- exec_time_ms: | ||
usage: "GAUGE" | ||
description: "Total runtime of all queries per user/database" | ||
- mean_exec_time_ms: | ||
usage: "GAUGE" | ||
description: "Mean runtime of all queries per user/database" | ||
- row_count: | ||
usage: "GAUGE" | ||
description: "Total rows returned from all queries per user/database" | ||
|
||
|
||
ccp_pg_stat_statements_top_mean: | ||
query: "SELECT pg_get_userbyid(s.userid) as role, | ||
d.datname AS dbname, | ||
s.queryid, | ||
btrim(replace(left(s.query, 40), '\n', '')) AS query, | ||
max(s.mean_exec_time) exec_time_ms | ||
FROM public.pg_stat_statements s | ||
JOIN pg_catalog.pg_database d | ||
ON d.oid = s.dbid | ||
GROUP BY 1,2,3,4 | ||
ORDER BY 5 DESC | ||
LIMIT #PG_STAT_STATEMENTS_LIMIT#" | ||
metrics: | ||
- role: | ||
usage: "LABEL" | ||
description: "Role that executed the statement" | ||
- dbname: | ||
usage: "LABEL" | ||
description: "Database in which the statement was executed" | ||
- queryid: | ||
usage: "LABEL" | ||
description: "Internal hash code, computed from the statement's parse tree" | ||
- query: | ||
usage: "LABEL" | ||
description: "First 40 characters of query text" | ||
- exec_time_ms: | ||
usage: "GAUGE" | ||
description: "Average query runtime in milliseconds" | ||
|
||
|
||
ccp_pg_stat_statements_top_total: | ||
query: "SELECT pg_get_userbyid(s.userid) as role, | ||
d.datname AS dbname, | ||
s.queryid, | ||
btrim(replace(left(s.query, 40), '\n', '')) AS query, | ||
s.total_exec_time exec_time_ms | ||
FROM public.pg_stat_statements s | ||
JOIN pg_catalog.pg_database d | ||
ON d.oid = s.dbid | ||
ORDER BY 5 DESC | ||
LIMIT #PG_STAT_STATEMENTS_LIMIT#" | ||
metrics: | ||
- role: | ||
usage: "LABEL" | ||
description: "Role that executed the statement" | ||
- dbname: | ||
usage: "LABEL" | ||
description: "Database in which the statement was executed" | ||
- queryid: | ||
usage: "LABEL" | ||
description: "Internal hash code, computed from the statement's parse tree" | ||
- query: | ||
usage: "LABEL" | ||
description: "First 40 characters of query text" | ||
- exec_time_ms: | ||
usage: "GAUGE" | ||
description: "Total time spent in the statement in milliseconds" | ||
|
||
|
||
ccp_pg_stat_statements_top_max: | ||
query: "SELECT pg_get_userbyid(s.userid) as role, | ||
d.datname AS dbname, | ||
s.queryid, | ||
btrim(replace(left(s.query, 40), '\n', '')) AS query, | ||
s.max_exec_time AS exec_time_ms | ||
FROM public.pg_stat_statements s | ||
JOIN pg_catalog.pg_database d | ||
ON d.oid = s.dbid | ||
ORDER BY 5 DESC | ||
LIMIT #PG_STAT_STATEMENTS_LIMIT#" | ||
metrics: | ||
- role: | ||
usage: "LABEL" | ||
description: "Role that executed the statement" | ||
- dbname: | ||
usage: "LABEL" | ||
description: "Database in which the statement was executed" | ||
- queryid: | ||
usage: "LABEL" | ||
description: "Internal hash code, computed from the statement's parse tree" | ||
- query: | ||
usage: "LABEL" | ||
description: "First 40 characters of query text" | ||
- exec_time_ms: | ||
usage: "GAUGE" | ||
description: "Maximum time spent in the statement in milliseconds" | ||
|
||
|
||
ccp_pg_stat_statements_top_wal: | ||
query: "SELECT pg_get_userbyid(s.userid) as role, | ||
d.datname AS dbname, | ||
s.queryid, | ||
btrim(replace(left(s.query, 40), '\n', '')) AS query, | ||
s.wal_records AS records, | ||
s.wal_fpi AS fpi, | ||
s.wal_bytes AS bytes | ||
FROM public.pg_stat_statements s | ||
JOIN pg_catalog.pg_database d | ||
ON d.oid = s.dbid | ||
ORDER BY s.wal_bytes DESC | ||
LIMIT #PG_STAT_STATEMENTS_LIMIT#" | ||
metrics: | ||
- role: | ||
usage: "LABEL" | ||
description: "Role that executed the statement" | ||
- dbname: | ||
usage: "LABEL" | ||
description: "Database in which the statement was executed" | ||
- queryid: | ||
usage: "LABEL" | ||
description: "Internal hash code, computed from the statement's parse tree" | ||
- query: | ||
usage: "LABEL" | ||
description: "First 40 characters of query text" | ||
- records: | ||
usage: "GAUGE" | ||
description: "Total number of WAL records generated by the statement" | ||
- fpi: | ||
usage: "GAUGE" | ||
description: "Total number of WAL full page images generated by the statement" | ||
- bytes: | ||
usage: "GAUGE" | ||
description: "Total amount of WAL generated by the statement in bytes" | ||
|
||
### | ||
# | ||
# End File: PG16 queries_pg_stat_statements.yml | ||
# | ||
### |
20 changes: 20 additions & 0 deletions
20
postgres_exporter/common/pg16/queries_pg_stat_statements_reset_info.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
### | ||
# | ||
# Begin File: pg_stat_statements_reset_info.yml | ||
# | ||
# Copyright © 2017-2023 Crunchy Data Solutions, Inc. All Rights Reserved. | ||
# | ||
### | ||
ccp_pg_stat_statements_reset: | ||
query: "select monitor.pg_stat_statements_reset_info(#PG_STAT_STATEMENTS_THROTTLE_MINUTES#) as time" | ||
metrics: | ||
- time: | ||
usage: "GAUGE" | ||
description: "Epoch time when stats were reset" | ||
|
||
### | ||
# | ||
# End File: pg_stat_statements_reset_info.yml | ||
# | ||
### | ||
|
Oops, something went wrong.