Module: NewRelic::Agent::Transaction::TraceBuilder

Extended by:
TraceBuilder
Included in:
TraceBuilder
Defined in:
lib/new_relic/agent/transaction/trace_builder.rb

Instance Method Summary collapse

Instance Method Details

#build_trace(transaction) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/new_relic/agent/transaction/trace_builder.rb', line 15

def build_trace(transaction)
  trace = Trace.new(transaction.start_time)
  trace.root_node.exit_timestamp = transaction.end_time - transaction.start_time
  copy_attributes(transaction, trace)
  first, *rest = transaction.segments
  relationship_map = rest.group_by { |s| s.parent }
  trace.root_node.children << process_segments(transaction, first, trace.root_node, relationship_map)
  trace
end