Class: Bugsnag::Middleware::Sidekiq

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/middleware/sidekiq.rb

Overview

Attaches Sidekiq job information to an error report

Instance Method Summary collapse

Constructor Details

#initialize(bugsnag) ⇒ Sidekiq

Returns a new instance of Sidekiq.


5
6
7
# File 'lib/bugsnag/middleware/sidekiq.rb', line 5

def initialize(bugsnag)
  @bugsnag = bugsnag
end

Instance Method Details

#call(report) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/bugsnag/middleware/sidekiq.rb', line 9

def call(report)
  sidekiq = report.request_data[:sidekiq]
  if sidekiq
    report.add_tab(:sidekiq, sidekiq)
    report.automatic_context ||= "#{sidekiq[:msg]['wrapped'] || sidekiq[:msg]['class']}@#{sidekiq[:msg]['queue']}"
  end
  @bugsnag.call(report)
end