class StackifyRubyAPM::Spies::SuckerPunchSpy

@api private

Public Instance Methods

__run_perform(*args) click to toggle source
# File lib/stackify_apm/spies/sucker_punch.rb, line 15
def __run_perform(*args)
  ret = nil
  begin
    name = "#{to_s}.perform"
    ctx = StackifyRubyAPM::Context.new
    ctx.category = 'SuckerPunch::Job'
    transaction = StackifyRubyAPM.transaction name, 'TASK', context: ctx
    ret = __run_perform_without_elastic_apm(*args)
  rescue StackifyRubyAPM::InternalError
    raise # Don't report StackifyRubyAPM errors
  rescue StandardError => e
    StackifyRubyAPM.report e
    raise e
  ensure
    transaction.submit()
  end
  ret
end
install() click to toggle source
# File lib/stackify_apm/spies/sucker_punch.rb, line 11
def install
  SuckerPunch::Job::ClassMethods.class_eval do
    alias_method '__run_perform_without_elastic_apm', '__run_perform'

    def __run_perform(*args)
      ret = nil
      begin
        name = "#{to_s}.perform"
        ctx = StackifyRubyAPM::Context.new
        ctx.category = 'SuckerPunch::Job'
        transaction = StackifyRubyAPM.transaction name, 'TASK', context: ctx
        ret = __run_perform_without_elastic_apm(*args)
      rescue StackifyRubyAPM::InternalError
        raise # Don't report StackifyRubyAPM errors
      rescue StandardError => e
        StackifyRubyAPM.report e
        raise e
      ensure
        transaction.submit()
      end
      ret
    end
  end
end