Sha256: e439330e13a0e862e541ce5d1ca12f4e8646674d6e010aec70bb3784ec8623a3

Contents?: true

Size: 853 Bytes

Versions: 17

Compression:

Stored size: 853 Bytes

Contents

require 'sidekiq'

module Bugsnag
  class Sidekiq
    def call(worker, msg, queue)
      begin
        Bugsnag.before_notify_callbacks << lambda {|notif|
          notif.add_tab(:sidekiq, msg)
          notif.context ||= "sidekiq##{queue}"
        }

        yield
      rescue Exception => ex
        raise ex if [Interrupt, SystemExit, SignalException].include? ex.class
        Bugsnag.auto_notify(ex)
        raise
      ensure
        Bugsnag.clear_request_data
      end
    end
  end
end

if ::Sidekiq::VERSION < '3'
  ::Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add ::Bugsnag::Sidekiq
    end
  end
else
  ::Sidekiq.configure_server do |config|
    config.error_handlers << lambda do |ex, ctx|
      Bugsnag.auto_notify(ex, :sidekiq => ctx, :context => "sidekiq##{ctx['queue']}")
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bugsnag-2.7.1 lib/bugsnag/sidekiq.rb
bugsnag-2.7.0 lib/bugsnag/sidekiq.rb
bugsnag-2.6.1 lib/bugsnag/sidekiq.rb
bugsnag-2.6.0 lib/bugsnag/sidekiq.rb
bugsnag-2.5.1 lib/bugsnag/sidekiq.rb
bugsnag-2.5.0 lib/bugsnag/sidekiq.rb
bugsnag-2.4.1 lib/bugsnag/sidekiq.rb
bugsnag-2.4.0 lib/bugsnag/sidekiq.rb
bugsnag-2.3.0 lib/bugsnag/sidekiq.rb
bugsnag-2.2.2 lib/bugsnag/sidekiq.rb
bugsnag-2.2.1 lib/bugsnag/sidekiq.rb
bugsnag-2.2.0 lib/bugsnag/sidekiq.rb
bugsnag-2.1.0 lib/bugsnag/sidekiq.rb
bugsnag-2.0.3 lib/bugsnag/sidekiq.rb
bugsnag-2.0.2 lib/bugsnag/sidekiq.rb
bugsnag-2.0.1 lib/bugsnag/sidekiq.rb
bugsnag-2.0.0 lib/bugsnag/sidekiq.rb