MySQL 26.10.0
Source Code Documentation
health_monitor_report_manager.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
26#include <map>
27#include <shared_mutex>
28#include <string>
29
30#include "component_command.h"
32#include "health_monitor_lock.h"
34
35#include "my_rapidjson_size_t.h"
36#include "rapidjson/document.h"
37
38namespace hm {
39
40struct Report {
41 void issue_report();
42 std::string title;
43 std::string footer;
44 std::vector<Query> queries;
46 int next;
47};
48
49using Internal_Queries = std::map<const std::string, Query>;
50using Reports = std::map<const std::string, Report>;
51
52/**
53 The Report_Definition_Manager keeps track of all the report definitions for
54 a reporter. If a new definition is assigned, through a global server
55 variable, the Report_Definition_Manager will update its internal definition.
56 */
58 public:
61
62 void update_settings(const char *);
63 bool settings_changed(const char *);
64 static bool settings_valid(const char *, rapidjson::Document *doc = nullptr);
66 Reports *reports() { return &m_reports; }
67
68 private:
69 const char *m_cfg = nullptr;
71};
72
73} // namespace hm
The Report_Definition_Manager keeps track of all the report definitions for a reporter.
Definition: health_monitor_report_manager.h:57
const char * m_cfg
Definition: health_monitor_report_manager.h:69
void update_settings(const char *)
If there are new report definitions, the report manager will refresh its map of reports.
Definition: health_monitor_report_manager.cc:1214
static Internal_Queries m_internal_queries
Definition: health_monitor_report_manager.h:65
static bool settings_valid(const char *, rapidjson::Document *doc=nullptr)
Definition: health_monitor_report_manager.cc:1183
Reports * reports()
Definition: health_monitor_report_manager.h:66
Reports m_reports
Definition: health_monitor_report_manager.h:70
bool settings_changed(const char *)
Definition: health_monitor_report_manager.cc:1179
Define rapidjson::SizeType to be std::uint64_t.
Definition: component_command.h:29
std::map< const std::string, Query > Internal_Queries
Definition: health_monitor_report_manager.h:49
std::map< const std::string, Report > Reports
Definition: health_monitor_report_manager.h:50
Definition: health_monitor_report_manager.h:40
uint interval
Definition: health_monitor_report_manager.h:45
std::vector< Query > queries
Definition: health_monitor_report_manager.h:44
void issue_report()
Iterate over all queries in a report, execute the queries, and write the result set to the desired de...
Definition: health_monitor_report_manager.cc:1158
std::string footer
Definition: health_monitor_report_manager.h:43
int next
Definition: health_monitor_report_manager.h:46
std::string title
Definition: health_monitor_report_manager.h:42