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 A
extend NewRelic::Agent::MethodTracer
def self.process
...
end
class << self
add_method_tracer :process
end
end
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.extended(clazz) ⇒ Object
:nodoc:.
-
.included(clazz) ⇒ Object
:nodoc:.
Class Method Details
.extended(clazz) ⇒ Object
:nodoc:
42 43 44 45 |
# File 'lib/new_relic/agent/method_tracer.rb', line 42 def self.extended clazz #:nodoc: clazz.extend ClassMethods clazz.extend InstanceMethods end |
.included(clazz) ⇒ Object
:nodoc:
37 38 39 40 |
# File 'lib/new_relic/agent/method_tracer.rb', line 37 def self.included clazz #:nodoc: clazz.extend ClassMethods clazz.send :include, InstanceMethods end |