Sha256: f4b97155b57e34046f3b5060da1b5228c043205dfee3e70d81e40ccfe3eb7251
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require 'sentry/sidekiq/context_filter' module Sentry module Sidekiq class ErrorHandler SIDEKIQ_NAME = "Sidekiq".freeze def call(ex, context) return unless Sentry.initialized? context = Sentry::Sidekiq::ContextFilter.new.filter_context(context) scope = Sentry.get_current_scope scope.set_transaction_name(transaction_from_context(context)) unless scope.transaction_name Sentry::Sidekiq.capture_exception( ex, extra: { sidekiq: context }, hint: { background: false } ) end private # this will change in the future: # https://github.com/mperham/sidekiq/pull/3161 def transaction_from_context(context) classname = (context["wrapped"] || context["class"] || (context[:job] && (context[:job]["wrapped"] || context[:job]["class"])) ) if classname "#{SIDEKIQ_NAME}/#{classname}" elsif context[:event] "#{SIDEKIQ_NAME}/#{context[:event]}" else SIDEKIQ_NAME end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sentry-sidekiq-4.1.3 | lib/sentry/sidekiq/error_handler.rb |
sentry-sidekiq-4.1.2 | lib/sentry/sidekiq/error_handler.rb |