Skip to content

fix(ui): trace waterfall bar geometry — consistent, sub-ms offsets/widths#65

Merged
thejefflarson merged 1 commit into
mainfrom
fix-waterfall-bar-geometry
Jun 27, 2026
Merged

fix(ui): trace waterfall bar geometry — consistent, sub-ms offsets/widths#65
thejefflarson merged 1 commit into
mainfrom
fix-waterfall-bar-geometry

Conversation

@thejefflarson

Copy link
Copy Markdown
Owner

The trace waterfall positioned each bar's left edge from Date.parse(start_time) (ms-resolution) but sized its width from duration_ms (sub-ms). The two bases desynced, so a bar's right edge didn't map to the span's true end — widths looked jittery on short traces and child bars could escape their parent's bar.

Fix: derive both offset and width from one epochMicros() that keeps the sub-ms digits our timestamps carry, and compute width as end − start (same basis as the offset). The time→x mapping is now one monotonic function, so parents always enclose children. duration_ms is still shown as the numeric label.

(Microsecond precision is the ceiling from the Postgres timestamptz columns; true nanos would need raw-nano columns — separate follow-up if needed.)

Verified: tsc --noEmit clean, vite build green.

🤖 Generated with Claude Code

The trace waterfall positioned each bar's left edge from Date.parse(start_time)
(ms-resolution) but sized its width from duration_ms (sub-ms). The two bases
desynced, so a bar's right edge didn't map to the span's true end — making widths
look jittery on short traces and letting child bars escape their parent's bar.

Derive both offset and width from a single epochMicros() that keeps the sub-ms
digits our timestamps carry, and compute width as end−start (same basis as the
offset). The time→x mapping is now one monotonic function, so parents always
enclose children. duration_ms is still shown as the numeric label.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thejefflarson thejefflarson merged commit 2698159 into main Jun 27, 2026
@thejefflarson thejefflarson deleted the fix-waterfall-bar-geometry branch June 27, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant