MySQL 9.1.0
Source Code Documentation
rpl_applier_metrics_service.h
Go to the documentation of this file.
1/* Copyright (c) 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef RPL_APPLIER_METRICS_SERVICE_H
25#define RPL_APPLIER_METRICS_SERVICE_H
26
28#include "mysql/abi_helpers/abi_helpers.h" // Array_view
29
30/// @brief Gives a type to each piece of data extracted
32 /// @brief CHANNEL_NAME
34 /// @brief Total execution time
36 /// @brief Last applier start
38 /// @brief Transactions committed
40 /// @brief Transactions ongoing
42 /// @brief transaction pending values unknown
44 /// @brief Transactions pending
46 /// @brief Transactions committed total size
48 /// @brief Transactions ongoing total full size
50 /// @brief Transactions ongoing total executed size
52 /// @brief Are transaction pending values unknown
54 /// @brief Transactions pending total size
56 /// @brief Events scheduled
58 /// @brief the number of waits for work from source
60 /// @brief the time waited for work from source
62 /// @brief the number of waits for a worker to be available
64 /// @brief the time waited for a worker to be available
66 /// @brief the number of waits on transaction dependencies
68 /// @brief the time waited on transaction dependencies
70 /// @brief the number of waits due to the lack of memory for queueing
72 /// @brief the time waited due to the lack of memory for queueing
74 /// @brief the number of waits when worker queues were full
76 /// @brief the time waited when the worker queues were full
78 /// @brief The number of times workers waited for the commit order
80 /// @brief The total time workers waited for the commit order
82 /// @brief the time sum spent reading from the relay log
84
85 /// @brief last element of the enum, not used for any field. This is the only
86 /// enum entry that is allowed to change in new versions. Insert new fields
87 /// above this one.
89};
90
91/// @brief The information for each replication worker
93 /// @brief CHANNEL_NAME
95 /// @brief The worker id
97 /// @brief Is the thread id unknown
99 /// @brief The worker thread id
101 /// @brief The worker transaction being worked
103 /// @brief The transactions ongoing total full size
105 /// @brief The transaction ongoing total executed size
107
108 /// @brief last element of the enum, not used for any field. This is the only
109 /// enum entry that is allowed to change in new versions. Insert new fields
110 /// above this one.
113
116
119
122
123/// @brief Transaction type for workers. Encoded as a 1-based enum, matching
124/// the table definition.
128 DDL_TRX_TYPE = 3
130
132
134
136
137/**
138 @ingroup group_components_services_inventory
139
140 A service that allows you to extract stats from the replica applier.
141 You can extract general metrics for every running coordindator.
142 You can extract metrics for all replication workers running
143*/
144BEGIN_SERVICE_DEFINITION(replication_applier_metrics)
145
146/// @brief Get metrics for the replication applier.
147/// @param[out] table pointer, whose value will be set to an array of arrays of
148/// fields in which the metric values are stored.
149/// @return
150/// @retval FALSE Succeeded.
151/// @retval TRUE Failed.
153
154/// @brief Free memory for object holding metrics for the replication applier.
155/// @param[out] table Pointer to object that was previously retrieved from
156/// @c get_applier_metrics.
157DECLARE_METHOD(void, free_applier_metrics, (Applier_metrics_table * table));
158
159/// @brief Get metrics for replication workers.
160/// @param[out] table pointer, whose value will be set to an array of arrays of
161/// fields in which the metric values are stored.
162/// @return
163/// @retval FALSE Succeeded.
164/// @retval TRUE Failed.
166
167/// @brief Free memory for object holding metrics for the replication workers.
168/// @param[out] table Pointer to object that was previously retrieved from
169/// @c get_worker_metrics.
170DECLARE_METHOD(void, free_worker_metrics, (Worker_metrics_table * table));
171
172/// @brief Enables metric collection in the server for replication applier
173/// components
174/// @return
175/// @retval FALSE Succeeded.
176/// @retval TRUE Failed.
177DECLARE_BOOL_METHOD(enable_metric_collection, ());
178
179/// @brief Enables metric collection in the server for replication applier
180/// components
181/// @return
182/// @retval FALSE Succeeded.
183/// @retval TRUE Failed.
184DECLARE_BOOL_METHOD(disable_metric_collection, ());
185
186END_SERVICE_DEFINITION(replication_applier_metrics)
187
188#endif /* RPL_APPLIER_METRICS_SERVICE_H */
Experimental API header.
Ownership-agnostic array class, which is both trivial and standard-layout.
Definition: array_view.h:53
A type code and a value that is either a 64 bit integer, a boolean, or a bounded-length string.
Definition: field.h:41
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Worker_transaction_type
Transaction type for workers.
Definition: rpl_applier_metrics_service.h:125
@ DDL_TRX_TYPE
Definition: rpl_applier_metrics_service.h:128
@ UNKNOWN_TRX_TYPE
Definition: rpl_applier_metrics_service.h:126
@ DML_TRX_TYPE
Definition: rpl_applier_metrics_service.h:127
Enum_worker_metric_type
The information for each replication worker.
Definition: rpl_applier_metrics_service.h:92
@ worker_metric_type_end
last element of the enum, not used for any field.
Definition: rpl_applier_metrics_service.h:111
@ worker_id_t
The worker id.
Definition: rpl_applier_metrics_service.h:96
@ thread_id_t
The worker thread id.
Definition: rpl_applier_metrics_service.h:100
@ transaction_ongoing_full_size_t
The transactions ongoing total full size.
Definition: rpl_applier_metrics_service.h:104
@ transaction_type_t
The worker transaction being worked.
Definition: rpl_applier_metrics_service.h:102
@ worker_metrics_channel_name_t
CHANNEL_NAME.
Definition: rpl_applier_metrics_service.h:94
@ is_thread_id_unknown_t
Is the thread id unknown.
Definition: rpl_applier_metrics_service.h:98
@ transaction_ongoing_progress_size_t
The transaction ongoing total executed size.
Definition: rpl_applier_metrics_service.h:106
Enum_applier_metric_type
Gives a type to each piece of data extracted.
Definition: rpl_applier_metrics_service.h:31
@ transactions_ongoing_full_size_sum_t
Transactions ongoing total full size.
Definition: rpl_applier_metrics_service.h:49
@ waits_due_to_commit_order_sum_time_t
The total time workers waited for the commit order.
Definition: rpl_applier_metrics_service.h:81
@ waits_for_queues_full_sum_time_t
the time waited when the worker queues were full
Definition: rpl_applier_metrics_service.h:77
@ waits_for_commit_dependency_count_t
the number of waits on transaction dependencies
Definition: rpl_applier_metrics_service.h:67
@ waits_for_queues_full_count_t
the number of waits when worker queues were full
Definition: rpl_applier_metrics_service.h:75
@ applier_execution_time_t
Total execution time.
Definition: rpl_applier_metrics_service.h:35
@ transaction_ongoing_t
Transactions ongoing.
Definition: rpl_applier_metrics_service.h:41
@ waits_for_work_from_source_count_t
the number of waits for work from source
Definition: rpl_applier_metrics_service.h:59
@ are_transaction_pending_counts_unknown_t
transaction pending values unknown
Definition: rpl_applier_metrics_service.h:43
@ waits_for_available_worker_sum_time_t
the time waited for a worker to be available
Definition: rpl_applier_metrics_service.h:65
@ waits_due_to_commit_order_count_t
The number of times workers waited for the commit order.
Definition: rpl_applier_metrics_service.h:79
@ waits_for_work_from_source_sum_time_t
the time waited for work from source
Definition: rpl_applier_metrics_service.h:61
@ transaction_pending_t
Transactions pending.
Definition: rpl_applier_metrics_service.h:45
@ waits_for_queues_memory_sum_time_t
the time waited due to the lack of memory for queueing
Definition: rpl_applier_metrics_service.h:73
@ applier_metric_type_end
last element of the enum, not used for any field.
Definition: rpl_applier_metrics_service.h:88
@ transactions_ongoing_progress_size_sum_t
Transactions ongoing total executed size.
Definition: rpl_applier_metrics_service.h:51
@ transactions_committed_t
Transactions committed.
Definition: rpl_applier_metrics_service.h:39
@ waits_for_available_worker_count_t
the number of waits for a worker to be available
Definition: rpl_applier_metrics_service.h:63
@ transactions_pending_size_sum_t
Transactions pending total size.
Definition: rpl_applier_metrics_service.h:55
@ applier_metrics_channel_name_t
CHANNEL_NAME.
Definition: rpl_applier_metrics_service.h:33
@ events_committed_count_t
Events scheduled.
Definition: rpl_applier_metrics_service.h:57
@ last_applier_start_t
Last applier start.
Definition: rpl_applier_metrics_service.h:37
@ transactions_committed_size_sum_t
Transactions committed total size.
Definition: rpl_applier_metrics_service.h:47
@ time_to_read_from_relay_log_t
the time sum spent reading from the relay log
Definition: rpl_applier_metrics_service.h:83
@ waits_for_commit_dependency_sum_time_t
the time waited on transaction dependencies
Definition: rpl_applier_metrics_service.h:69
@ are_transaction_pending_sizes_unknown_t
Are transaction pending values unknown.
Definition: rpl_applier_metrics_service.h:53
@ waits_for_queues_memory_count_t
the number of waits due to the lack of memory for queueing
Definition: rpl_applier_metrics_service.h:71
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112