@@ -14,103 +14,8 @@ metrics:
14
14
gauges :
15
15
- ' *'
16
16
17
- pg_vacuum_progress :
18
- description : " Monitor vacuum progress in real-time"
19
- sqls :
20
- 11 : |
21
- select
22
- current_database() AS tag_datname,
23
- N.nspname as tag_schema_name,
24
- c.relname as tag_table_name,
25
- N.nspname || '.' || c.relname as tag_relname,
26
- s.relid AS tag_relid,
27
- case when A.query ~ '^autovacuum.*(to prevent wraparound)' then
28
- 'aggressive_autovacuum'
29
- when A.query ~ '^autovacuum' then
30
- 'autovacuum'
31
- when A.query ~* '^vacuum' then
32
- 'manual_vacuum'
33
- else
34
- 'unknown'
35
- end as tag_vacuum_mode,
36
- extract(epoch from A.query_start) as query_start,
37
- case when S.phase ~ 'initial' then
38
- 1
39
- when S.phase ~ 'scanning heap' then
40
- 2
41
- WHEN S.phase ~ 'vacuuming indexes' THEN
42
- 3
43
- WHEN S.phase ~ 'vacuuming heap' THEN
44
- 4
45
- WHEN S.phase ~ 'cleaning up indexes' THEN
46
- 5
47
- WHEN S.phase ~ 'truncating heap' THEN
48
- 6
49
- WHEN S.phase ~ 'final cleanup' THEN
50
- 7
51
- end tag_phase,
52
- S.heap_blks_total::float,
53
- S.heap_blks_scanned::float,
54
- S.heap_blks_vacuumed::float,
55
- S.index_vacuum_count::float,
56
- (S.max_dead_tuples / 1024 / 1024)::float as max_dead_tuples_mb,
57
- S.num_dead_tuples::float as num_dead_item_ids
58
- from
59
- pg_stat_progress_vacuum as S
60
- join pg_database D on (S.datid = D.oid)
61
- join pg_stat_activity as A on (S.pid = A.pid)
62
- join pg_class C on (C.oid = S.relid)
63
- join pg_namespace N on (N.oid = C.relnamespace)
64
- 17 : |
65
- select
66
- current_database() AS tag_datname,
67
- N.nspname as tag_schema_name,
68
- c.relname as tag_table_name,
69
- N.nspname || '.' || c.relname as tag_relname,
70
- s.relid AS tag_relid,
71
- case when A.query ~ '^autovacuum.*(to prevent wraparound)' then
72
- 'aggressive_autovacuum'
73
- when A.query ~ '^autovacuum' then
74
- 'autovacuum'
75
- when A.query ~* '^vacuum' then
76
- 'manual_vacuum'
77
- else
78
- 'unknown'
79
- end as tag_vacuum_mode,
80
- extract(epoch from A.query_start) as query_start,
81
- case when S.phase ~ 'initial' then
82
- 1
83
- when S.phase ~ 'scanning heap' then
84
- 2
85
- WHEN S.phase ~ 'vacuuming indexes' THEN
86
- 3
87
- WHEN S.phase ~ 'vacuuming heap' THEN
88
- 4
89
- WHEN S.phase ~ 'cleaning up indexes' THEN
90
- 5
91
- WHEN S.phase ~ 'truncating heap' THEN
92
- 6
93
- WHEN S.phase ~ 'final cleanup' THEN
94
- 7
95
- end tag_phase,
96
- S.heap_blks_total::float,
97
- S.heap_blks_scanned::float,
98
- S.heap_blks_vacuumed::float,
99
- S.index_vacuum_count::float,
100
- (S.max_dead_tuple_bytes / 1024 / 1024)::float as max_dead_tuples_mb,
101
- S.num_dead_item_ids::float
102
- from
103
- pg_stat_progress_vacuum as S
104
- join pg_database D on (S.datid = D.oid)
105
- join pg_stat_activity as A on (S.pid = A.pid)
106
- join pg_class C on (C.oid = S.relid)
107
- join pg_namespace N on (N.oid = C.relnamespace)
108
- gauges :
109
- - ' *'
110
-
111
17
presets :
112
18
full :
113
19
description : " Full metrics for PostgreSQL storage"
114
20
metrics :
115
- pgss_queryid_queries : 300
116
- pg_vacuum_progress : 30
21
+ pgss_queryid_queries : 300
0 commit comments