Module: Honeybadger::Plugins::ActiveJob Private

Defined in:
lib/honeybadger/plugins/active_job.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

EXCLUDED_ADAPTERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Ignore the adapters that we support with their own plugins

%i[delayed_job faktory karafka resque shoryuken sidekiq sucker_punch]

Class Method Summary collapse

Class Method Details

.context(job) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/MethodLength



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/honeybadger/plugins/active_job.rb', line 23

def context(job) # rubocop:disable Metrics/MethodLength
  {
    component: job.class,
    action: 'perform',
    enqueued_at: job.try(:enqueued_at),
    executions: job.executions,
    job_class: job.class,
    job_id: job.job_id,
    priority: job.priority,
    queue_name: job.queue_name,
    scheduled_at: job.scheduled_at
  }
end

.perform_around(job, block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/honeybadger/plugins/active_job.rb', line 10

def perform_around(job, block)
  Honeybadger.clear!
  context = context(job)
  block.call
rescue StandardError => e
  Honeybadger.notify(
    e,
    context: context,
    parameters: { arguments: job.arguments }
  ) if job.executions >= Honeybadger.config[:'active_job.attempt_threshold'].to_i
  raise e
end