Sha256: b73c3f27fa8fe1bddf047f94677e0f931e3263fd0d515d923a8d3d12b111e233

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

# encoding: utf-8

PARAM_BLACKLIST = %w[backtrace error_backtrace error_message error_class]

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

        Rollbar.scope(scope).error(e, :use_exception_level_filters => true)
        raise
      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) }
      scope = { :request => { :params => params } }

      Rollbar.scope(scope).error(e, :use_exception_level_filters => true)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rollbar-1.4.3 lib/rollbar/sidekiq.rb