From bfd9bbb6a35eb13adc7e0276429551bbd6c56a3d Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Fri, 1 Nov 2019 00:13:36 +1100 Subject: [PATCH 1/2] Add pg_stat_statements to sample queries.yml file. --- queries.yaml | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/queries.yaml b/queries.yaml index 148411d0d..145e0a2c3 100644 --- a/queries.yaml +++ b/queries.yaml @@ -123,3 +123,68 @@ pg_database: - size: usage: "GAUGE" description: "Disk space used by the database" + + +pg_stat_statements: + query: "SELECT query, 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" + metrics: + - query: + usage: "LABEL" + description: "Query class" + - 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)" From 0bf64ba070a3d0c6f1ef0387739bbbbe2c9b2adc Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Fri, 1 Nov 2019 00:14:34 +1100 Subject: [PATCH 2/2] Rename pg_database_size to pg_database_size_bytes --- queries.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries.yaml b/queries.yaml index 145e0a2c3..022e5ffd3 100644 --- a/queries.yaml +++ b/queries.yaml @@ -120,7 +120,7 @@ pg_database: - datname: usage: "LABEL" description: "Name of the database" - - size: + - size_bytes: usage: "GAUGE" description: "Disk space used by the database"