MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
worker_metrics.h
Go to the documentation of this file.
1// Copyright (c) 2024, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License, version 2.0, for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23
24#ifndef CHANGESTREAMS_APPLY_METRICS_WORKER_METRICS_H
25#define CHANGESTREAMS_APPLY_METRICS_WORKER_METRICS_H
26
27#include <cstdint> // int64_t
29
30namespace cs::apply::instruments {
31
32/// @brief Abstract class for classes that contain metrics related to
33/// transaction execution in applier workers
35 public:
36 /// @brief This class helps signaling a transactions as DDL or DML
38 UNKNOWN, // The transaction type is not yet known
39 DML, // It is a DML transaction
40 DDL // It is a DDL transaction
41 };
42
43 virtual ~Worker_metrics() = default;
44
45 /// @brief Resets the instruments on this instance.
46 virtual void reset() = 0;
47
48 /// @brief Returns the type of the currently being processed transaction
49 /// @return If the type is unknown, DML or DDL
51
52 /// @brief Set the type for the transaction being currently processed
53 /// @param type_info what is the type: UNKONWN, DML or DDL
54 virtual void set_transaction_type(Transaction_type_info type_info) = 0;
55
56 /// @brief set the full size of the ongoing transaction.
57 /// @param amount new size
58 virtual void set_transaction_ongoing_full_size(int64_t amount) = 0;
59
60 /// @brief Gets the full size of the ongoing transaction
61 /// @return the total size of the ongoing transaction
62 virtual int64_t get_transaction_ongoing_full_size() const = 0;
63
64 /// @brief increment the executed size of the ongoing transaction.
65 /// @param amount the size amount to increment.
66 virtual void inc_transaction_ongoing_progress_size(int64_t amount) = 0;
67
68 /// @brief Resets the the executed size of the ongoing transaction to 0
70
71 /// @brief Gets the executed size of the ongoing transaction
72 /// @return the exectuted size of the ongoing transaction
73 virtual int64_t get_transaction_ongoing_progress_size() const = 0;
74
75 /// @brief Return time metric for waits on commit order.
76 /// @return a Time_based_metric_interface object that contains metric
77 /// information on a wait
79};
80} // namespace cs::apply::instruments
81
82#endif /* CHANGESTREAMS_APPLY_METRICS_WORKER_METRICS_H */
Abstract class for time based metrics implementations.
Definition: time_based_metric_interface.h:32
Abstract class for classes that contain metrics related to transaction execution in applier workers.
Definition: worker_metrics.h:34
virtual int64_t get_transaction_ongoing_progress_size() const =0
Gets the executed size of the ongoing transaction.
virtual void set_transaction_ongoing_full_size(int64_t amount)=0
set the full size of the ongoing transaction.
virtual void set_transaction_type(Transaction_type_info type_info)=0
Set the type for the transaction being currently processed.
virtual void inc_transaction_ongoing_progress_size(int64_t amount)=0
increment the executed size of the ongoing transaction.
virtual void reset_transaction_ongoing_progress_size()=0
Resets the the executed size of the ongoing transaction to 0.
Transaction_type_info
This class helps signaling a transactions as DDL or DML.
Definition: worker_metrics.h:37
virtual Time_based_metric_interface & get_waits_due_to_commit_order()=0
Return time metric for waits on commit order.
virtual void reset()=0
Resets the instruments on this instance.
virtual Transaction_type_info get_transaction_type() const =0
Returns the type of the currently being processed transaction.
virtual int64_t get_transaction_ongoing_full_size() const =0
Gets the full size of the ongoing transaction.
Definition: applier_metrics.cc:27