Class: StackifyRubyAPM::Spies::SuckerPunchSpy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/stackify_apm/spies/sucker_punch.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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