-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy path0260-pg_sub.yml
More file actions
157 lines (150 loc) · 9.91 KB
/
Copy path0260-pg_sub.yml
File metadata and controls
157 lines (150 loc) · 9.91 KB
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
#==============================================================#
# 0260 pg_sub
#==============================================================#
pg_sub_19:
name: pg_sub
desc: PostgreSQL subscription statistics (19+)
query: |-
SELECT
s2.subname, s2.subid AS id, s1.pid, s1.received_lsn, s1.reported_lsn,
s1.msg_send_time, s1.msg_recv_time, s1.reported_time,
(s1.pid IS NOT NULL)::int AS has_worker,
coalesce(s2.apply_error_count, 0) AS apply_error_count,
coalesce(s2.sync_table_error_count, 0) AS sync_table_error_count,
coalesce(s2.sync_seq_error_count, 0) AS sync_seq_error_count,
coalesce(s2.sync_table_error_count, 0) + coalesce(s2.sync_seq_error_count, 0) AS sync_error_count,
coalesce(s2.confl_insert_exists, 0) AS confl_insert_exists,
coalesce(s2.confl_update_origin_differs, 0) AS confl_update_origin_differs,
coalesce(s2.confl_update_exists, 0) AS confl_update_exists,
coalesce(s2.confl_update_deleted, 0) AS confl_update_deleted,
coalesce(s2.confl_update_missing, 0) AS confl_update_missing,
coalesce(s2.confl_delete_origin_differs, 0) AS confl_delete_origin_differs,
coalesce(s2.confl_delete_missing, 0) AS confl_delete_missing,
coalesce(s2.confl_multiple_unique_conflicts, 0) AS confl_multiple_unique_conflicts,
extract(EPOCH FROM s2.stats_reset) AS reset_time
FROM pg_stat_subscription_stats s2
LEFT OUTER JOIN
(SELECT
subname, subid, pid,
received_lsn - '0/0' AS received_lsn, latest_end_lsn - '0/0' AS reported_lsn,
extract(epoch from last_msg_send_time) AS msg_send_time,
extract(epoch from last_msg_receipt_time) AS msg_recv_time,
extract(epoch from latest_end_time) AS reported_time
FROM pg_stat_subscription
WHERE relid IS NULL AND leader_pid IS NULL AND coalesce(worker_type, 'apply') = 'apply') s1
USING(subid);
ttl: 10
min_version: 190000
tags: [ cluster ]
metrics:
- subname: { usage: LABEL ,description: "Name of this subscription" }
- id: { usage: GAUGE ,description: "OID of the subscription" }
- pid: { usage: GAUGE ,description: "Process ID of the subscription leader apply worker" }
- has_worker: { usage: GAUGE ,description: "1 if a leader apply worker row exists in pg_stat_subscription, otherwise 0" }
- received_lsn: { usage: COUNTER ,description: "Last write-ahead log location received" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- apply_error_count: { usage: COUNTER ,description: "Number of times an error occurred while applying changes" }
- sync_table_error_count: { usage: COUNTER ,description: "Number of times an error occurred during the initial table synchronization" }
- sync_seq_error_count: { usage: COUNTER ,description: "Number of times an error occurred during sequence synchronization" }
- sync_error_count: { usage: COUNTER ,description: "Sum of sync_table_error_count and sync_seq_error_count. Drop-in replacement for the PG16-18 sync_error_count metric; on PG19+ it also includes sequence-sync errors" }
- confl_insert_exists: { usage: COUNTER ,description: "Number of insert_exists conflicts while applying changes" }
- confl_update_origin_differs: { usage: COUNTER ,description: "Number of update_origin_differs conflicts while applying changes" }
- confl_update_exists: { usage: COUNTER ,description: "Number of update_exists conflicts while applying changes" }
- confl_update_deleted: { usage: COUNTER ,description: "Number of update_deleted conflicts while applying changes" }
- confl_update_missing: { usage: COUNTER ,description: "Number of update_missing conflicts while applying changes" }
- confl_delete_origin_differs: { usage: COUNTER ,description: "Number of delete_origin_differs conflicts while applying changes" }
- confl_delete_missing: { usage: COUNTER ,description: "Number of delete_missing conflicts while applying changes" }
- confl_multiple_unique_conflicts: { usage: COUNTER ,description: "Number of multiple_unique_conflicts conflicts while applying changes" }
- reset_time: { usage: GAUGE ,description: "Time at which these subscription statistics were last reset" }
pg_sub_16:
name: pg_sub
desc: PostgreSQL subscription statistics (16-18)
query: |-
SELECT
s1.subname, subid AS id, pid, received_lsn, reported_lsn,
msg_send_time, msg_recv_time, reported_time,
apply_error_count, sync_error_count
FROM
(SELECT
subname, subid, pid,
received_lsn - '0/0' AS received_lsn, latest_end_lsn - '0/0' AS reported_lsn,
extract(epoch from last_msg_send_time) AS msg_send_time,
extract(epoch from last_msg_receipt_time) AS msg_recv_time,
extract(epoch from latest_end_time) AS reported_time
FROM pg_stat_subscription
WHERE relid IS NULL AND leader_pid IS NULL) s1
LEFT OUTER JOIN pg_stat_subscription_stats s2 USING(subid);
ttl: 10
min_version: 160000
max_version: 190000
tags: [ cluster ]
metrics:
- subname: { usage: LABEL ,description: "Name of this subscription" }
- id: { usage: GAUGE ,description: "OID of the subscription" }
- pid: { usage: GAUGE ,description: "Process ID of the subscription leader apply worker" }
- received_lsn: { usage: COUNTER ,description: "Last write-ahead log location received" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- apply_error_count: { usage: COUNTER ,description: "Number of times an error occurred while applying changes" }
- sync_error_count: { usage: COUNTER ,description: "Number of times an error occurred during the initial table synchronization" }
pg_sub_15:
name: pg_sub
desc: PostgreSQL subscription statistics (15)
query: |-
SELECT
s1.subname, subid AS id, pid, received_lsn, reported_lsn,
msg_send_time, msg_recv_time, reported_time,
apply_error_count, sync_error_count
FROM
(SELECT
subname, subid, pid,
received_lsn - '0/0' AS received_lsn, latest_end_lsn - '0/0' AS reported_lsn,
extract(epoch from last_msg_send_time) AS msg_send_time,
extract(epoch from last_msg_receipt_time) AS msg_recv_time,
extract(epoch from latest_end_time) AS reported_time
FROM pg_stat_subscription WHERE relid ISNULL) s1
LEFT OUTER JOIN pg_stat_subscription_stats s2 USING(subid);
ttl: 10
min_version: 150000
max_version: 160000
tags: [ cluster ]
metrics:
- subname: { usage: LABEL ,description: "Name of this subscription" }
- id: { usage: GAUGE ,description: "OID of the subscription" }
- pid: { usage: GAUGE ,description: "Process ID of the subscription main apply worker process" }
- received_lsn: { usage: COUNTER ,description: "Last write-ahead log location received" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }
- apply_error_count: { usage: COUNTER ,description: "Number of times an error occurred while applying changes." }
- sync_error_count: { usage: COUNTER ,description: "Number of times an error occurred during the initial table synchronization" }
pg_sub_10:
name: pg_sub
desc: PostgreSQL subscription statistics (10-14)
query: |-
SELECT
subname, subid AS id, pid,
received_lsn - '0/0' AS received_lsn, latest_end_lsn - '0/0' AS reported_lsn,
extract(epoch from last_msg_send_time) AS msg_send_time,
extract(epoch from last_msg_receipt_time) AS msg_recv_time,
extract(epoch from latest_end_time) AS reported_time
FROM pg_stat_subscription WHERE relid ISNULL;
ttl: 10
min_version: 100000
max_version: 150000
tags: [ cluster ]
metrics:
- subname: { usage: LABEL ,description: "Name of this subscription" }
- id: { usage: GAUGE ,description: "OID of the subscription" }
- pid: { usage: GAUGE ,description: "Process ID of the subscription main apply worker process" }
- received_lsn: { usage: COUNTER ,description: "Last write-ahead log location received" }
- reported_lsn: { usage: COUNTER ,description: "Last write-ahead log location reported to origin WAL sender" }
- msg_send_time: { usage: GAUGE ,description: "Send time of last message received from origin WAL sender" }
- msg_recv_time: { usage: GAUGE ,description: "Receipt time of last message received from origin WAL sender" }
- reported_time: { usage: GAUGE ,description: "Time of last write-ahead log location reported to origin WAL sender" }