Class: RailsErrorDashboard::Subscribers::IssueTrackerSubscriber
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Subscribers::IssueTrackerSubscriber
- Defined in:
- lib/rails_error_dashboard/subscribers/issue_tracker_subscriber.rb
Overview
Hooks into the error lifecycle to trigger issue tracker jobs.
Called from the engine initializer via direct integration with the LogError and ResolveError commands’ callback mechanisms.
All work is done via background jobs — never blocks the capture path.
Class Method Summary collapse
-
.on_error_logged(error_log) ⇒ Object
Called when a new error is first logged.
-
.on_error_recurred(error_log) ⇒ Object
Called when an existing error occurs again.
-
.on_error_reopened(error_log) ⇒ Object
Called when a resolved error recurs (auto-reopened).
-
.on_error_resolved(error_log) ⇒ Object
Called when an error is resolved in the dashboard.
Class Method Details
.on_error_logged(error_log) ⇒ Object
Called when a new error is first logged
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails_error_dashboard/subscribers/issue_tracker_subscriber.rb', line 14 def on_error_logged(error_log) return unless should_auto_create?(error_log) # Always-on rate cap (default 5 per 10 min): a storm of NEW distinct # fingerprints must not open hundreds of issues. Checked LAST so a # token is only consumed when we were actually about to create. unless Services::StormProtection::Gate.issue_creation_allowed? RailsErrorDashboard::Logger.warn( "[RailsErrorDashboard] Auto-issue creation rate limit reached — " \ "skipping issue for ErrorLog ##{error_log.id} (#{error_log.error_type})" ) return end dashboard_url = Services::NotificationHelpers.dashboard_url(error_log) CreateIssueJob.perform_later(error_log.id, dashboard_url: dashboard_url) rescue => e nil end |
.on_error_recurred(error_log) ⇒ Object
Called when an existing error occurs again
44 45 46 47 48 49 50 |
# File 'lib/rails_error_dashboard/subscribers/issue_tracker_subscriber.rb', line 44 def on_error_recurred(error_log) return unless error_log.external_issue_url.present? return unless RailsErrorDashboard.configuration.enable_issue_tracking AddIssueRecurrenceCommentJob.perform_later(error_log.id) rescue => e nil end |
.on_error_reopened(error_log) ⇒ Object
Called when a resolved error recurs (auto-reopened)
35 36 37 38 39 40 41 |
# File 'lib/rails_error_dashboard/subscribers/issue_tracker_subscriber.rb', line 35 def on_error_reopened(error_log) return unless error_log.external_issue_url.present? return unless RailsErrorDashboard.configuration.enable_issue_tracking ReopenLinkedIssueJob.perform_later(error_log.id) rescue => e nil end |
.on_error_resolved(error_log) ⇒ Object
Called when an error is resolved in the dashboard
53 54 55 56 57 58 59 |
# File 'lib/rails_error_dashboard/subscribers/issue_tracker_subscriber.rb', line 53 def on_error_resolved(error_log) return unless error_log.external_issue_url.present? return unless RailsErrorDashboard.configuration.enable_issue_tracking CloseLinkedIssueJob.perform_later(error_log.id) rescue => e nil end |