Module: NewRelic::Agent::MethodTracer

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:



47
48
49
50
# File 'lib/new_relic/agent/method_tracer.rb', line 47

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

.included(clazz) ⇒ Object

:nodoc:



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

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