-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path460-pg_query.yml
200 lines (193 loc) · 7.66 KB
/
460-pg_query.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
##
# SYNOPSIS
# pg_query.pg_query_13_*
#
# DESCRIPTION
# PostgreSQL Query metrics, require pg_stat_statements installed in schema monitor, pg13
#
# OPTIONS
# Tags [cluster, schema:monitor, extension:pg_stat_statements]
# TTL 10
# Priority 0
# Timeout 1s
# Fatal false
# Version 130000 ~ higher
# 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
# 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_17:
name: pg_query
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
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_94_12:
name: pg_query
desc: PostgreSQL query statement metrics, require pg_stat_statements installed, 9.4 ~ 12
# note that postgres user or db and one-time job are not recorded in Monitoring System
query: |
SELECT datname, queryid AS query, sum(calls) AS calls, sum(rows) AS rows, sum(total_time) AS exec_time, sum(blk_read_time) + sum(blk_write_time) AS io_time,
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: 090400
max_version: 130000
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
- 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