class TingYun::Agent::TracedMethodStack
Public Class Methods
new()
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 17 def initialize @stack = [] end
Public Instance Methods
clear()
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 70 def clear @stack.clear end
empty?()
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 74 def empty? @stack.empty? end
fetch_matching_frame(expected_frame)
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 36 def fetch_matching_frame(expected_frame) while frame = @stack.pop if frame == expected_frame return frame else TingYun::Agent.logger.info("Unexpected frame in traced method stack: #{frame.inspect} expected to be #{expected_frame.inspect}") TingYun::Agent.logger.debug do ["Backtrace for unexpected frame: ", caller.join("\n")] end end end raise "Frame not found in blame stack: #{expected_frame.inspect}" end
note_children_time(frame, time, deduct_call_time_from_parent)
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 51 def note_children_time(frame, time, deduct_call_time_from_parent) if !@stack.empty? if deduct_call_time_from_parent @stack.last.children_time += (time - frame.start_time)*1000 else @stack.last.children_time += frame.children_time end end end
pop_frame(state, expected_frame, name, time, deduct_call_time_from_parent=true, klass_name=nil, error = nil)
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 28 def pop_frame(state, expected_frame, name, time, deduct_call_time_from_parent=true, klass_name=nil, error = nil) frame = fetch_matching_frame(expected_frame) note_children_time(frame, time, deduct_call_time_from_parent) transaction_sampler.notice_pop_frame(state, name, time, klass_name, error) if sampler_enabled? frame.name = name frame end
push_frame(state, tag, time = Time.now.to_f)
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 21 def push_frame(state, tag, time = Time.now.to_f) transaction_sampler.notice_push_frame(state, time) if sampler_enabled? frame = TracedMethodFrame.new(tag, time) @stack.push frame frame end
sampler_enabled?()
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 62 def sampler_enabled? TingYun::Agent.config[:'action_tracer.enabled'] end
transaction_sampler()
click to toggle source
# File lib/ting_yun/agent/transaction/traced_method_stack.rb, line 66 def transaction_sampler ::TingYun::Agent::Collector::TransactionSampler end