class TingYun::Agent::TransactionSampleBuilder
Attributes
current_node[R]
trace[R]
Public Class Methods
new(time=Time.now.to_f)
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 31 def initialize(time=Time.now.to_f) @trace = TingYun::Agent::Transaction::Trace.new(time) @trace_start = time @current_node = @trace.root_node end
Public Instance Methods
finish_trace(time=Time.now.to_f)
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 86 def finish_trace(time=Time.now.to_f) if @trace.finished ::TingYun::Agent.logger.error "Unexpected double-finish_trace of Transaction Trace Object: \n#{@trace.to_s}" return end @trace.root_node.end_trace(time - @trace_start) @trace.threshold = transaction_trace_threshold @trace.finished = true @current_node = nil end
node_limit()
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 111 def node_limit Agent.config[:'transaction_tracer.limit_segments'] end
set_txId_and_txData(txid, txdata)
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 106 def set_txId_and_txData(txid, txdata) @current_node[:tx_id] = txid @current_node[:txData] = txdata end
trace_entry(time)
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 37 def trace_entry(time) # if @trace.node_count == 0 # node = @trace.create_node(time - @trace_start) # @trace.root_node = node # @current_node = node # return @current_node # end if @trace.node_count < node_limit node = @trace.create_node(time - @trace_start) @current_node.add_called_node(node) @current_node = node if @trace.node_count == node_limit ::TingYun::Agent.logger.debug("Node limit of #{node_limit} reached, ceasing collection.") end else if @current_node.is_a?(PlaceholderNode) @current_node.depth += 1 else @current_node = PlaceholderNode.new(@current_node) end end @current_node end
trace_exit(metric_name, time, klass_name, error = nil)
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 62 def trace_exit(metric_name, time, klass_name, error = nil) if @current_node.is_a?(PlaceholderNode) @current_node.depth -= 1 if @current_node.depth == 0 @current_node = @current_node.parent_node end else @current_node.metric_name = metric_name @current_node.klass = klass_name @current_node.end_trace(time - @trace_start) @current_node = @current_node.parent_node end if error unless trace.e_set.member? error.object_id trace.e_set.add error.object_id @current_node.exception << {"msg" => error.message, "name" => error.class.to_s, "stack"=> error.backtrace, "error"=> false } end end end
transaction_trace_threshold()
click to toggle source
# File lib/ting_yun/agent/transaction/transaction_sample_builder.rb, line 101 def transaction_trace_threshold Agent.config[:'action_tracer.action_threshold'] end