Class: MysqlAlterMonitoring::Monitor
- Inherits:
-
Object
- Object
- MysqlAlterMonitoring::Monitor
- Defined in:
- lib/mysql_alter_monitoring/monitor.rb
Overview
MysqlAlterMonitoring::Monitor
Constant Summary collapse
- EMPTY_EVENT_MAX_COUNT =
10
Instance Method Summary collapse
- #initialize(client, io, logging_interval: 10) ⇒ void constructor
- #run_forever ⇒ void
-
#run_until_empty_event ⇒ void
Fetch ALTER TABLE events at specified intervals and output in JSON format to specified IO.
Constructor Details
#initialize(client, io, logging_interval: 10) ⇒ void
14 15 16 17 18 19 |
# File 'lib/mysql_alter_monitoring/monitor.rb', line 14 def initialize(client, io, logging_interval: 10) @client = client @logger = JsonLogger.new(io) @logging_interval = logging_interval @performance_schema_setting = PerformanceSchemaSetting.new(client, io) end |
Instance Method Details
#run_forever ⇒ void
37 38 39 |
# File 'lib/mysql_alter_monitoring/monitor.rb', line 37 def run_forever run { false } end |
#run_until_empty_event ⇒ void
This method returns an undefined value.
Fetch ALTER TABLE events at specified intervals and output in JSON format to specified IO. Exit when a total of 10 empty ALTER TABLE events are fetched.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mysql_alter_monitoring/monitor.rb', line 25 def run_until_empty_event empty_event_count = 0 run do |event| empty_event_count += 1 if event.empty? empty_event_count > EMPTY_EVENT_MAX_COUNT end logger.info({ message: 'Finish monitoring' }) end |