Sha256: bf850f1828c350ac850b80a13f0325bafcc38bb5cc73821270a0cc59a0c2383b
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
# encoding: utf-8 module Rollbar class Sidekiq PARAM_BLACKLIST = %w[backtrace error_backtrace error_message error_class] class ClearScope def call(worker, msg, queue) Rollbar.reset_notifier! yield end end def self.handle_exception(msg_or_context, e) return if skip_report?(msg_or_context, e) params = msg_or_context.reject{ |k| PARAM_BLACKLIST.include?(k) } scope = { :request => { :params => params } } Rollbar.scope(scope).error(e, :use_exception_level_filters => true) end def self.skip_report?(msg_or_context, e) msg_or_context.is_a?(Hash) && msg_or_context["retry"] && msg_or_context["retry_count"] && msg_or_context["retry_count"] < ::Rollbar.configuration.sidekiq_threshold end def call(worker, msg, queue) Rollbar.reset_notifier! yield rescue Exception => e Rollbar::Sidekiq.handle_exception(msg, e) raise end end end Sidekiq.configure_server do |config| if Sidekiq::VERSION.split('.')[0].to_i < 3 config.server_middleware do |chain| chain.add Rollbar::Sidekiq end else chain.add Rollbar::Sidekiq::ClearScope config.error_handlers << proc do |e, context| Rollbar::Sidekiq.handle_exception(context, e) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rollbar-2.9.0 | lib/rollbar/sidekiq.rb |