fix(ui): trace waterfall bar geometry — consistent, sub-ms offsets/widths#65
Merged
Conversation
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>
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.
The trace waterfall positioned each bar's left edge from
Date.parse(start_time)(ms-resolution) but sized its width fromduration_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 asend − start(same basis as the offset). The time→x mapping is now one monotonic function, so parents always enclose children.duration_msis still shown as the numeric label.(Microsecond precision is the ceiling from the Postgres
timestamptzcolumns; true nanos would need raw-nano columns — separate follow-up if needed.)Verified:
tsc --noEmitclean,vite buildgreen.🤖 Generated with Claude Code