Construct a tree directly from precomputed lookup maps.
Most callers should use TraceTree.build instead. The public constructor exists so trees can be assembled in tests or by callers that already have the indexed structure.
ReadonlychildrenparentSpanId → ordered list of child spans.
ReadonlyrootsSpans with no resolvable parent, sorted by start time.
ReadonlyservicespanId → owning service name.
Walk the tree depth-first and return one FlatSpan per span.
Order matches the visual top-to-bottom order of the waterfall: each root is visited followed by all of its descendants (also depth-first) before moving on to the next root.
The complete list of spans annotated with depth and service name.
Compute the bounding time range across every span in the tree.
Both bounds are returned in milliseconds since the Unix epoch,
suitable for Date construction and pixel-offset math. An empty
tree returns { min: 0, max: 0 }.
The earliest start and latest end timestamp in the tree.
StaticbuildIndex a flat TraceData payload into a parent-child tree.
Spans whose parentSpanId does not resolve to a known span in the
payload are treated as roots, so dangling references do not silently
disappear. Children at every level are sorted by startTimeUnixNano
to keep timeline ordering stable.
OTel-shaped trace data, typically produced by
transformLogs (from transform.ts) or fetched from a backend.
A new TraceTree. Safe to call repeatedly on the same input.
Tree structure for organizing raw OTel Spans for visualization. Spans are kept as-is; relationships and metadata are stored in lookup maps.