Skip to content

Commit

Permalink
add new branch pg_query_17 to fix rename of blk_r/w_time
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonng committed Jun 19, 2024
1 parent a32435e commit df9ec01
Showing 1 changed file with 57 additions and 42 deletions.
99 changes: 57 additions & 42 deletions config/collector/460-pg_query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,70 @@
# sblk_written (COUNTER)
# Total number of shared blocks written by the statement
#
pg_query_13:

pg_query_17:
name: pg_query
desc: PostgreSQL Query metrics, require pg_stat_statements installed, pg13
desc: PostgreSQL Query metrics, require pg_stat_statements installed, 17+
query: |
SELECT datname, queryid AS query, sum(calls) AS calls, sum(rows) AS rows, sum(total_exec_time) AS exec_time, sum(shared_blk_read_time) + sum(shared_blk_write_time) AS io_time, sum(wal_bytes) AS wal_bytes
,sum(shared_blks_hit) AS sblk_hit, sum(shared_blks_read) AS sblk_read, sum(shared_blks_dirtied) AS sblk_dirtied, sum(shared_blks_written) AS sblk_written
FROM pg_stat_statements(false) s JOIN pg_database d ON s.dbid = d.oid WHERE userid != 10 AND calls > 4 GROUP BY 1, 2 ORDER BY 3 DESC LIMIT 128;
ttl: 10
timeout: 1
min_version: 170000
tags:
- cluster
- extension:pg_stat_statements
metrics:
- datname:
usage: LABEL
description: Name of database
- query:
usage: LABEL
description: QueryID generated from internal hash code, computed from the statement's parse tree
- calls:
usage: COUNTER
description: Number of times the statement was executed
- rows:
usage: COUNTER
description: Total number of rows retrieved or affected by the statement
- exec_time:
usage: COUNTER
scale: 1e-3
description: Total time spent executing the statement, in seconds
- io_time:
usage: COUNTER
scale: 1e-3
description: Total time the statement spent reading and writing blocks, in seconds
- wal_bytes:
usage: COUNTER
description: Total amount of WAL bytes generated by the statement
- sblk_hit:
usage: COUNTER
description: Total number of shared block cache hits by the statement
- sblk_read:
usage: COUNTER
description: Total number of shared blocks read by the statement
- sblk_dirtied:
usage: COUNTER
description: Total number of shared blocks dirtied by the statement
- sblk_written:
usage: COUNTER
description: Total number of shared blocks written by the statement



pg_query_13_16:
name: pg_query
desc: PostgreSQL Query metrics, require pg_stat_statements installed, 13 - 16
query: |
SELECT datname, queryid AS query, sum(calls) AS calls, sum(rows) AS rows, sum(total_exec_time) AS exec_time, sum(blk_read_time) + sum(blk_write_time) AS io_time, sum(wal_bytes) AS wal_bytes
,sum(shared_blks_hit) AS sblk_hit, sum(shared_blks_read) AS sblk_read, sum(shared_blks_dirtied) AS sblk_dirtied, sum(shared_blks_written) AS sblk_written
FROM pg_stat_statements(false) s JOIN pg_database d ON s.dbid = d.oid WHERE userid != 10 AND calls > 4 GROUP BY 1, 2 ORDER BY 3 DESC LIMIT 128;
ttl: 10
timeout: 1
min_version: 130000
max_version: 170000
tags:
- cluster
- extension:pg_stat_statements
Expand Down Expand Up @@ -95,46 +149,7 @@ pg_query_13:
description: Total number of shared blocks written by the statement


##
# SYNOPSIS
# pg_query.pg_query_94_12_*
#
# DESCRIPTION
# PostgreSQL query statement metrics, require pg_stat_statements installed in schema monitor, 9.4 ~ 12
#
# OPTIONS
# Tags [cluster, schema:monitor, extension:pg_stat_statements]
# TTL 10
# Priority 0
# Timeout 1s
# Fatal false
# Version 90400 ~ 130000
# Source 460-pg_query.yml
#
# METRICS
# datname (LABEL)
# Name of database
# query (LABEL)
# QueryID generated from internal hash code, computed from the statement's parse tree
# calls (COUNTER)
# Number of times the statement was executed
# rows (COUNTER)
# Total number of rows retrieved or affected by the statement
# exec_time (COUNTER)
# Total time spent executing the statement, in seconds
# io_time (COUNTER)
# Total time the statement spent reading and writing blocks, in seconds
# wal_bytes (COUNTER)
# Total amount of WAL bytes generated by the statement
# sblk_hit (COUNTER)
# Total number of shared block cache hits by the statement
# sblk_read (COUNTER)
# Total number of shared blocks read by the statement
# sblk_dirtied (COUNTER)
# Total number of shared blocks dirtied by the statement
# sblk_written (COUNTER)
# Total number of shared blocks written by the statement
#

pg_query_94_12:
name: pg_query
desc: PostgreSQL query statement metrics, require pg_stat_statements installed, 9.4 ~ 12
Expand Down

0 comments on commit df9ec01

Please sign in to comment.