Module: ErrorRadar::Integrations::Sidekiq
- Defined in:
- lib/error_radar/integrations/sidekiq.rb
Overview
Hooks ErrorRadar.capture into Sidekiq’s server-side error handler so every background-job failure becomes an ErrorLog task. Idempotent.
Constant Summary collapse
- HANDLER =
lambda do |exception, ctx, _config = nil| job = (ctx && ctx[:job]) || {} ErrorRadar.capture( exception, source: job['class'] || (ctx && ctx[:context]) || 'Sidekiq', context: { jid: job['jid'], queue: job['queue'], args: job['args'], retry_count: job['retry_count'], failed_at: job['failed_at'] }.compact ) rescue StandardError => e ErrorRadar::Tracking.warn_internal("Sidekiq error_handler failed: #{e.class}: #{e.}") end
Class Method Summary collapse
Class Method Details
.install! ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/error_radar/integrations/sidekiq.rb', line 25 def self.install! ::Sidekiq.configure_server do |config| handlers = config.error_handlers handlers << HANDLER unless handlers.include?(HANDLER) end rescue StandardError => e ErrorRadar::Tracking.warn_internal("Sidekiq integration failed: #{e.class}: #{e.}") end |