Class: BugReportsClient::ReportErrorJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- BugReportsClient::ReportErrorJob
- Defined in:
- app/jobs/bug_reports_client/report_error_job.rb
Overview
Posts a captured error to the central API in the background, so the failing request is never slowed down (or broken further) by reporting. No retries: the API deduplicates by fingerprint and errors tend to recur, so a lost report costs little - a retry storm during an outage costs more.
Instance Method Summary collapse
Instance Method Details
#perform(attributes) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/jobs/bug_reports_client/report_error_job.rb', line 9 def perform(attributes) title = "[Error] #{attributes['exception_class']}: #{attributes['message']}".truncate(150) result = ApiClient.new.create_error_report( title: title, description: build_description(attributes), fingerprint: attributes["fingerprint"], occurred_at: attributes["occurred_at"] ) Rails.logger.warn "BugReportsClient: error report not accepted: #{result.}" unless result.success? end |