feat: trace waterfall redesign#2565
Conversation
🦋 Changeset detectedLatest commit: ff6e4de The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Greptile SummaryThis PR redesigns the trace waterfall chart with per-service span colors, a vertical service color bar in the label column, depth controls (expand/collapse one level and all), and moves the correlated-logs source selector into the waterfall controls bar. It also introduces a filter-fallback mechanism so a bad filter expression never blanks the chart — the offending query falls back to unfiltered data and surfaces an inline error instead.
Confidence Score: 5/5Safe to merge — the filter-fallback mechanism and language-persistence changes are well-tested, and all edge cases in the depth-control helpers are covered by unit tests. The waterfall redesign touches several interlocking pieces (color mapping, depth controls, language-aware filter queries, fallback error handling) but each is cleanly isolated and tested. The useFilteredEventsAroundFocus fallback pattern correctly follows React hook rules, the color-mix highlight approach works with fully resolved hex values from getChartColorError(), and the two previous thread concerns are both addressed in this PR. No files require special attention — the new useFilteredEventsAroundFocus wrapper and the useWaterfallSearchState language persistence are the most behaviorally significant changes and both look correct. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[useFilteredEventsAroundFocus] --> B[useEventsAroundFocus - filtered query]
B --> C{filterFailed?\nenabled && hiddenExpr && error}
C -- No --> D[return filtered rows + fatalError]
C -- Yes --> E[useEventsAroundFocus - fallback, no filter]
E --> F{fallback also errored?}
F -- No --> G[return fallback rows + filterError]
F -- Yes --> H[return empty rows + fatalError]
D --> I[DBTraceWaterfallChartContainer]
G --> I
H --> I
I --> J{traceError / fatalError?}
J -- Yes --> K[Show full-chart error block]
J -- No --> L[Render TimelineChart]
L --> M[traceFilterError? Show inline error]
L --> N[logError? Show inline error]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[useFilteredEventsAroundFocus] --> B[useEventsAroundFocus - filtered query]
B --> C{filterFailed?\nenabled && hiddenExpr && error}
C -- No --> D[return filtered rows + fatalError]
C -- Yes --> E[useEventsAroundFocus - fallback, no filter]
E --> F{fallback also errored?}
F -- No --> G[return fallback rows + filterError]
F -- Yes --> H[return empty rows + fatalError]
D --> I[DBTraceWaterfallChartContainer]
G --> I
H --> I
I --> J{traceError / fatalError?}
J -- Yes --> K[Show full-chart error block]
J -- No --> L[Render TimelineChart]
L --> M[traceFilterError? Show inline error]
L --> N[logError? Show inline error]
Reviews (11): Last reviewed commit: "Merge branch 'main' into hdx-3945-3952-t..." | Re-trigger Greptile |
E2E Test Results✅ All tests passed • 227 passed • 3 skipped • 1524s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. No P0/P1 ship-blockers: the trace-id 🟡 P2 — recommended
🔵 P3 nitpicks (7)
Reviewers (10): correctness, adversarial, kieran-typescript, julik-frontend-races, testing, maintainability, performance, project-standards, agent-native, learnings-researcher. Testing gaps:
Note: Performance confirmed the un-memoized per-render O(n) scans ( |
141473a to
c185d3f
Compare
c185d3f to
8953644
Compare
8953644 to
c8a287b
Compare
Thanks for taking a look @elizabetdev! Both of those points should already be addressed in #2541 The changes here are focused mostly on the waterfall/timeline. |
eb9103a to
c57c581
Compare
|
@karl-power the P0 is a legit issue with the combined filters approach
Before: separate log/trace filter, no issue Combined, if you search for something like SpanName='whatever', you will get this error as |
|
This PR currently has a merge conflict. Please resolve this and then re-add the |
Prefer the URL's whereLanguage param when seeding the filter language toggle so a shared link / reload shows the same language the query runs in, and reset the toggle on clear so a stale value isn't re-serialized into the URL on the next submit. Also drop the now-unused getChartColorErrorHighlight / getChartColorWarningHighlight exports.
c57c581 to
cf3689a
Compare
Thanks, I missed this. I just updated it now to split the combined filter into separate spans and logs inputs. A failing filter falls back to unfiltered results with the error surfaced inline next to its input. |
4849b87 to
5107605
Compare
|
@karl-power slick :) |
## Summary Redesigns the trace waterfall chart and cleans up the surrounding trace panel layout. ### Waterfall redesign (HDX-3945) - **Per-service colors**: each service gets a stable color (sorted for render-order stability). Green is reserved for correlated log rows and red for error spans, so a service color is never confused with a log or error. - **Bar & label layout**: no text inside bars — the operation/service label sits beside a vertical service color bar, with the span duration shown as muted text and the span body revealed on hover, placed on whichever side has more room. - **Depth controls**: expand/collapse one level and expand/collapse all, only shown when the trace has collapsible nodes. ### Trace panel layout (HDX-3952) - Removed the duplicated Trace ID from the panel body (it lives in the side panel header). The Trace ID Expression editor now only appears as a fallback when no trace id resolves for the event. - Moved the Correlated Logs source selector into the waterfall controls bar as a compact selector. ### Collapse hint bug (HDX-4444) - Removed the flaky tooltip-based Alt+click collapse hint (`CollapseTooltipLabel` / `useDisclosure`) that could render multiple times when chevrons were highlighted in quick succession. Collapse is now an always-present chevron control. ### Supporting changes - `useWaterfallSearchState` now persists the filter language (`whereLanguage`) in the URL so shared links / reloads rebuild the query in the language it was written in. - `SearchWhereInput` accepts a `parentRef` for popover positioning. ## Testing - Added `DBTraceWaterfallChart.test.tsx` covering the depth-control logic. - Updated `DBTracePanel.test.tsx` for the new layout. ### Screenshots or video <img width="1685" height="1011" alt="Screenshot 2026-07-01 at 17 12 42" src="https://github.com/user-attachments/assets/a626f16b-60c0-4864-adc3-900e3ddf2a15" /> ### How to test on Vercel preview **Preview routes:** `/search` **Steps:** 1. Open the trace timeline and explore the new features described above. ### References - Linear Issue: Closes HDX-3945, HDX-3952, HDX-4443, and HDX-4444. - Related PRs: #1970




Summary
Redesigns the trace waterfall chart and cleans up the surrounding trace panel layout.
Waterfall redesign (HDX-3945)
Trace panel layout (HDX-3952)
Collapse hint bug (HDX-4444)
CollapseTooltipLabel/useDisclosure) that could render multiple times when chevrons were highlighted in quick succession. Collapse is now an always-present chevron control.Supporting changes
useWaterfallSearchStatenow persists the filter language (whereLanguage) in the URL so shared links / reloads rebuild the query in the language it was written in.SearchWhereInputaccepts aparentReffor popover positioning.Testing
DBTraceWaterfallChart.test.tsxcovering the depth-control logic.DBTracePanel.test.tsxfor the new layout.Screenshots or video
How to test on Vercel preview
Preview routes:
/searchSteps:
References