Class: Rollbar::Sidekiq
- Inherits:
-
Object
- Object
- Rollbar::Sidekiq
- Defined in:
- lib/rollbar/plugins/sidekiq/plugin.rb
Defined Under Namespace
Classes: ClearScope
Constant Summary collapse
- PARAM_BLACKLIST =
%w[backtrace error_backtrace error_message error_class]
Class Method Summary collapse
- .handle_exception(ctx_hash, e) ⇒ Object
- .scrub_params(params) ⇒ Object
- .skip_report?(job_hash, e) ⇒ Boolean
Instance Method Summary collapse
Class Method Details
.handle_exception(ctx_hash, e) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rollbar/plugins/sidekiq/plugin.rb', line 15 def self.handle_exception(ctx_hash, e) job_hash = ctx_hash && (ctx_hash[:job] || ctx_hash) return if skip_report?(job_hash, e) scope = { :framework => "Sidekiq: #{::Sidekiq::VERSION}" } unless job_hash.nil? params = job_hash.reject { |k| PARAM_BLACKLIST.include?(k) } scope[:request] = { :params => scrub_params(params) } scope[:context] = params['class'] scope[:queue] = params['queue'] end Rollbar.scope(scope).error(e, :use_exception_level_filters => true) end |
.scrub_params(params) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/rollbar/plugins/sidekiq/plugin.rb', line 32 def self.scrub_params(params) = { :params => params, :config => Rollbar.configuration.scrub_fields } Rollbar::Scrubbers::Params.call() end |
.skip_report?(job_hash, e) ⇒ Boolean
41 42 43 44 |
# File 'lib/rollbar/plugins/sidekiq/plugin.rb', line 41 def self.skip_report?(job_hash, e) !job_hash.nil? && (job_hash['retry'] && job_hash['retry_count'] && job_hash['retry_count'] < ::Rollbar.configuration.sidekiq_threshold) end |
Instance Method Details
#call(worker, msg, queue) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/rollbar/plugins/sidekiq/plugin.rb', line 46 def call(worker, msg, queue) Rollbar.reset_notifier! yield rescue Exception => e Rollbar::Sidekiq.handle_exception(msg, e) raise end |