16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/sentry/sidekiq/error_handler.rb', line 16
def call(ex, context, sidekiq_config = nil)
return unless Sentry.initialized?
context_filter = Sentry::Sidekiq::ContextFilter.new(context)
scope = Sentry.get_current_scope
scope.set_transaction_name(context_filter.transaction_name, source: :task) unless scope.transaction_name
if Sentry.configuration.sidekiq.report_after_job_retries && retryable?(context)
retry_count = context.dig(:job, "retry_count")
if retry_count.nil? || retry_count < retry_limit(context, sidekiq_config) - 1
return
end
end
Sentry::Sidekiq.capture_exception(
ex,
contexts: { sidekiq: context_filter.filtered },
hint: { background: false }
)
ensure
scope&.clear
end
|