Sha256: 185371f257f088033add291ad577e14623f280ecbc7ec9bb8a5794af500fa948

Contents?: true

Size: 1.3 KB

Versions: 184

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Integrations
    # @api private
    module ResqueIntegration
      def perform
        transaction = Appsignal::Transaction.create(
          SecureRandom.uuid,
          Appsignal::Transaction::BACKGROUND_JOB,
          Appsignal::Transaction::GenericRequest.new({})
        )

        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.params = args if args
          transaction.set_tags("queue" => queue)

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

    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

184 entries across 184 versions & 1 rubygems

Version Path
appsignal-3.9.1-java lib/appsignal/integrations/resque.rb
appsignal-3.9.1 lib/appsignal/integrations/resque.rb
appsignal-3.9.0-java lib/appsignal/integrations/resque.rb
appsignal-3.9.0 lib/appsignal/integrations/resque.rb
appsignal-3.8.1-java lib/appsignal/integrations/resque.rb
appsignal-3.8.1 lib/appsignal/integrations/resque.rb
appsignal-3.8.0-java lib/appsignal/integrations/resque.rb
appsignal-3.8.0 lib/appsignal/integrations/resque.rb
appsignal-3.7.6-java lib/appsignal/integrations/resque.rb
appsignal-3.7.6 lib/appsignal/integrations/resque.rb
appsignal-3.7.2-java lib/appsignal/integrations/resque.rb
appsignal-3.7.2 lib/appsignal/integrations/resque.rb
appsignal-3.7.1-java lib/appsignal/integrations/resque.rb
appsignal-3.7.1 lib/appsignal/integrations/resque.rb
appsignal-3.7.0-java lib/appsignal/integrations/resque.rb
appsignal-3.7.0 lib/appsignal/integrations/resque.rb
appsignal-3.6.5-java lib/appsignal/integrations/resque.rb
appsignal-3.6.5 lib/appsignal/integrations/resque.rb
appsignal-3.6.4-java lib/appsignal/integrations/resque.rb
appsignal-3.6.4 lib/appsignal/integrations/resque.rb