forked from prometheus/mysqld_exporter
-
Notifications
You must be signed in to change notification settings - Fork 43
/
queries-mysqld-group-replication.yml
154 lines (149 loc) · 9.54 KB
/
queries-mysqld-group-replication.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
mysql_perf_schema_replication_group:
query: "/*!80000 SELECT CHANNEL_NAME as channel_name, MEMBER_ID as member_id, MEMBER_HOST as member_host, MEMBER_PORT as member_port, MEMBER_STATE as member_state, MEMBER_ROLE as member_role, MEMBER_VERSION as member_version, CASE WHEN MEMBER_STATE = 'ONLINE' THEN 1 WHEN MEMBER_STATE = 'RECOVERING' THEN 2 WHEN MEMBER_STATE = 'OFFLINE' THEN 3 WHEN MEMBER_STATE = 'ERROR' THEN 4 WHEN MEMBER_STATE = 'UNREACHABLE' THEN 5 END as member_info FROM performance_schema.replication_group_members WHERE MEMBER_ID=@@server_uuid */"
metrics:
- channel_name:
usage: "LABEL"
description: "Name of the Group Replication channel."
- member_id:
usage: "LABEL"
description: "The member server UUID. This has a different value for each member in the group."
- member_host:
usage: "LABEL"
description: "Network address of this member (host name or IP address)."
- member_port:
usage: "LABEL"
description: "Port on which the server is listening."
- member_state:
usage: "LABEL"
description: "Current state of this member."
- member_role:
usage: "LABEL"
description: "Role of the member in the group, either PRIMARY or SECONDARY."
- member_version:
usage: "LABEL"
description: "MySQL version of the member."
- member_info:
usage: "GAUGE"
description: "Show Group Replication Server States."
mysql_perf_schema_replication_group_5:
query: "/*!50700 SELECT CHANNEL_NAME as channel_name, MEMBER_ID as member_id, MEMBER_HOST as member_host, MEMBER_PORT as member_port, MEMBER_STATE as member_state, CASE WHEN MEMBER_STATE = 'ONLINE' THEN 1 WHEN MEMBER_STATE = 'RECOVERING' THEN 2 WHEN MEMBER_STATE = 'OFFLINE' THEN 3 WHEN MEMBER_STATE = 'ERROR' THEN 4 WHEN MEMBER_STATE = 'UNREACHABLE' THEN 5 END as member_info FROM performance_schema.replication_group_members WHERE MEMBER_ID=@@server_uuid and (SELECT SUBSTRING(@@VERSION,1,1) = 5) */"
metrics:
- channel_name:
usage: "LABEL"
description: "Name of the Group Replication channel."
- member_id:
usage: "LABEL"
description: "The member server UUID. This has a different value for each member in the group."
- member_host:
usage: "LABEL"
description: "Network address of this member (host name or IP address)."
- member_port:
usage: "LABEL"
description: "Port on which the server is listening."
- member_state:
usage: "LABEL"
description: "Current state of this member."
- member_info:
usage: "GAUGE"
description: "Show Group Replication Server States."
mysql_perf_schema:
query: "/*!80000 SELECT COUNT_TRANSACTIONS_IN_QUEUE as transactions_in_queue, COUNT_TRANSACTIONS_CHECKED as transactions_checked_total, COUNT_CONFLICTS_DETECTED as conflicts_detected_total, COUNT_TRANSACTIONS_ROWS_VALIDATING as transactions_rows_validating_total, COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE as transactions_remote_in_applier_queue, COUNT_TRANSACTIONS_REMOTE_APPLIED as transactions_remote_applied_total, COUNT_TRANSACTIONS_LOCAL_PROPOSED as transactions_local_proposed_total, COUNT_TRANSACTIONS_LOCAL_ROLLBACK as transactions_local_rollback_total FROM performance_schema.replication_group_member_stats WHERE MEMBER_ID=@@server_uuid */"
metrics:
- transactions_in_queue:
usage: "GAUGE"
description: "The number of transactions in the queue pending conflict detection checks."
- transactions_checked_total:
usage: "GAUGE"
description: "The number of transactions that have been checked for conflicts."
- conflicts_detected_total:
usage: "GAUGE"
description: "The number of transactions that have not passed the conflict detection check."
- transactions_rows_validating_total:
usage: "GAUGE"
description: "Number of transaction rows which can be used for certification, but have not been garbage collected."
- transactions_remote_in_applier_queue:
usage: "GAUGE"
description: "The number of transactions that this member has received from the replication group which are waiting to be applied."
- transactions_remote_applied_total:
usage: "GAUGE"
description: "Number of transactions this member has received from the group and applied."
- transactions_local_proposed_total:
usage: "GAUGE"
description: "Number of transactions which originated on this member and were sent to the group."
- transactions_local_rollback_total:
usage: "GAUGE"
description: "Number of transactions which originated on this member and were rolled back by the group."
mysql_perf_schema_5:
query: "/*!50700 SELECT COUNT_TRANSACTIONS_IN_QUEUE as transactions_in_queue, COUNT_TRANSACTIONS_CHECKED as transactions_checked_total, COUNT_CONFLICTS_DETECTED as conflicts_detected_total, COUNT_TRANSACTIONS_ROWS_VALIDATING as transactions_rows_validating_total FROM performance_schema.replication_group_member_stats WHERE MEMBER_ID=@@server_uuid and (SELECT SUBSTRING(@@VERSION,1,1) = 5) */"
metrics:
- transactions_in_queue:
usage: "GAUGE"
description: "The number of transactions in the queue pending conflict detection checks."
- transactions_checked_total:
usage: "GAUGE"
description: "The number of transactions that have been checked for conflicts."
- conflicts_detected_total:
usage: "GAUGE"
description: "The number of transactions that have not passed the conflict detection check."
- transactions_rows_validating_total:
usage: "GAUGE"
description: "Number of transaction rows which can be used for certification, but have not been garbage collected."
- transactions_local_rollback_total:
usage: "GAUGE"
description: "Number of transactions which originated on this member and were rolled back by the group."
mysql_perf_schema_replication_group_worker:
query: "/*!80000 SELECT conn_status.channel_name as channel_name,
conn_status.service_state as IO_thread,
applier_status.service_state as SQL_thread,
LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP - LAST_APPLIED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP 'rep_delay_seconds',
LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP - LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP 'transport_time_seconds',
LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP - LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP 'time_RL_seconds',
LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP - LAST_APPLIED_TRANSACTION_START_APPLY_TIMESTAMP 'apply_time_seconds',
if(GTID_SUBTRACT(LAST_QUEUED_TRANSACTION, LAST_APPLIED_TRANSACTION) = '','0' , abs(time_to_sec(if(time_to_sec(APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP)=0,0,timediff(APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP,now()))))) `lag_in_seconds`
FROM performance_schema.replication_connection_status AS conn_status JOIN performance_schema.replication_applier_status_by_worker AS applier_status
ON applier_status.channel_name = conn_status.channel_name WHERE conn_status.service_state = 'ON' ORDER BY lag_in_seconds, lag_in_seconds desc */"
metrics:
- channel_name:
usage: "LABEL"
description: "The replication channel which this row is displaying. There is always a default replication channel, and more replication channels can be added."
- IO_thread:
usage: "LABEL"
description: "ON (thread exists and is active or idle), OFF (thread no longer exists), or CONNECTING (thread exists and is connecting to the source)."
- SQL_thread:
usage: "LABEL"
description: "ON (thread exists and is active or idle) or OFF (thread no longer exists)."
- rep_delay_seconds:
usage: "GAUGE"
description: "Time difference from the moment the transaction has being COMMITTED on the Primary and the time transaction exit the queue to be apply in the local Replica"
- transport_time_seconds:
usage: "GAUGE"
description: "Time difference from the moment the transaction is COMMITTED on the Primary and the time transaction ENTER the local queue on the Replica"
- time_RL_seconds:
usage: "GAUGE"
description: "Time spent by transaction inside the local queue in the Replica"
- apply_time_seconds:
usage: "GAUGE"
description: "Time pass to apply the transaction on the local node"
- lag_in_seconds:
usage: "GAUGE"
description: "Lag in seconds from when the LAST transaction is COMMITTED in the Primary and the time on local Replica "
mysql_perf_schema_replication_group_worker_5:
query: "/*!50700 SELECT conn_status.channel_name as channel_name,
conn_status.service_state as IO_thread,
applier_status.service_state as SQL_thread,
1 as info
FROM performance_schema.replication_connection_status AS conn_status JOIN performance_schema.replication_applier_status_by_worker AS applier_status
ON applier_status.channel_name = conn_status.channel_name WHERE conn_status.service_state = 'ON' and (SELECT SUBSTRING(@@VERSION,1,1) = 5) */"
metrics:
- channel_name:
usage: "LABEL"
description: "The replication channel which this row is displaying. There is always a default replication channel, and more replication channels can be added."
- IO_thread:
usage: "LABEL"
description: "ON (thread exists and is active or idle), OFF (thread no longer exists), or CONNECTING (thread exists and is connecting to the source)."
- SQL_thread:
usage: "LABEL"
description: "ON (thread exists and is active or idle) or OFF (thread no longer exists)."
- info:
usage: "GAUGE"
description: "Info value"