![]() |
MySQL 26.10.0
Source Code Documentation
|
#include <health_monitor_collector.h>
Public Member Functions | |
| Collector ()=default | |
| Collector (const char *name, const char *resource_name, const char *instr_name, const char *os_name, const char *description) | |
| ~Collector () override=default | |
| Collector (const Collector &)=delete | |
| Collector & | operator= (const Collector &)=delete |
| Collector (Collector &&)=delete | |
| Collector & | operator= (Collector &&)=delete |
| const char * | resource_name () const |
| void | run_process () override |
| Sample collection loop. More... | |
| void | process () override |
| virtual void | set_buffer_size () |
| virtual bool | settings_changed () |
| virtual bool | dynamic_settings_changed () |
| virtual bool | static_settings_changed () |
| void | mark_settings_pending () |
| Mark a settings update for evaluation by the Supervisor. More... | |
| bool | settings_pending () const |
| void | set_settings_pending (bool pending) |
| virtual void | set_params () |
| virtual bool | update_settings () |
| Update system variable settings for the Collector. More... | |
| int | base_interval () const |
| int | sample_interval () const |
| void | set_sample_interval (int sample_interval) |
| Set the sample interval, adjust to the nearest multiple of the base interval. More... | |
| void | set_collector_intervals (int base_interval, int sample_interval) |
| Set the base and sample intervals together to ensure that the sample interval is a multiple of the base interval. More... | |
| virtual void | log_collector_status (bool settings) |
| Collector status with optional settings. More... | |
| virtual void | log_collector_status (const std::string &state_msg, bool settings) |
| Collector status with optional message and optional settings. More... | |
| virtual void | log_resource_status ()=0 |
| virtual void | log_status () |
| Issue a log status message for the collector. More... | |
| virtual void | log_resource_levels () |
| Log general resource status with state, mode (Fallback, Recovery, ...) and levels. More... | |
| virtual std::string | build_collector_message (const std::string &status, const std::string &mode, const std::string &message, bool settings) |
| Formatted collector message with optional settings. More... | |
| virtual std::string | build_resource_message (const std::string &status, const std::string &mode, const std::string &message, bool levels) |
| Formatted resource message, no levels or settings. More... | |
| virtual std::string | format_settings () |
| virtual std::string | format_status_info () |
| virtual std::string | tag_collector_state () |
| virtual std::string | tag_resource_state () |
| virtual std::string | tag_mode () |
Public Member Functions inherited from hm::Thread | |
| Thread ()=default | |
| Thread (const char *name, const char *instr_name, const char *os_name, const char *desc) | |
| virtual | ~Thread ()=0 |
| const char * | name () const |
| virtual bool | running () const |
| virtual int | start () |
| virtual void | stop () |
| void | signal () |
| Signal the processing loop to end the current cycle. More... | |
Static Public Member Functions | |
| static std::string | format_level (uint64_t mbytes) |
| Format storage amount in MiB, no units. More... | |
| static std::string | format_mb (uint64_t mbytes, int prec, bool show_units) |
| Format storage amount. More... | |
Static Public Member Functions inherited from hm::Thread | |
| static void | cleanup () |
| Cleanup thread instrumentation. More... | |
| static int | join (my_thread_handle *thread, void **value_ptr) |
| static bool | joinable (const my_thread_handle &thread) |
Public Attributes | |
| const std::string | k_started {"Started"} |
| const std::string | k_stopped {"Stopped"} |
| const std::string | k_offline_mode {"OFFLINE_MODE"} |
| const std::string | k_super_read_only {"SUPER_READ_ONLY"} |
| const std::string | k_invalid_path {"Invalid Path"} |
| const std::string | k_error {"ERROR"} |
| const std::string | k_system_error {"SYSTEM ERROR"} |
| const std::string | k_failed {"failed"} |
| const std::string | k_remaining {"attempts remaining"} |
| int | m_retention {0} |
| std::atomic< bool > | m_settings_pending {false} |
| int | m_status_interval {0} |
| int | m_status_counter {0} |
| bool | m_verbose_log {false} |
| bool | m_force_status {false} |
| Cycle_Timer | m_sample_timer |
| Cycle_Timer | m_status_timer |
Static Public Attributes | |
| static constexpr uint64_t | no_warn_level {std::numeric_limits<uint64_t>::max()} |
| static constexpr int | k_min_interval {1} |
| static constexpr int | k_max_interval {86400} |
| static constexpr int | k_default_base_interval {10} |
| static constexpr int | k_default_sample_interval {k_default_base_interval * 6} |
Protected Member Functions | |
| void | consume_settings_pending () |
| Consume one pending notification without clearing a concurrent update. More... | |
| void | apply_pending_settings () |
| Apply settings while the collector command lock is held. More... | |
| Cycle_Timer & | sample_timer () |
| Cycle_Timer & | status_message_timer () |
| void | initialize_sample_timers () |
| Initialize collection timers. More... | |
| void | advance_sample_timers () |
| Process collector sample and status timers. More... | |
Protected Member Functions inherited from hm::Thread | |
| int | start_thread () |
| void | stop_thread () |
| void | request_thread_stop () |
| Request that the worker stop without waiting for it to exit. More... | |
| void | join_thread () |
| Wait for a stopped worker to exit. More... | |
| bool | stop_requested () |
| Return true when worker shutdown has been requested. More... | |
| virtual void | pre_process () |
| virtual void | post_process () |
Protected Attributes | |
| const std::string | m_resource_name |
| bool | m_running {false} |
Protected Attributes inherited from hm::Thread | |
| std::mutex | m_command_lock |
| const std::string | m_name |
| const std::string | m_instr_name |
| const std::string | m_os_name |
| const std::string | m_description |
| std::atomic< bool > | m_thread_running {false} |
| bool | m_stop {false} |
| my_thread_handle | m_thread |
| PSI_thread_key | m_thread_key {0} |
| PSI_thread_info | m_thread_info |
| mysql_mutex_t | m_wait_lock |
| PSI_mutex_key | m_mutex_key {0} |
| PSI_mutex_info | m_mutex_info |
| mysql_cond_t | m_wait |
| PSI_cond_key | m_cond_key {0} |
| PSI_cond_info | m_cond_info |
Private Member Functions | |
| void | set_base_interval (int base_interval) |
| Set the base monitoring interval if different than the sample interval. More... | |
Private Attributes | |
| int | m_base_interval {k_default_base_interval} |
| int | m_sample_interval {k_default_sample_interval} |
| bool | m_custom_base_interval {false} |
|
default |
| hm::Collector::Collector | ( | const char * | name, |
| const char * | resource_name, | ||
| const char * | instr_name, | ||
| const char * | os_name, | ||
| const char * | description | ||
| ) |
|
overridedefault |
|
delete |
|
delete |
|
protected |
Process collector sample and status timers.
|
protected |
Apply settings while the collector command lock is held.
|
inline |
|
virtual |
Formatted collector message with optional settings.
| status | Collector status such as Started, Stopped, etc. |
| mode | Mode name, if any, such as Fallback, Recovery, etc. |
| message | Message text, if any |
| settings | If true then append message with collector system variables |
|
virtual |
Formatted resource message, no levels or settings.
| status | Resource status, if any, such as Warning Level, Normal Level |
| mode | Mode name, if any, such as Fallback, Recovery |
| message | Message text, if any |
| levels | If true then append message with resource levels |
|
protected |
Consume one pending notification without clearing a concurrent update.
|
inlinevirtual |
Reimplemented in hm::Disk_Forecaster.
|
static |
Format storage amount in MiB, no units.
| [in] | mbytes | Storage amount in megabytes |
|
static |
Format storage amount.
| [in] | mbytes | Storage amount in megabytes |
| [in] | prec | Digits after the decimal, -1 for variable wrt units |
| [in] | show_units | True to append units |
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Disk_Forecaster, hm::Memory_Collector, hm::Periodic_Reporter, and hm::System_Collector.
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Disk_Forecaster, hm::Memory_Collector, and hm::System_Collector.
|
protected |
Initialize collection timers.
|
virtual |
Collector status with optional settings.
|
virtual |
Collector status with optional message and optional settings.
|
virtual |
Log general resource status with state, mode (Fallback, Recovery, ...) and levels.
Reimplemented in hm::Disk_Collector, and hm::Disk_Forecaster.
|
pure virtual |
Implemented in hm::Disk_Collector, hm::Disk_Forecaster, hm::Memory_Collector, hm::Periodic_Reporter, hm::Supervisor, and hm::System_Collector.
|
virtual |
Issue a log status message for the collector.
| void hm::Collector::mark_settings_pending | ( | ) |
Mark a settings update for evaluation by the Supervisor.
Do not inspect collector settings or acquire the command lock in the system variable callback. The Supervisor evaluates the current values while it holds the command lock.
|
inlineoverridevirtual |
Reimplemented from hm::Thread.
Reimplemented in hm::Disk_Collector, hm::Disk_Forecaster, hm::Memory_Collector, hm::Periodic_Reporter, hm::Supervisor, and hm::System_Collector.
|
inline |
|
overridevirtual |
Sample collection loop.
Reimplemented from hm::Thread.
Reimplemented in hm::Supervisor, and hm::Triggered_Reporter.
|
inline |
|
inlineprotected |
|
private |
Set the base monitoring interval if different than the sample interval.
Adjust the sample interval to the nearest multiple of the base interval. If the base interval is not set, then the sample interval is used as the base interval.
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Memory_Collector, and hm::System_Collector.
| void hm::Collector::set_collector_intervals | ( | int | base_interval, |
| int | sample_interval | ||
| ) |
Set the base and sample intervals together to ensure that the sample interval is a multiple of the base interval.
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Disk_Forecaster, hm::Memory_Collector, hm::System_Collector, and hm::Periodic_Reporter.
| void hm::Collector::set_sample_interval | ( | int | sample_interval | ) |
Set the sample interval, adjust to the nearest multiple of the base interval.
|
inline |
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Memory_Collector, hm::Periodic_Reporter, and hm::System_Collector.
|
inline |
|
inlinevirtual |
Reimplemented in hm::Disk_Forecaster.
|
inlineprotected |
|
inlinevirtual |
Reimplemented in hm::Disk_Collector, hm::Memory_Collector, and hm::System_Collector.
|
inlinevirtual |
Reimplemented in hm::Disk_Collector.
|
inlinevirtual |
Reimplemented in hm::Disk_Collector.
|
virtual |
Update system variable settings for the Collector.
Reimplemented in hm::Disk_Forecaster.
|
staticconstexpr |
|
staticconstexpr |
| const std::string hm::Collector::k_error {"ERROR"} |
| const std::string hm::Collector::k_failed {"failed"} |
| const std::string hm::Collector::k_invalid_path {"Invalid Path"} |
|
staticconstexpr |
|
staticconstexpr |
| const std::string hm::Collector::k_offline_mode {"OFFLINE_MODE"} |
| const std::string hm::Collector::k_remaining {"attempts remaining"} |
| const std::string hm::Collector::k_started {"Started"} |
| const std::string hm::Collector::k_stopped {"Stopped"} |
| const std::string hm::Collector::k_super_read_only {"SUPER_READ_ONLY"} |
| const std::string hm::Collector::k_system_error {"SYSTEM ERROR"} |
|
private |
|
private |
| bool hm::Collector::m_force_status {false} |
|
protected |
| int hm::Collector::m_retention {0} |
|
protected |
|
private |
| Cycle_Timer hm::Collector::m_sample_timer |
| std::atomic<bool> hm::Collector::m_settings_pending {false} |
| int hm::Collector::m_status_counter {0} |
| int hm::Collector::m_status_interval {0} |
| Cycle_Timer hm::Collector::m_status_timer |
| bool hm::Collector::m_verbose_log {false} |
|
staticconstexpr |