Sha256: 473c3270876230b43aea9fc0e6c7769a2c97dd4f547baf34335b660ce129684c
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
# encoding: utf-8 require 'ting_yun/agent/transaction/trace' module TingYun module Agent class TransactionSampleBuilder attr_reader :current_node, :trace def initialize(time=Time.now) @trace = TingYun::Agent::Transaction::Trace.new(time.to_f) @trace_start = time.to_f @current_node = @trace.root_node end def trace_entry(time) if @trace.node_count < node_limit node = @trace.create_node(time.to_f - @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 end @current_node end def trace_exit(metric_name, time) @current_node.metric_name = metric_name @current_node.end_trace(time.to_f - @trace_start) @current_node = @current_node.parent_node end 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 def transaction_trace_threshold Agent.config[:'nbs.action_tracer.action_threshold'] end def node_limit Agent.config[:'transaction_tracer.limit_segments'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tingyun_rpm-1.0.7 | lib/ting_yun/agent/transaction/transaction_sample_builder.rb |
tingyun_rpm-1.0.6 | lib/ting_yun/agent/transaction/transaction_sample_builder.rb |