Class: Dbwatcher::Services::SystemInfo::SystemInfoCollector
- Inherits:
-
Object
- Object
- Dbwatcher::Services::SystemInfo::SystemInfoCollector
- Includes:
- Logging
- Defined in:
- lib/dbwatcher/services/system_info/system_info_collector.rb
Overview
Main system information collector service
Orchestrates the collection of system information from various sources including machine, database, and runtime information.
Class Method Summary collapse
-
.call ⇒ Hash
Class method to create instance and call.
Instance Method Summary collapse
-
#call ⇒ Hash
Collect system information from all sources.
Methods included from Logging
#debug_enabled?, #log_debug, #log_error, #log_info, #log_warn
Class Method Details
.call ⇒ Hash
Class method to create instance and call
27 28 29 |
# File 'lib/dbwatcher/services/system_info/system_info_collector.rb', line 27 def self.call new.call end |
Instance Method Details
#call ⇒ Hash
Collect system information from all sources
This method needs to be longer to properly handle all the collection steps and error handling in a consistent way.
rubocop:disable Metrics/MethodLength
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dbwatcher/services/system_info/system_info_collector.rb', line 38 def call start_time = current_time log_info "#{self.class.name}: Starting system information collection" info = { machine: collect_machine_info, database: collect_database_info, runtime: collect_runtime_info, collected_at: current_time.iso8601, collection_duration: nil } info[:collection_duration] = (current_time - start_time).round(3) log_info "#{self.class.name}: Completed system information collection in #{info[:collection_duration]}s" info rescue StandardError => e log_error "System information collection failed: #{e.}" { machine: {}, database: {}, runtime: {}, collected_at: current_time.iso8601, collection_duration: nil, error: e. } end |