Module: TingYun::Agent::MethodTracer
- Defined in:
- lib/ting_yun/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 'ting_yun/agent/method_tracer'
class A
include TingYun::Agent::MethodTracer
def process
...
end
add_method_tracer :process
end
To instrument a class method:
require 'ting_yun/agent/method_tracer'
class An
def self.process
...
end
class << self
include TingYun::Agent::MethodTracer
add_method_tracer :process
end
end
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .extended(klass) ⇒ Object
- .included(klass) ⇒ Object
-
.trace_execution_scoped(metric_names, options = {}, callback = nil) ⇒ Object
THREAD_LOCAL_ACCESS.
Class Method Details
.extended(klass) ⇒ Object
53 54 55 |
# File 'lib/ting_yun/agent/method_tracer.rb', line 53 def self.extended klass klass.extend ClassMethods end |
.included(klass) ⇒ Object
49 50 51 |
# File 'lib/ting_yun/agent/method_tracer.rb', line 49 def self.included klass klass.extend ClassMethods end |
.trace_execution_scoped(metric_names, options = {}, callback = nil) ⇒ Object
THREAD_LOCAL_ACCESS
58 59 60 61 62 63 |
# File 'lib/ting_yun/agent/method_tracer.rb', line 58 def self.trace_execution_scoped(metric_names, ={}, callback = nil) #THREAD_LOCAL_ACCESS TingYun::Agent::MethodTracerHelpers.trace_execution_scoped(metric_names, , callback) do # Using an implicit block avoids object allocation for a &block param yield end end |