MySQL 9.1.0
Source Code Documentation
server_telemetry_metrics_bits.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 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 SERVER_TELEMETRY_METRICS_BITS_H
25#define SERVER_TELEMETRY_METRICS_BITS_H
26
27#include <cstddef> // size_t
28#include <cstdint> // int64_t
29
32#include "psi_metric_bits.h"
33
36
37/**
38 Initialize Telemetry Metric iterator object
39 to enumerate metrics and read measurement values, pointing to 1st matching
40 metric
41
42 @param meter define meter (metric group) scope
43 @param [out] iterator iterator object
44
45 @returns Result of iterator creation
46 @retval false Success
47 @retval true Failure
48*/
49typedef bool (*metrics_iterator_create_t)(const char *meter,
51
52/**
53 Uninitialize Telemetry Metric iterator
54
55 @param iterator iterator object
56
57 @returns Result of iterator creation
58 @retval false Success
59 @retval true Failure
60*/
62
63/**
64 Advance Telemetry Metric iterator to next element.
65
66 @param iterator iterator object
67
68 @returns Result of iterator creation
69 @retval false Success
70 @retval true Failure or no more elements
71*/
73
74/**
75 Return group name for the element pointed by
76 Telemetry Metric iterator.
77
78 @param iterator iterator object
79 @param[out] out_group_handle pointer to receive string value
80
81 @returns Result of operation
82 @retval false Success
83 @retval true Failure or no more elements
84*/
86 telemetry_metrics_iterator iterator, my_h_string *out_group_handle);
87
88/**
89 Return metric name for the element pointed by
90 Telemetry Metric iterator.
91
92 @param iterator iterator object
93 @param[out] out_name_handle pointer to receive string value
94
95 @returns Result of operation
96 @retval false Success
97 @retval true Failure or no more elements
98*/
100 my_h_string *out_name_handle);
101
102/**
103 Return metric name for the element pointed by
104 Telemetry Metric iterator.
105
106 @param iterator iterator object
107 @param delivery callback to deliver measurements
108 @param delivery_context context pointer, passed back to callback
109
110 @returns Result of operation
111 @retval false Success
112 @retval true Failure or no more elements
113*/
116 measurement_delivery_callback_t delivery, void *delivery_context);
117
118/**
119 Return metric description for the element pointed by
120 Telemetry Metric iterator.
121
122 @param iterator iterator object
123 @param[out] out_desc_handle pointer to receive string value
124
125 @returns Result of operation
126 @retval false Success
127 @retval true Failure or no more elements
128*/
130 telemetry_metrics_iterator iterator, my_h_string *out_desc_handle);
131
132/**
133 Return metric unit for the element pointed by
134 Telemetry Metric iterator.
135
136 @param iterator iterator object
137 @param[out] out_unit_handle pointer to receive string value
138
139 @returns Result of operation
140 @retval false Success
141 @retval true Failure or no more elements
142*/
144 my_h_string *out_unit_handle);
145
146/**
147 Return metric numeric type for the element pointed by
148 Telemetry Metric iterator.
149
150 @param iterator iterator object
151 @param[out] numeric reference to numeric type output
152
153 @returns Result of operation
154 @retval false Success
155 @retval true Failure or no more elements
156*/
159
160/**
161 Return metric OTEL type for the element pointed by
162 Telemetry Metric iterator.
163
164 @param iterator iterator object
165 @param[out] metric_type reference to metric type output
166
167 @returns Result of operation
168 @retval false Success
169 @retval true Failure or no more elements
170*/
172 telemetry_metrics_iterator iterator, MetricOTELType &metric_type);
173
174/**
175 Return metric measurement callback function for the element pointed by
176 Telemetry Metric iterator.
177
178 @param iterator iterator object
179 @param[out] callback reference to metric callback
180 @param[out] measurement_context reference to metric context pointer
181
182 @returns Result of operation
183 @retval false Success
184 @retval true Failure or no more elements
185*/
188 void *&measurement_context);
189
190/**
191 Initialize Telemetry Meter (Metric Group) iterator object
192 to enumerate metrics groups, pointing to 1st matching
193 metric
194
195 @param [out] iterator iterator object
196
197 @returns Result of iterator creation
198 @retval false Success
199 @retval true Failure
200*/
202
203/**
204 Uninitialize Telemetry Meter (Metric Group) iterator
205
206 @param iterator iterator object
207
208 @returns Result of iterator creation
209 @retval false Success
210 @retval true Failure
211*/
213
214/**
215 Advance Telemetry Meter (Metric Group) iterator to next element.
216
217 @param iterator iterator object
218
219 @returns Result of iterator creation
220 @retval false Success
221 @retval true Failure or no more elements
222*/
224
225/**
226 Return meter name for the element pointed by
227 Telemetry Meter (Metric Group) iterator.
228
229 @param iterator iterator object
230 @param[out] out_name_handle pointer to receive string value
231
232 @returns Result of operation
233 @retval false Success
234 @retval true Failure or no more elements
235*/
237 my_h_string *out_name_handle);
238
239/**
240 Return meter update frequency for the element pointed by
241 Telemetry Meter iterator.
242
243 @param iterator iterator object
244 @param[out] value reference to result variable
245
246 @returns Result of operation
247 @retval false Success
248 @retval true Failure or no more elements
249*/
251 telemetry_meters_iterator iterator, unsigned int &value);
252
253/**
254 Return meter enabled status for the element pointed by
255 Telemetry Meter iterator.
256
257 @param iterator iterator object
258 @param[out] enabled reference to enabled result
259
260 @returns Result of operation
261 @retval false Success
262 @retval true Failure or no more elements
263*/
265 telemetry_meters_iterator iterator, bool &enabled);
266
267/**
268 Return meter description for the element pointed by
269 Telemetry Meter iterator.
270
271 @param iterator iterator object
272 @param[out] out_desc_handle pointer to receive string value
273
274 @returns Result of operation
275 @retval false Success
276 @retval true Failure or no more elements
277*/
279 telemetry_meters_iterator iterator, my_h_string *out_desc_handle);
280
281/**
282 Take the lock(s) needed to read system variables.
283 For performance reasons, lock is taken once per metric export instead of
284 once per each variable read.
285
286 @returns Result of operation
287 @retval false Success
288 @retval true Failure or no more elements
289*/
291
292/**
293 Release the lock(s) needed to read system variables.
294 For performance reasons, lock is taken once per metric export instead of
295 once per each variable read.
296
297 @returns Result of operation
298 @retval false Success
299 @retval true Failure or no more elements
300*/
302
303#endif /* SERVER_TELEMETRY_METRICS_BITS_H */
constexpr value_type numeric
Definition: classic_protocol_constants.h:282
static PSI_meter_info_v1 meter[]
Definition: plugin.cc:96
MetricOTELType
Definition: psi_metric_bits.h:32
MetricNumType
Definition: psi_metric_bits.h:38
void(* measurement_callback_t)(void *measurement_context, measurement_delivery_callback_t delivery, void *delivery_context)
Single metric measurement callback can return multiple measurement values.
Definition: psi_metric_bits.h:97
required bool enabled
Definition: replication_group_member_actions.proto:33
bool(* meters_iterator_get_name_t)(telemetry_meters_iterator iterator, my_h_string *out_name_handle)
Return meter name for the element pointed by Telemetry Meter (Metric Group) iterator.
Definition: server_telemetry_metrics_bits.h:236
bool(* metrics_iterator_get_unit_t)(telemetry_metrics_iterator iterator, my_h_string *out_unit_handle)
Return metric unit for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:143
bool(* meters_iterator_get_description_t)(telemetry_meters_iterator iterator, my_h_string *out_desc_handle)
Return meter description for the element pointed by Telemetry Meter iterator.
Definition: server_telemetry_metrics_bits.h:278
bool(* metrics_iterator_get_value_t)(telemetry_metrics_iterator iterator, measurement_delivery_callback_t delivery, void *delivery_context)
Return metric name for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:114
bool(* metrics_iterator_destroy_t)(telemetry_metrics_iterator iterator)
Uninitialize Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:61
bool(* metrics_iterator_get_name_t)(telemetry_metrics_iterator iterator, my_h_string *out_name_handle)
Return metric name for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:99
bool(* metrics_iterator_get_callback_t)(telemetry_metrics_iterator iterator, measurement_callback_t &callback, void *&measurement_context)
Return metric measurement callback function for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:186
bool(* meters_iterator_create_t)(telemetry_meters_iterator *iterator)
Initialize Telemetry Meter (Metric Group) iterator object to enumerate metrics groups,...
Definition: server_telemetry_metrics_bits.h:201
struct telemetry_metrics_iterator_imp * telemetry_metrics_iterator
Definition: server_telemetry_metrics_bits.h:35
bool(* meters_iterator_advance_t)(telemetry_meters_iterator iterator)
Advance Telemetry Meter (Metric Group) iterator to next element.
Definition: server_telemetry_metrics_bits.h:223
bool(* metrics_iterator_get_metric_type_t)(telemetry_metrics_iterator iterator, MetricOTELType &metric_type)
Return metric OTEL type for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:171
bool(* metrics_iterator_advance_t)(telemetry_metrics_iterator iterator)
Advance Telemetry Metric iterator to next element.
Definition: server_telemetry_metrics_bits.h:72
bool(* metrics_iterator_create_t)(const char *meter, telemetry_metrics_iterator *iterator)
Initialize Telemetry Metric iterator object to enumerate metrics and read measurement values,...
Definition: server_telemetry_metrics_bits.h:49
struct telemetry_meters_iterator_imp * telemetry_meters_iterator
Definition: server_telemetry_metrics_bits.h:34
bool(* meters_iterator_destroy_t)(telemetry_meters_iterator iterator)
Uninitialize Telemetry Meter (Metric Group) iterator.
Definition: server_telemetry_metrics_bits.h:212
bool(* measurement_reading_end_t)()
Release the lock(s) needed to read system variables.
Definition: server_telemetry_metrics_bits.h:301
bool(* metrics_iterator_get_group_t)(telemetry_metrics_iterator iterator, my_h_string *out_group_handle)
Return group name for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:85
bool(* meters_iterator_get_enabled_t)(telemetry_meters_iterator iterator, bool &enabled)
Return meter enabled status for the element pointed by Telemetry Meter iterator.
Definition: server_telemetry_metrics_bits.h:264
bool(* measurement_reading_start_t)()
Take the lock(s) needed to read system variables.
Definition: server_telemetry_metrics_bits.h:290
bool(* metrics_iterator_get_description_t)(telemetry_metrics_iterator iterator, my_h_string *out_desc_handle)
Return metric description for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:129
bool(* meters_iterator_get_frequency_t)(telemetry_meters_iterator iterator, unsigned int &value)
Return meter update frequency for the element pointed by Telemetry Meter iterator.
Definition: server_telemetry_metrics_bits.h:250
bool(* metrics_iterator_get_numeric_type_t)(telemetry_metrics_iterator iterator, MetricNumType &numeric)
Return metric numeric type for the element pointed by Telemetry Metric iterator.
Definition: server_telemetry_metrics_bits.h:157
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129
Definition: psi_metric_bits.h:77
Definition: mysql_string_service.cc:60