Class: RailsErrorDashboard::StormEvent
- Inherits:
-
ErrorLogsRecord
- Object
- ActiveRecord::Base
- ErrorLogsRecord
- RailsErrorDashboard::StormEvent
- Defined in:
- app/models/rails_error_dashboard/storm_event.rb
Overview
One row per storm-protection episode (per process). Powers the dashboard banner and the storm history page. Counts are exact, not extrapolated. Inherits ErrorLogsRecord so separate-database routing applies.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #duration_seconds ⇒ Object
-
#top_fingerprints_list ⇒ Array<Hash>
Top fingerprints by count, [] when absent/corrupt.
Instance Method Details
#active? ⇒ Boolean
14 15 16 |
# File 'app/models/rails_error_dashboard/storm_event.rb', line 14 def active? ended_at.nil? end |
#duration_seconds ⇒ Object
18 19 20 21 22 |
# File 'app/models/rails_error_dashboard/storm_event.rb', line 18 def duration_seconds return nil unless ended_at (ended_at - started_at).round end |
#top_fingerprints_list ⇒ Array<Hash>
Returns top fingerprints by count, [] when absent/corrupt.
25 26 27 28 29 30 31 32 |
# File 'app/models/rails_error_dashboard/storm_event.rb', line 25 def top_fingerprints_list return [] if top_fingerprints.blank? parsed = JSON.parse(top_fingerprints) parsed.is_a?(Array) ? parsed : [] rescue JSON::ParserError [] end |