Method: APMInsight::API::CustomTracker::CustomMethodTracker#track_method
- Defined in:
- lib/agent/api/custom_tracker.rb
#track_method(method_name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/agent/api/custom_tracker.rb', line 13 def track_method(method_name) # Check whether the method exists return unless method_defined?(method_name) || private_method_defined?(method_name) # Check whether the method is already instrumented return if is_instrumented?(method_name) # Injecting code into the class class_eval(get_instrumentation_code(method_name), __FILE__, __LINE__) # Setting alias to invoke agent methods alias_method "original_#{method_name}", "#{method_name}" alias_method "#{method_name}", "apminsight_#{method_name}" # TODO: set visibility # visibility = instance_method_visibility(self, method_name) # send visibility, method_name # send visibility, "apminsight_#{method_name}" end |