Module: Instrument::TraceRunner

Defined in:
lib/rack/bug/panels/speedtracer_panel/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#trace_run(context = "::", called_at = , args = []) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rack/bug/panels/speedtracer_panel/instrumentation.rb', line 55

def trace_run(context = "::", called_at=caller[1], args=[])
  tracer = Thread.current['st.tracer']
  result = nil
  if tracer.nil?
    Rails.logger.debug{"No tracer in thread - #{context} / #{called_at}"}
    result = yield
  else
    tracer.run(context, called_at, args){ result = yield }
  end
  result
end