Skip to content

Commit

Permalink
PMM-12897 Move DB specific metrics queries to low resolution (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov authored Mar 7, 2024
1 parent 1b1eb48 commit 04645da
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 100 deletions.
100 changes: 0 additions & 100 deletions queries.yaml → queries-lr.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
#### Queries are commented due to PMM-8859
pg_replication:
query: "SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))) END AS lag"
master: true
metrics:
- lag:
usage: "GAUGE"
description: "Replication lag behind master in seconds"

pg_postmaster:
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
master: true
metrics:
- start_time_seconds:
usage: "GAUGE"
description: "Time at which postmaster started"

pg_stat_user_tables:
query: |
SELECT
Expand Down Expand Up @@ -146,86 +129,3 @@ pg_statio_user_tables:
- tidx_blks_hit:
usage: "COUNTER"
description: "Number of buffer hits in this table's TOAST table indexes (if any)"

pg_database:
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database"
master: true
cache_seconds: 30
metrics:
- datname:
usage: "LABEL"
description: "Name of the database"
- size_bytes:
usage: "GAUGE"
description: "Disk space used by the database"
####
#pg_stat_statements:
# query: "SELECT t2.rolname, t3.datname, queryid, calls, total_time / 1000 as total_time_seconds, min_time / 1000 as min_time_seconds, max_time / 1000 as max_time_seconds, mean_time / 1000 as mean_time_seconds, stddev_time / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements t1 JOIN pg_roles t2 ON (t1.userid=t2.oid) JOIN pg_database t3 ON (t1.dbid=t3.oid) WHERE t2.rolname != 'rdsadmin'"
# master: true
# metrics:
# - rolname:
# usage: "LABEL"
# description: "Name of user"
# - datname:
# usage: "LABEL"
# description: "Name of database"
# - queryid:
# usage: "LABEL"
# description: "Query ID"
# - calls:
# usage: "COUNTER"
# description: "Number of times executed"
# - total_time_seconds:
# usage: "COUNTER"
# description: "Total time spent in the statement, in milliseconds"
# - min_time_seconds:
# usage: "GAUGE"
# description: "Minimum time spent in the statement, in milliseconds"
# - max_time_seconds:
# usage: "GAUGE"
# description: "Maximum time spent in the statement, in milliseconds"
# - mean_time_seconds:
# usage: "GAUGE"
# description: "Mean time spent in the statement, in milliseconds"
# - stddev_time_seconds:
# usage: "GAUGE"
# description: "Population standard deviation of time spent in the statement, in milliseconds"
# - rows:
# usage: "COUNTER"
# description: "Total number of rows retrieved or affected by the statement"
# - shared_blks_hit:
# usage: "COUNTER"
# description: "Total number of shared block cache hits by the statement"
# - shared_blks_read:
# usage: "COUNTER"
# description: "Total number of shared blocks read by the statement"
# - shared_blks_dirtied:
# usage: "COUNTER"
# description: "Total number of shared blocks dirtied by the statement"
# - shared_blks_written:
# usage: "COUNTER"
# description: "Total number of shared blocks written by the statement"
# - local_blks_hit:
# usage: "COUNTER"
# description: "Total number of local block cache hits by the statement"
# - local_blks_read:
# usage: "COUNTER"
# description: "Total number of local blocks read by the statement"
# - local_blks_dirtied:
# usage: "COUNTER"
# description: "Total number of local blocks dirtied by the statement"
# - local_blks_written:
# usage: "COUNTER"
# description: "Total number of local blocks written by the statement"
# - temp_blks_read:
# usage: "COUNTER"
# description: "Total number of temp blocks read by the statement"
# - temp_blks_written:
# usage: "COUNTER"
# description: "Total number of temp blocks written by the statement"
# - blk_read_time_seconds:
# usage: "COUNTER"
# description: "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
# - blk_write_time_seconds:
# usage: "COUNTER"
# description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
99 changes: 99 additions & 0 deletions queries-mr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#### Queries are commented due to PMM-8859
pg_replication:
query: "SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))) END AS lag"
master: true
metrics:
- lag:
usage: "GAUGE"
description: "Replication lag behind master in seconds"

pg_postmaster:
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
master: true
metrics:
- start_time_seconds:
usage: "GAUGE"
description: "Time at which postmaster started"

pg_database:
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database"
master: true
cache_seconds: 30
metrics:
- datname:
usage: "LABEL"
description: "Name of the database"
- size_bytes:
usage: "GAUGE"
description: "Disk space used by the database"
####
#pg_stat_statements:
# query: "SELECT t2.rolname, t3.datname, queryid, calls, total_time / 1000 as total_time_seconds, min_time / 1000 as min_time_seconds, max_time / 1000 as max_time_seconds, mean_time / 1000 as mean_time_seconds, stddev_time / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements t1 JOIN pg_roles t2 ON (t1.userid=t2.oid) JOIN pg_database t3 ON (t1.dbid=t3.oid) WHERE t2.rolname != 'rdsadmin'"
# master: true
# metrics:
# - rolname:
# usage: "LABEL"
# description: "Name of user"
# - datname:
# usage: "LABEL"
# description: "Name of database"
# - queryid:
# usage: "LABEL"
# description: "Query ID"
# - calls:
# usage: "COUNTER"
# description: "Number of times executed"
# - total_time_seconds:
# usage: "COUNTER"
# description: "Total time spent in the statement, in milliseconds"
# - min_time_seconds:
# usage: "GAUGE"
# description: "Minimum time spent in the statement, in milliseconds"
# - max_time_seconds:
# usage: "GAUGE"
# description: "Maximum time spent in the statement, in milliseconds"
# - mean_time_seconds:
# usage: "GAUGE"
# description: "Mean time spent in the statement, in milliseconds"
# - stddev_time_seconds:
# usage: "GAUGE"
# description: "Population standard deviation of time spent in the statement, in milliseconds"
# - rows:
# usage: "COUNTER"
# description: "Total number of rows retrieved or affected by the statement"
# - shared_blks_hit:
# usage: "COUNTER"
# description: "Total number of shared block cache hits by the statement"
# - shared_blks_read:
# usage: "COUNTER"
# description: "Total number of shared blocks read by the statement"
# - shared_blks_dirtied:
# usage: "COUNTER"
# description: "Total number of shared blocks dirtied by the statement"
# - shared_blks_written:
# usage: "COUNTER"
# description: "Total number of shared blocks written by the statement"
# - local_blks_hit:
# usage: "COUNTER"
# description: "Total number of local block cache hits by the statement"
# - local_blks_read:
# usage: "COUNTER"
# description: "Total number of local blocks read by the statement"
# - local_blks_dirtied:
# usage: "COUNTER"
# description: "Total number of local blocks dirtied by the statement"
# - local_blks_written:
# usage: "COUNTER"
# description: "Total number of local blocks written by the statement"
# - temp_blks_read:
# usage: "COUNTER"
# description: "Total number of temp blocks read by the statement"
# - temp_blks_written:
# usage: "COUNTER"
# description: "Total number of temp blocks written by the statement"
# - blk_read_time_seconds:
# usage: "COUNTER"
# description: "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
# - blk_write_time_seconds:
# usage: "COUNTER"
# description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"

0 comments on commit 04645da

Please sign in to comment.