Class: Wurk::Sentry::DeathHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/wurk/sentry/death_handler.rb

Overview

Reports the deaths that never crossed the terminal-attempt path: a poison-pill kill (the reaper kills the job from outside, nothing raised) and a sidekiq_retry_in block answering :kill or :discard early.

A job that died the ordinary way was captured moments ago on this same thread, so that exception is skipped. An operator's kill carries no exception and is not a fault.

Instance Method Summary collapse

Instance Method Details

#call(job, exception = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wurk/sentry/death_handler.rb', line 16

def call(job, exception = nil)
  return unless exception && Wurk::Sentry.enabled?
  return if ErrorHandler.reported?(exception)

  job = {} unless job.is_a?(::Hash)
  ::Sentry.with_scope do |scope|
    JobContext.apply(scope, job, job['queue'])
    ::Sentry.capture_exception(exception, tags: { wurk_context: 'dead' })
  end
  ErrorHandler.reported!(exception)
end