MySQL 26.10.0
Source Code Documentation
hm::Supervisor Class Reference

#include <health_monitor_supervisor.h>

Inheritance diagram for hm::Supervisor:
[legend]

Public Member Functions

 Supervisor ()
 
 ~Supervisor () override=default
 
 Supervisor (const Supervisor &)=delete
 
Supervisor & operator= (const Supervisor &)=delete
 
 Supervisor (Supervisor &&)=delete
 
Supervisor & operator= (Supervisor &&)=delete
 
void notify_settings_update ()
 Notify Supervisor that collector settings are pending. More...
 
void run_process () override
 Thread process loop: Wait for pending work then execute it. More...
 
void process () override
 Execute any pending tasks. More...
 
void log_resource_status () override
 
- Public Member Functions inherited from hm::Collector
 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
 
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_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...
 

Private Attributes

bool m_settings_update_pending {false}
 

Additional Inherited Members

- Static Public Member Functions inherited from hm::Collector
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 inherited from hm::Collector
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 inherited from hm::Collector
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 inherited from hm::Collector
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 inherited from hm::Collector
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
 

Constructor & Destructor Documentation

◆ Supervisor() [1/3]

hm::Supervisor::Supervisor ( )

◆ ~Supervisor()

hm::Supervisor::~Supervisor ( )
overridedefault

◆ Supervisor() [2/3]

hm::Supervisor::Supervisor ( const Supervisor &  )
delete

◆ Supervisor() [3/3]

hm::Supervisor::Supervisor ( Supervisor &&  )
delete

Member Function Documentation

◆ log_resource_status()

void hm::Supervisor::log_resource_status ( )
inlineoverridevirtual

Implements hm::Collector.

◆ notify_settings_update()

void hm::Supervisor::notify_settings_update ( )

Notify Supervisor that collector settings are pending.

Record pending settings work and wake Supervisor.

◆ operator=() [1/2]

Supervisor & hm::Supervisor::operator= ( const Supervisor &  )
delete

◆ operator=() [2/2]

Supervisor & hm::Supervisor::operator= ( Supervisor &&  )
delete

◆ process()

void hm::Supervisor::process ( )
overridevirtual

Execute any pending tasks.

Reimplemented from hm::Collector.

◆ run_process()

void hm::Supervisor::run_process ( )
overridevirtual

Thread process loop: Wait for pending work then execute it.

Reimplemented from hm::Collector.

Member Data Documentation

◆ m_settings_update_pending

bool hm::Supervisor::m_settings_update_pending {false}
private

The documentation for this class was generated from the following files: