Class: RailsPulse::SummaryService
- Inherits:
-
Object
- Object
- RailsPulse::SummaryService
- Defined in:
- app/services/rails_pulse/summary_service.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#period_type ⇒ Object
readonly
Returns the value of attribute period_type.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
-
#initialize(period_type, start_time) ⇒ SummaryService
constructor
A new instance of SummaryService.
- #perform ⇒ Object
Constructor Details
#initialize(period_type, start_time) ⇒ SummaryService
Returns a new instance of SummaryService.
6 7 8 9 10 |
# File 'app/services/rails_pulse/summary_service.rb', line 6 def initialize(period_type, start_time) @period_type = period_type @start_time = Summary.normalize_period_start(period_type, start_time) @end_time = Summary.calculate_period_end(period_type, @start_time) end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
4 5 6 |
# File 'app/services/rails_pulse/summary_service.rb', line 4 def end_time @end_time end |
#period_type ⇒ Object (readonly)
Returns the value of attribute period_type.
4 5 6 |
# File 'app/services/rails_pulse/summary_service.rb', line 4 def period_type @period_type end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
4 5 6 |
# File 'app/services/rails_pulse/summary_service.rb', line 4 def start_time @start_time end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/rails_pulse/summary_service.rb', line 12 def perform Rails.logger.info "[RailsPulse] Starting #{period_type} summary for #{start_time}" ActiveRecord::Base.transaction do aggregate_requests # Overall system metrics aggregate_routes # Per-route metrics aggregate_queries # Per-query metrics end Rails.logger.info "[RailsPulse] Completed #{period_type} summary" rescue => e Rails.logger.error "[RailsPulse] Summary failed: #{e.}" raise end |