Sha256: 91c357b168028511db16816d23d48d7623e6c90cdbbb6a46bec1dfbde085363c
Contents?: true
Size: 1021 Bytes
Versions: 5
Compression:
Stored size: 1021 Bytes
Contents
require 'sentry/sidekiq/context_filter' module Sentry module Sidekiq class ErrorHandler SIDEKIQ_NAME = "Sidekiq".freeze def call(ex, context) context = Sentry::Sidekiq::ContextFilter.new.filter_context(context) Sentry.with_scope do |scope| scope.set_transaction_name transaction_from_context(context) Sentry.capture_exception( ex, extra: { sidekiq: context } ) end 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
5 entries across 5 versions & 1 rubygems