Sha256: 15bbd1c54dfa713fdab57a52c20c48ad9c62b50cb3d21bc3c4d03abfdfbe0364

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

module Honeybadger
  module Integrations
    module DelayedJob
      class Plugin < ::Delayed::Plugin
        callbacks do |lifecycle|
          lifecycle.around(:invoke_job) do |job, &block|
            begin
              if defined?(::Honeybadger::Monitor)
                ::Honeybadger::Monitor::Trace.instrument("#{job.payload_object.class}#perform", { :source => 'delayed_job', :jid => job.id, :class => job.payload_object.class.name }) do
                  block.call(job)
                end
              else
                block.call(job)
              end
            rescue Exception => error
              ::Honeybadger.notify_or_ignore(
                :error_class   => error.class.name,
                :error_message => "#{ error.class.name }: #{ error.message }",
                :backtrace     => error.backtrace,
                  :context       => {
                  :job_id        => job.id,
                  :handler       => job.handler,
                  :last_error    => job.last_error,
                  :attempts      => job.attempts,
                  :queue         => job.queue
                }
              )
              raise error
            ensure
              ::Honeybadger.context.clear!
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
honeybadger-1.16.4 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.16.3 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.16.2 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.16.1 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.16.0 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.15.3 lib/honeybadger/integrations/delayed_job/plugin.rb