Sha256: b90517d54e64d090575fc876ae71dc4b61a86e75db3e79dfff96e867d54f16d5

Contents?: true

Size: 1.3 KB

Versions: 21

Compression:

Stored size: 1.3 KB

Contents

module Appsignal
  module Integrations
    module QuePlugin
      def self.included(base)
        base.class_eval do
          def _run_with_appsignal
            env = {
              :metadata    => {
                :id        => attrs[:job_id],
                :queue     => attrs[:queue],
                :run_at    => attrs[:run_at].to_s,
                :priority  => attrs[:priority],
                :attempts  => attrs[:error_count].to_i
              },
              :params => attrs[:args]
            }

            request = Appsignal::Transaction::GenericRequest.new(env)

            transaction = Appsignal::Transaction.create(
              SecureRandom.uuid,
              Appsignal::Transaction::BACKGROUND_JOB,
              request
            )

            begin
              Appsignal.instrument("perform_job.que") { _run_without_appsignal }
            rescue Exception => error # rubocop:disable Lint/RescueException
              transaction.set_error(error)
              raise error
            ensure
              transaction.set_action "#{attrs[:job_class]}#run"
              Appsignal::Transaction.complete_current!
            end
          end

          alias_method :_run_without_appsignal, :_run
          alias_method :_run, :_run_with_appsignal
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/integrations/que.rb
appsignal-2.5.3 lib/appsignal/integrations/que.rb
appsignal-2.5.3.alpha.2 lib/appsignal/integrations/que.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/integrations/que.rb
appsignal-2.5.3.alpha.1 lib/appsignal/integrations/que.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/integrations/que.rb
appsignal-2.5.2-java lib/appsignal/integrations/que.rb
appsignal-2.5.2 lib/appsignal/integrations/que.rb
appsignal-2.5.1-java lib/appsignal/integrations/que.rb
appsignal-2.5.1 lib/appsignal/integrations/que.rb
appsignal-2.5.1.beta.1-java lib/appsignal/integrations/que.rb
appsignal-2.5.1.beta.1 lib/appsignal/integrations/que.rb
appsignal-2.5.0-java lib/appsignal/integrations/que.rb
appsignal-2.5.0 lib/appsignal/integrations/que.rb
appsignal-2.5.0.beta.1-java lib/appsignal/integrations/que.rb
appsignal-2.5.0.beta.1 lib/appsignal/integrations/que.rb
appsignal-2.5.0.alpha.1-java lib/appsignal/integrations/que.rb
appsignal-2.5.0.alpha.1 lib/appsignal/integrations/que.rb
appsignal-2.4.3 lib/appsignal/integrations/que.rb
appsignal-2.4.2 lib/appsignal/integrations/que.rb