Method: APMInsight::API::CustomTracker::CustomMethodTracker#get_instrumentation_code

Defined in:
lib/agent/api/custom_tracker.rb

#get_instrumentation_code(method_name) ⇒ Object

TODO: Capture exception, attach tracker TODO: Create agent handler and call respective methods like in java agent



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/agent/api/custom_tracker.rb', line 42

def get_instrumentation_code(method_name)
  "def apminsight_#{method_name}(*args, &block)
      tracker = ::APMInsight::API::CustomAPIHandler.invokeTracker \"\#{self.class.name}.#{method_name}\"
      begin
        original_#{method_name}(*args, &block)
      rescue Exception=>e
        if tracker != nil
          tracker.setError e
        end
        raise e
      ensure
        ::APMInsight::API::CustomAPIHandler.exitTracker tracker
      end
  end"
end