Sha256: 4cdb5d94f76a69a47392cd3e43b6d8f5761c316eb598cc1aaa04110024c1826f

Contents?: true

Size: 1.07 KB

Versions: 30

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Integrations
    # @api private
    module ResqueIntegration
      def perform
        transaction = Appsignal::Transaction.create(Appsignal::Transaction::BACKGROUND_JOB)

        Appsignal.instrument "perform.resque" do
          super
        end
      rescue Exception => exception # rubocop:disable Lint/RescueException
        transaction.set_error(exception)
        raise exception
      ensure
        if transaction
          transaction.set_action_if_nil("#{payload["class"]}#perform")
          transaction.add_params_if_nil { ResqueHelpers.arguments(payload) }
          transaction.add_tags("queue" => queue)

          Appsignal::Transaction.complete_current!
        end
        Appsignal.stop("resque")
      end
    end

    # @api private
    class ResqueHelpers
      def self.arguments(payload)
        case payload["class"]
        when "ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper"
          nil # Set in the ActiveJob integration
        else
          payload["args"]
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
appsignal-4.3.3-java lib/appsignal/integrations/resque.rb
appsignal-4.3.3 lib/appsignal/integrations/resque.rb
appsignal-4.3.2-java lib/appsignal/integrations/resque.rb
appsignal-4.3.2 lib/appsignal/integrations/resque.rb
appsignal-4.3.1-java lib/appsignal/integrations/resque.rb
appsignal-4.3.1 lib/appsignal/integrations/resque.rb
appsignal-4.3.0-java lib/appsignal/integrations/resque.rb
appsignal-4.3.0 lib/appsignal/integrations/resque.rb
appsignal-4.2.3-java lib/appsignal/integrations/resque.rb
appsignal-4.2.3 lib/appsignal/integrations/resque.rb
appsignal-4.2.2-java lib/appsignal/integrations/resque.rb
appsignal-4.2.2 lib/appsignal/integrations/resque.rb
appsignal-4.2.1-java lib/appsignal/integrations/resque.rb
appsignal-4.2.1 lib/appsignal/integrations/resque.rb
appsignal-4.2.0-java lib/appsignal/integrations/resque.rb
appsignal-4.2.0 lib/appsignal/integrations/resque.rb
appsignal-4.1.3-java lib/appsignal/integrations/resque.rb
appsignal-4.1.3 lib/appsignal/integrations/resque.rb
appsignal-4.1.2-java lib/appsignal/integrations/resque.rb
appsignal-4.1.2 lib/appsignal/integrations/resque.rb