Add collapsible span tree rows#16
Open
goyalayus wants to merge 1 commit into
Open
Conversation
01d5eee to
1844237
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The trace span tree gets hard to use when one parent span contains a large nested subtree. This shows up pretty quickly in agent traces: a top-level phase may contain many LLM, tool, and internal spans, and today the viewer forces every descendant row to stay visible.
This PR adds a small collapse affordance so users can hide noisy subtrees while keeping the overall trace timeline readable.
What changed
+Ncount for hidden descendants.buildSpanTreeModel,getVisibleSpanRows,getAncestorIds) instead of pushing more branching into the render path.Why this shape
I kept the feature local to
SpanTreebecause this is a UI-only affordance: it does not change trace data, span ordering, annotations, or the timeline math. The helper functions make the collapse behavior easier to reason about and should leave room for future trace-tree features like expand-all, collapse-all, filtering, or search without turning the component into a pile of nested state logic.Verification
bun x eslint app/src/components/SpanTree.tsxcd app && bun x vite build