Class: RailsErrorDashboard::Queries::MttrStats

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_error_dashboard/queries/mttr_stats.rb

Overview

Query: Calculate Mean Time to Resolution (MTTR) statistics Provides metrics on how quickly errors are resolved

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(days = 30) ⇒ MttrStats

Returns a new instance of MttrStats.



12
13
14
15
# File 'lib/rails_error_dashboard/queries/mttr_stats.rb', line 12

def initialize(days = 30)
  @days = days
  @start_date = days.days.ago
end

Class Method Details

.call(days = 30) ⇒ Object



8
9
10
# File 'lib/rails_error_dashboard/queries/mttr_stats.rb', line 8

def self.call(days = 30)
  new(days).call
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails_error_dashboard/queries/mttr_stats.rb', line 17

def call
  {
    overall_mttr: calculate_overall_mttr,
    mttr_by_platform: mttr_by_platform,
    mttr_by_severity: mttr_by_severity,
    mttr_trend: mttr_trend_by_week,
    fastest_resolution: fastest_resolution_time,
    slowest_resolution: slowest_resolution_time,
    total_resolved: resolved_errors.count
  }
end