Module: NewRelic::Agent::MethodTracer

Defined in:
lib/new_relic/agent/method_tracer.rb

Overview

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 'new_relic/agent/method_tracer'
class A
  include NewRelic::Agent::MethodTracer
  def process
    ...
  end
  add_method_tracer :process
end

To instrument a class method:

require 'new_relic/agent/method_tracer'
class An
  def self.process
    ...
  end
  class << self
    include NewRelic::Agent::MethodTracer
    add_method_tracer :process
  end
end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.extended(clazz) ⇒ Object

:nodoc:



43
44
45
46
# File 'lib/new_relic/agent/method_tracer.rb', line 43

def self.extended clazz #:nodoc:
  clazz.extend ClassMethods
  clazz.extend InstanceMethods
end

.included(clazz) ⇒ Object

:nodoc:



38
39
40
41
# File 'lib/new_relic/agent/method_tracer.rb', line 38

def self.included clazz #:nodoc:
  clazz.extend ClassMethods
  clazz.send :include, InstanceMethods
end