Sha256: be28304f01a1410d2462f717485df3e51cecdbe531be29e2d21b660e87379909
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
module Honeybadger module Plugins module ActiveJob # Ignore inline and test adapters, as well as the adapters that we support with their own plugins EXCLUDED_ADAPTERS = %i[inline test delayed_job faktory karafka resque shoryuken sidekiq sucker_punch].freeze class << self def perform_around(job, block) Honeybadger.clear! context = context(job) block.call rescue StandardError => e Honeybadger.notify(e, context: context, parameters: { arguments: job.arguments }) raise e end 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 end Plugin.register do requirement do defined?(::Rails.application) && ::Rails.application.config.respond_to?(:active_job) && !EXCLUDED_ADAPTERS.include?(::Rails.application.config.active_job[:queue_adapter]) end execution do ::ActiveJob::Base.set_callback(:perform, :around, &ActiveJob.method(:perform_around)) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
honeybadger-5.7.0 | lib/honeybadger/plugins/active_job.rb |