pub fn build_trace_spans(records: Vec<TraceSpanRecord>) -> Vec<TraceSpan>Expand description
Convert a flat list of TraceSpanRecords into a tree-enriched list of TraceSpans.
Groups records by trace_id, performs DFS to compute depth, path,
root_span_id, and span_order for each span.