Sha256: 03912eca52886ca981b2f7962ab9cf488c03ed2b1cc387571baf4a8a8ae4b474

Contents?: true

Size: 838 Bytes

Versions: 44

Compression:

Stored size: 838 Bytes

Contents

module Resque
  module Failure
    # Provides Resque integration with Airbrake.
    #
    # @since v5.0.0
    # @see https://github.com/resque/resque/wiki/Failure-Backends
    class Airbrake < Base
      def save
        ::Airbrake.notify_sync(exception, payload) do |notice|
          notice[:context][:component] = 'resque'
          notice[:context][:action] = action(payload)
        end
      end

      private

      # @return [String] job's name. When ActiveJob is present, retrieve
      #   job_class. When used directly, use worker's name
      def action(payload)
        active_job_args = payload['args'].first if payload['args']
        if active_job_args.is_a?(Hash) && active_job_args['job_class']
          active_job_args['job_class']
        else
          payload['class'].to_s
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
airbrake-9.5.5 lib/airbrake/resque.rb
airbrake-9.5.4 lib/airbrake/resque.rb
airbrake-9.5.3 lib/airbrake/resque.rb
airbrake-9.5.2 lib/airbrake/resque.rb
airbrake-9.5.1 lib/airbrake/resque.rb
airbrake-9.5.0 lib/airbrake/resque.rb
airbrake-9.4.5 lib/airbrake/resque.rb
airbrake-9.4.4 lib/airbrake/resque.rb
airbrake-9.4.3 lib/airbrake/resque.rb
airbrake-9.4.2 lib/airbrake/resque.rb
airbrake-9.4.1 lib/airbrake/resque.rb
airbrake-9.4.0 lib/airbrake/resque.rb
airbrake-9.3.0 lib/airbrake/resque.rb
airbrake-9.2.2 lib/airbrake/resque.rb
airbrake-9.2.1 lib/airbrake/resque.rb
airbrake-9.2.0 lib/airbrake/resque.rb
airbrake-9.1.0 lib/airbrake/resque.rb
airbrake-9.0.2 lib/airbrake/resque.rb
airbrake-9.0.1 lib/airbrake/resque.rb
airbrake-9.0.0 lib/airbrake/resque.rb