Sha256: 480221d3ef21faa038e86e0795e2bca3089dfe7459ade921cc4a234c188791a9

Contents?: true

Size: 1.22 KB

Versions: 22

Compression:

Stored size: 1.22 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")
          args =
            Appsignal::Utils::HashSanitizer.sanitize(
              ResqueHelpers.arguments(payload),
              Appsignal.config[:filter_parameters]
            )
          transaction.set_params_if_nil(args)
          transaction.set_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

22 entries across 22 versions & 1 rubygems

Version Path
appsignal-3.13.1-java lib/appsignal/integrations/resque.rb
appsignal-3.13.1 lib/appsignal/integrations/resque.rb
appsignal-3.13.1.alpha.1-java lib/appsignal/integrations/resque.rb
appsignal-3.13.1.alpha.1 lib/appsignal/integrations/resque.rb
appsignal-3.13.0-java lib/appsignal/integrations/resque.rb
appsignal-3.13.0 lib/appsignal/integrations/resque.rb
appsignal-3.12.6-java lib/appsignal/integrations/resque.rb
appsignal-3.12.6 lib/appsignal/integrations/resque.rb
appsignal-3.12.5-java lib/appsignal/integrations/resque.rb
appsignal-3.12.5 lib/appsignal/integrations/resque.rb
appsignal-3.12.4-java lib/appsignal/integrations/resque.rb
appsignal-3.12.4 lib/appsignal/integrations/resque.rb
appsignal-3.12.3-java lib/appsignal/integrations/resque.rb
appsignal-3.12.3 lib/appsignal/integrations/resque.rb
appsignal-3.12.2-java lib/appsignal/integrations/resque.rb
appsignal-3.12.2 lib/appsignal/integrations/resque.rb
appsignal-3.12.1-java lib/appsignal/integrations/resque.rb
appsignal-3.12.1 lib/appsignal/integrations/resque.rb
appsignal-3.12.0-java lib/appsignal/integrations/resque.rb
appsignal-3.12.0 lib/appsignal/integrations/resque.rb