Class: Nadir::Sidekiq

Inherits:
Object
  • Object
show all
Defined in:
lib/nadir/plugins/sidekiq.rb

Class Method Summary collapse

Class Method Details

.notify(exception, context) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nadir/plugins/sidekiq.rb', line 3

def self.notify(exception, context)
  if context[:job]['class'] == 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper'
    job_params = {
      class: context[:job]['args'].first['job_class'],
      args: context[:job]['args'].first['arguments'],
      queue: context[:job]['args'].first['queue_name'],
      job_id: context[:job]['args'].first['job_id'],
      retry_count: context[:job]['retry_count'],
      jid: context[:job]['jid'],
    }
    location = job_params[:class]
  else
    job_params = context[:job].slice('class', 'args', 'retry_count', 'queue', 'jid')
    location = job_params['class']
  end

  Nadir.notify exception, job: job_params, location: location
end