Class: Bugsnag::Shoryuken

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/integrations/shoryuken.rb

Overview

Extracts and attaches Shoryuken queue information to an error report

Constant Summary collapse

FRAMEWORK_ATTRIBUTES =
{
  :framework => "Shoryuken"
}

Instance Method Summary collapse

Constructor Details

#initializeShoryuken

Returns a new instance of Shoryuken.



12
13
14
15
16
17
18
# File 'lib/bugsnag/integrations/shoryuken.rb', line 12

def initialize
  Bugsnag.configure do |config|
    config.detected_app_type = "shoryuken"
    config.default_delivery_method = :synchronous
    config.runtime_versions["shoryuken"] = ::Shoryuken::VERSION
  end
end

Instance Method Details

#call(_, queue, _, body) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bugsnag/integrations/shoryuken.rb', line 20

def call(_, queue, _, body)
  begin
    Bugsnag.before_notify_callbacks << lambda {|report|
      report.add_tab(:shoryuken, {
        queue: queue,
        body: body
      })
    }

    yield
  rescue Exception => ex
    Bugsnag.notify(ex, true) do |report|
      report.severity = "error"
      report.severity_reason = {
        :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
        :attributes => Bugsnag::Shoryuken::FRAMEWORK_ATTRIBUTES
      }
    end
    raise
  ensure
    Bugsnag.configuration.clear_request_data
  end
end