Skip to content

Commit 438521c

Browse files
committed
Remove all queries from queries.yaml
Signed-off-by: Felix Yuan <[email protected]>
1 parent 4a0c02c commit 438521c

File tree

1 file changed

+0
-244
lines changed

1 file changed

+0
-244
lines changed

Diff for: queries.yaml

-244
Original file line numberDiff line numberDiff line change
@@ -1,244 +0,0 @@
1-
pg_replication:
2-
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"
3-
master: true
4-
metrics:
5-
- lag:
6-
usage: "GAUGE"
7-
description: "Replication lag behind master in seconds"
8-
9-
pg_postmaster:
10-
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
11-
master: true
12-
metrics:
13-
- start_time_seconds:
14-
usage: "GAUGE"
15-
description: "Time at which postmaster started"
16-
17-
pg_stat_user_tables:
18-
query: |
19-
SELECT
20-
current_database() datname,
21-
schemaname,
22-
relname,
23-
seq_scan,
24-
seq_tup_read,
25-
idx_scan,
26-
idx_tup_fetch,
27-
n_tup_ins,
28-
n_tup_upd,
29-
n_tup_del,
30-
n_tup_hot_upd,
31-
n_live_tup,
32-
n_dead_tup,
33-
n_mod_since_analyze,
34-
COALESCE(last_vacuum, '1970-01-01Z') as last_vacuum,
35-
COALESCE(last_autovacuum, '1970-01-01Z') as last_autovacuum,
36-
COALESCE(last_analyze, '1970-01-01Z') as last_analyze,
37-
COALESCE(last_autoanalyze, '1970-01-01Z') as last_autoanalyze,
38-
vacuum_count,
39-
autovacuum_count,
40-
analyze_count,
41-
autoanalyze_count
42-
FROM
43-
pg_stat_user_tables
44-
metrics:
45-
- datname:
46-
usage: "LABEL"
47-
description: "Name of current database"
48-
- schemaname:
49-
usage: "LABEL"
50-
description: "Name of the schema that this table is in"
51-
- relname:
52-
usage: "LABEL"
53-
description: "Name of this table"
54-
- seq_scan:
55-
usage: "COUNTER"
56-
description: "Number of sequential scans initiated on this table"
57-
- seq_tup_read:
58-
usage: "COUNTER"
59-
description: "Number of live rows fetched by sequential scans"
60-
- idx_scan:
61-
usage: "COUNTER"
62-
description: "Number of index scans initiated on this table"
63-
- idx_tup_fetch:
64-
usage: "COUNTER"
65-
description: "Number of live rows fetched by index scans"
66-
- n_tup_ins:
67-
usage: "COUNTER"
68-
description: "Number of rows inserted"
69-
- n_tup_upd:
70-
usage: "COUNTER"
71-
description: "Number of rows updated"
72-
- n_tup_del:
73-
usage: "COUNTER"
74-
description: "Number of rows deleted"
75-
- n_tup_hot_upd:
76-
usage: "COUNTER"
77-
description: "Number of rows HOT updated (i.e., with no separate index update required)"
78-
- n_live_tup:
79-
usage: "GAUGE"
80-
description: "Estimated number of live rows"
81-
- n_dead_tup:
82-
usage: "GAUGE"
83-
description: "Estimated number of dead rows"
84-
- n_mod_since_analyze:
85-
usage: "GAUGE"
86-
description: "Estimated number of rows changed since last analyze"
87-
- last_vacuum:
88-
usage: "GAUGE"
89-
description: "Last time at which this table was manually vacuumed (not counting VACUUM FULL)"
90-
- last_autovacuum:
91-
usage: "GAUGE"
92-
description: "Last time at which this table was vacuumed by the autovacuum daemon"
93-
- last_analyze:
94-
usage: "GAUGE"
95-
description: "Last time at which this table was manually analyzed"
96-
- last_autoanalyze:
97-
usage: "GAUGE"
98-
description: "Last time at which this table was analyzed by the autovacuum daemon"
99-
- vacuum_count:
100-
usage: "COUNTER"
101-
description: "Number of times this table has been manually vacuumed (not counting VACUUM FULL)"
102-
- autovacuum_count:
103-
usage: "COUNTER"
104-
description: "Number of times this table has been vacuumed by the autovacuum daemon"
105-
- analyze_count:
106-
usage: "COUNTER"
107-
description: "Number of times this table has been manually analyzed"
108-
- autoanalyze_count:
109-
usage: "COUNTER"
110-
description: "Number of times this table has been analyzed by the autovacuum daemon"
111-
112-
pg_statio_user_tables:
113-
query: "SELECT current_database() datname, schemaname, relname, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables"
114-
metrics:
115-
- datname:
116-
usage: "LABEL"
117-
description: "Name of current database"
118-
- schemaname:
119-
usage: "LABEL"
120-
description: "Name of the schema that this table is in"
121-
- relname:
122-
usage: "LABEL"
123-
description: "Name of this table"
124-
- heap_blks_read:
125-
usage: "COUNTER"
126-
description: "Number of disk blocks read from this table"
127-
- heap_blks_hit:
128-
usage: "COUNTER"
129-
description: "Number of buffer hits in this table"
130-
- idx_blks_read:
131-
usage: "COUNTER"
132-
description: "Number of disk blocks read from all indexes on this table"
133-
- idx_blks_hit:
134-
usage: "COUNTER"
135-
description: "Number of buffer hits in all indexes on this table"
136-
- toast_blks_read:
137-
usage: "COUNTER"
138-
description: "Number of disk blocks read from this table's TOAST table (if any)"
139-
- toast_blks_hit:
140-
usage: "COUNTER"
141-
description: "Number of buffer hits in this table's TOAST table (if any)"
142-
- tidx_blks_read:
143-
usage: "COUNTER"
144-
description: "Number of disk blocks read from this table's TOAST table indexes (if any)"
145-
- tidx_blks_hit:
146-
usage: "COUNTER"
147-
description: "Number of buffer hits in this table's TOAST table indexes (if any)"
148-
149-
#
150-
# WARNING:
151-
# This set of metrics can be very expensive on a busy server as every
152-
# unique query executed will create an additional time series
153-
#
154-
# pg_stat_statements:
155-
# query: |
156-
# SELECT
157-
# pg_get_userbyid(userid) as user,
158-
# pg_database.datname,
159-
# pg_stat_statements.queryid,
160-
# pg_stat_statements.calls as calls_total,
161-
# pg_stat_statements.total_time / 1000.0 as seconds_total,
162-
# pg_stat_statements.rows as rows_total,
163-
# pg_stat_statements.blk_read_time / 1000.0 as block_read_seconds_total,
164-
# pg_stat_statements.blk_write_time / 1000.0 as block_write_seconds_total
165-
# FROM pg_stat_statements
166-
# JOIN pg_database
167-
# ON pg_database.oid = pg_stat_statements.dbid
168-
# WHERE
169-
# total_time > (
170-
# SELECT percentile_cont(0.1)
171-
# WITHIN GROUP (ORDER BY total_time)
172-
# FROM pg_stat_statements
173-
# )
174-
# ORDER BY seconds_total DESC
175-
# LIMIT 100
176-
# metrics:
177-
# - user:
178-
# usage: "LABEL"
179-
# description: "The user who executed the statement"
180-
# - datname:
181-
# usage: "LABEL"
182-
# description: "The database in which the statement was executed"
183-
# - queryid:
184-
# usage: "LABEL"
185-
# description: "Internal hash code, computed from the statement's parse tree"
186-
# - calls_total:
187-
# usage: "COUNTER"
188-
# description: "Number of times executed"
189-
# - seconds_total:
190-
# usage: "COUNTER"
191-
# description: "Total time spent in the statement, in seconds"
192-
# - rows_total:
193-
# usage: "COUNTER"
194-
# description: "Total number of rows retrieved or affected by the statement"
195-
# - block_read_seconds_total:
196-
# usage: "COUNTER"
197-
# description: "Total time the statement spent reading blocks, in seconds"
198-
# - block_write_seconds_total:
199-
# usage: "COUNTER"
200-
# description: "Total time the statement spent writing blocks, in seconds"
201-
202-
pg_process_idle:
203-
query: |
204-
WITH
205-
metrics AS (
206-
SELECT
207-
application_name,
208-
SUM(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change))::bigint)::float AS process_idle_seconds_sum,
209-
COUNT(*) AS process_idle_seconds_count
210-
FROM pg_stat_activity
211-
WHERE state = 'idle'
212-
GROUP BY application_name
213-
),
214-
buckets AS (
215-
SELECT
216-
application_name,
217-
le,
218-
SUM(
219-
CASE WHEN EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change)) <= le
220-
THEN 1
221-
ELSE 0
222-
END
223-
)::bigint AS bucket
224-
FROM
225-
pg_stat_activity,
226-
UNNEST(ARRAY[1, 2, 5, 15, 30, 60, 90, 120, 300]) AS le
227-
GROUP BY application_name, le
228-
ORDER BY application_name, le
229-
)
230-
SELECT
231-
application_name,
232-
process_idle_seconds_sum as seconds_sum,
233-
process_idle_seconds_count as seconds_count,
234-
ARRAY_AGG(le) AS seconds,
235-
ARRAY_AGG(bucket) AS seconds_bucket
236-
FROM metrics JOIN buckets USING (application_name)
237-
GROUP BY 1, 2, 3
238-
metrics:
239-
- application_name:
240-
usage: "LABEL"
241-
description: "Application Name"
242-
- seconds:
243-
usage: "HISTOGRAM"
244-
description: "Idle time of server processes"

0 commit comments

Comments
 (0)