Sha256: d0813ddf61c5834a8762a6ebc2aef764e006343f42a447e7c56190f0a72b0ebd

Contents?: true

Size: 1.22 KB

Versions: 32

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Integrations
    # @api private
    module QuePlugin
      def _run(*args)
        transaction =
          Appsignal::Transaction.create(Appsignal::Transaction::BACKGROUND_JOB)

        begin
          Appsignal.instrument("perform_job.que") { super }
        rescue Exception => error # rubocop:disable Lint/RescueException
          transaction.set_error(error)
          raise error
        ensure
          local_attrs = respond_to?(:que_attrs) ? que_attrs : attrs
          transaction.set_action_if_nil("#{local_attrs[:job_class]}#run")
          transaction.add_params_if_nil do
            {
              :arguments => local_attrs[:args]
            }.tap do |hash|
              hash[:keyword_arguments] = local_attrs[:kwargs] if local_attrs.key?(:kwargs)
            end
          end
          transaction.add_tags(
            "id" => local_attrs[:job_id] || local_attrs[:id],
            "queue" => local_attrs[:queue],
            "run_at" => local_attrs[:run_at].to_s,
            "priority" => local_attrs[:priority],
            "attempts" => local_attrs[:error_count].to_i
          )
          Appsignal::Transaction.complete_current!
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

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