MySQL 26.10.0
Source Code Documentation
health_monitor_periodic_reporter.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 2026, 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#pragma once
25
29
30#include <string>
31
32namespace hm {
33
34/**
35 The Periodic_Reporter has a framework for printing reports to some
36 destination. A Report_Definition_Manager will observe changes to a config
37 variable that defines the report contents. On some event, the report is
38 issued. Such an event can be the expiration of a timer, a signal, etc.
39
40 The Periodic_Reporter will issue reports at specified intervals, as
41 indicated by the report definition. Other behavior can be defined in
42 subclasses.
43 */
45 public:
46 Periodic_Reporter(const char *reporter_name, const char *status_name,
47 const char *instr_name, const char *os_name,
48 const char *description, sv_bool *sysvar_running,
49 sv_char *sysvar_def);
50 ~Periodic_Reporter() override = default;
55
56 void pre_process() override;
57 void process() override;
58 virtual void issue_report();
59
60 void log_resource_status() override;
61 std::string format_settings() override;
62 bool settings_changed() override;
63 void set_params() override;
64 bool running() const override;
66
67 // Default definition of all periodic reports.
68 static const char *default_periodic_report;
69
70 private:
71 const static uint DEPRECATION_REPORT_SAMPLE_INTERVAL = 3600;
73
74 protected:
75 bool m_settings_changed = false;
79};
80
81} // namespace hm
Definition: health_monitor_collector.h:41
The Periodic_Reporter has a framework for printing reports to some destination.
Definition: health_monitor_periodic_reporter.h:44
static const uint DEPRECATION_REPORT_SAMPLE_INTERVAL
Definition: health_monitor_periodic_reporter.h:71
Periodic_Reporter(Periodic_Reporter &&)=delete
~Periodic_Reporter() override=default
void process() override
Run report only if more than half of the level 3 limit is available.
Definition: health_monitor_periodic_reporter.cc:131
static const char * default_periodic_report
Definition: health_monitor_periodic_reporter.h:68
int deprecation_msg_next
Definition: health_monitor_periodic_reporter.h:72
Periodic_Reporter & operator=(const Periodic_Reporter &)=delete
int report_deprecated_usage()
Periodically report usage of the deprecated features.
Definition: health_monitor_periodic_reporter.cc:164
Periodic_Reporter(const char *reporter_name, const char *status_name, const char *instr_name, const char *os_name, const char *description, sv_bool *sysvar_running, sv_char *sysvar_def)
Definition: health_monitor_periodic_reporter.cc:106
sv_char * m_sysvar_def
Definition: health_monitor_periodic_reporter.h:78
void pre_process() override
Set the timer to 10 sec before starting to process.
Definition: health_monitor_periodic_reporter.cc:123
void set_params() override
Set report parameters from the system variables.
Definition: health_monitor_periodic_reporter.cc:263
bool running() const override
Return health_monitor reporting variable.
Definition: health_monitor_periodic_reporter.cc:271
bool settings_changed() override
Indicate if the Memory Periodic_Reporter settings have changed.
Definition: health_monitor_periodic_reporter.cc:254
sv_bool * m_sysvar_running
Definition: health_monitor_periodic_reporter.h:77
Periodic_Reporter(const Periodic_Reporter &)=delete
Periodic_Reporter & operator=(Periodic_Reporter &&)=delete
Report_Definition_Manager m_rep_mgr
Definition: health_monitor_periodic_reporter.h:76
bool m_settings_changed
Definition: health_monitor_periodic_reporter.h:75
virtual void issue_report()
Process all periodic report definitions, issue those that are due.
Definition: health_monitor_periodic_reporter.cc:208
std::string format_settings() override
Periodic_Reporter settings formatted string.
Definition: health_monitor_periodic_reporter.cc:244
void log_resource_status() override
Periodic Reporter status.
Definition: health_monitor_periodic_reporter.cc:239
The Report_Definition_Manager keeps track of all the report definitions for a reporter.
Definition: health_monitor_report_manager.h:57
Definition: component_command.h:29