Module: TingYun::Instrumentation::Support::MethodInstrumentation

Defined in:
lib/ting_yun/instrumentation/support/method_instrumentation.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



50
51
52
# File 'lib/ting_yun/instrumentation/support/method_instrumentation.rb', line 50

def self.extended(klass)
  klass.extend ClassMethods
end

.included(klass) ⇒ Object

This module contains class methods added to support installing custom metric tracers and executing for individual metrics.

Examples

When the agent initializes, it extends Module with these methods. However if you want to use the API in code that might get loaded before the agent is initialized you will need to require this file:

require 'ting_yun/instrumentation/support/method_instrumentation'
class A
  include TingYun::Instrumentation::Support::MethodInstrumentation
  def process
    ...
  end
  add_method_tracer :process
end

To instrument a class method:

 require 'ting_yun/instrumentation/support/method_instrumentation'
class An
  def self.process
    ...
  end
  class << self
    include TingYun::Instrumentation::Support::MethodInstrumentation
    add_method_tracer :process
  end
end


46
47
48
# File 'lib/ting_yun/instrumentation/support/method_instrumentation.rb', line 46

def self.included(klass)
  klass.extend ClassMethods
end