Method: OneApm::Support::MethodTracer#trace_execution_unscoped
- Defined in:
- lib/one_apm/support/method_tracer.rb
#trace_execution_unscoped(metric_names, options = {}) ⇒ Object
Trace a given block with stats assigned to the given metric_name. It does not provide scoped measurements, meaning whatever is being traced will not ‘blame the Controller’–that is to say appear in the breakdown chart. This is code is inlined in #add_method_tracer.
-
metric_namesis a single name or an array of names of metrics
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/one_apm/support/method_tracer.rb', line 79 def trace_execution_unscoped(metric_names, ={}) return yield unless OneApm::Manager.tl_is_execution_traced? t0 = Time.now begin yield ensure duration = (Time.now - t0).to_f # for some reason this is 3 usec faster than Time - Time OneApm::Manager.agent.stats_engine.tl_record_unscoped_metrics(metric_names, duration) end end |