Sha256: 77f2f13f7d979597210b4aee762c8580cd8228aec05223a21c9a6ff8fd34e70c

Contents?: true

Size: 802 Bytes

Versions: 12

Compression:

Stored size: 802 Bytes

Contents

# encoding: utf-8

PARAM_BLACKLIST = ['backtrace', 'error_backtrace', 'error_message', 'error_class']

if Sidekiq::VERSION < '3'
  module Rollbar
    class Sidekiq
      def call(worker, msg, queue)
        begin
          yield
        rescue Exception => e
          params = msg.reject{ |k| PARAM_BLACKLIST.include?(k) }

          Rollbar.report_exception(e, :params => params)
          raise
        end
      end
    end
  end

  Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add Rollbar::Sidekiq
    end
  end
else
  Sidekiq.configure_server do |config|
    config.error_handlers << Proc.new do |e, context|
      params = context.reject{ |k| PARAM_BLACKLIST.include?(k) }
      
      Rollbar.report_exception(e, :params => params)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rollbar-1.2.7 lib/rollbar/sidekiq.rb
rollbar-1.2.6 lib/rollbar/sidekiq.rb
rollbar-1.2.5 lib/rollbar/sidekiq.rb
rollbar-1.2.4 lib/rollbar/sidekiq.rb
rollbar-1.2.3 lib/rollbar/sidekiq.rb
rollbar-1.2.2 lib/rollbar/sidekiq.rb
rollbar-1.2.1 lib/rollbar/sidekiq.rb
rollbar-1.2.0 lib/rollbar/sidekiq.rb
rollbar-1.1.0 lib/rollbar/sidekiq.rb
rollbar-1.0.1 lib/rollbar/sidekiq.rb
rollbar-1.0.0 lib/rollbar/sidekiq.rb
rollbar-0.13.2 lib/rollbar/sidekiq.rb