MySQL 26.10.0
Source Code Documentation
hm::Triggered_Reporter Class Reference

The Triggered_Reporter overrides run_process to react only to signals. More...

#include <health_monitor_triggered_reporter.h>

Inheritance diagram for hm::Triggered_Reporter:
[legend]

Public Member Functions

 Triggered_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)
 
void run_process () override
 Thread process loop: Wait for signal then run reports. More...
 
void issue_report () override
 Run the set of queries defined by the config settings and print results. More...
 
- Public Member Functions inherited from hm::Periodic_Reporter
 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)
 
 ~Periodic_Reporter () override=default
 
 Periodic_Reporter (const Periodic_Reporter &)=delete
 
Periodic_Reporter & operator= (const Periodic_Reporter &)=delete
 
 Periodic_Reporter (Periodic_Reporter &&)=delete
 
Periodic_Reporter & operator= (Periodic_Reporter &&)=delete
 
void pre_process () override
 Set the timer to 10 sec before starting to process. More...
 
void process () override
 Run report only if more than half of the level 3 limit is available. More...
 
void log_resource_status () override
 Periodic Reporter status. More...
 
std::string format_settings () override
 Periodic_Reporter settings formatted string. More...
 
bool settings_changed () override
 Indicate if the Memory Periodic_Reporter settings have changed. More...
 
void set_params () override
 Set report parameters from the system variables. More...
 
bool running () const override
 Return health_monitor reporting variable. More...
 
int report_deprecated_usage ()
 Periodically report usage of the deprecated features. More...
 
- 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 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 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_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 int start ()
 
virtual void stop ()
 
void signal ()
 Signal the processing loop to end the current cycle. More...
 

Static Public Attributes

static const char * default_memory_report
 
- Static Public Attributes inherited from hm::Periodic_Reporter
static const char * default_periodic_report
 
- 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}
 

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
 
- 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 post_process ()
 
- Protected Attributes inherited from hm::Periodic_Reporter
bool m_settings_changed = false
 
Report_Definition_Manager m_rep_mgr
 
sv_bool * m_sysvar_running = nullptr
 
sv_char * m_sysvar_def = nullptr
 
- 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
 

Detailed Description

The Triggered_Reporter overrides run_process to react only to signals.

When signaled, the Triggered_Reporter will issue the report according to the definition.

Constructor & Destructor Documentation

◆ Triggered_Reporter()

hm::Triggered_Reporter::Triggered_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 
)

Member Function Documentation

◆ issue_report()

void hm::Triggered_Reporter::issue_report ( )
overridevirtual

Run the set of queries defined by the config settings and print results.

Reimplemented from hm::Periodic_Reporter.

◆ run_process()

void hm::Triggered_Reporter::run_process ( )
overridevirtual

Thread process loop: Wait for signal then run reports.

Triggered reports are issued by sending a signal.

Reimplemented from hm::Collector.

Member Data Documentation

◆ default_memory_report

const char * hm::Triggered_Reporter::default_memory_report
static
Initial value:
=
"[{"
" \"title\" : \"========== MEMORY DIAGNOSTICS BEGIN ==========\","
" \"queries\" : ["
" {\"query\" : \"hm_mem_usage_overview\"},"
" {\"query\" : \"hm_mem_usage_per_component\"},"
" {\"query\" : \"hm_processlist_details_by_current_mem\"},"
" {\"query\" : \"hm_statement_stats_by_total_mem\"},"
" {\"query\" : \"hm_events_allocating_most_mem\"},"
" {\"query\" : \"hm_innodb_buffer_pool_stats\"}"
" ], "
" \"footer\" : \"========== MEMORY DIAGNOSTICS END ==========\""
" }]"

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