Repository navigation
fix: numbers that read as numbers (#232) - #237
Conversation
Six presentation defects from #232 (P2 items 14-17), all of which made correct data look wrong. Ten minutes was printed as "600.00s" — two decimals of false precision on a figure nobody reads in seconds — in the same column as "25.0ms", so a glance could not compare the two. duration now picks the largest unit that still says something precise: 48.2ms, 240ms, 7.65s, 13.7s, 10m, 4m 23s, 1h 30m. A rate that rounds to zero is now written "<0.01%" rather than "0.00%", which beside a red badge read as a contradiction the reader could not resolve. The latency and error chart drew its rate multiplied by a thousand so it could share the latency axis, which is what put "Error rate x 1000" in the legend. Each series now has an axis in its own units, and latency labels read through the same formatter as the tables, so one axis no longer carries "0.0ms" and "100.00s" together. Endpoint percentiles came from the containing histogram bucket's upper bound, so P95 and P99 showed the same number on most rows — a table that reads as broken. They are interpolated inside the bucket now: six calls at 5, 10, 100, 500, 1000 and 2000ms report 1700ms and 1940ms rather than 2000ms twice. A P50 moving 3.9ms to 4.0ms was flagged as a 2.2% regression in red. Latency comparisons ignore moves below a millisecond, which spends the colour on something worth looking at. The errors column takes its colour from the same health as the service badge beside it, instead of a threshold of its own that put a red pill next to a grey rate on one row. A day of activity was 288 points on a card a few hundred pixels wide, drawn as a band rather than a line. Buckets widen with the window: a day now reads at fifteen minutes. Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk
The query's column list and the boundaries the interpolation reads were written out twice, coupled by position alone. Reordering either, or adding a boundary to the rollup without adding it here, would keep compiling and report one bucket's count against another's boundary — every percentile quietly shifted, nothing visibly broken. Both now come from a single table of column and boundary, and a test asserts the boundaries increase and that the query selects them in that order. What still cannot be checked here is agreement with the histogram the rollup writes, which lives in another package; the comment now points at the end-to-end test that does catch that, instead of claiming an assertion that does not exist. Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk
Review of this branch found six places where the presentation still said something the data did not. The errors column took its colour from the row's health badge, but a service is unhealthy on error rate *or* latency — so one that was slow with no failures rendered "0.00%" in red, while the P95 that caused it stayed unstyled. Each figure now carries its own threshold: latency is coloured by the latency thresholds and the rate by the rate thresholds, both mirroring classify(), which now names its constants rather than spelling them inline. The badge keeps the combined verdict, which is what a row summary is for. The latency noise floor silenced the arrow but not the number: an earlier half with no traffic divides out at 100%, so the card printed "↑ 100.0%" inside a grey "stable" badge. The percentage is dropped along with the direction. duration rounded up out of its own unit — 999.5ms printed "1000ms", four digits of milliseconds in a column of seconds — and 99.96 printed "100.0ms" beside 100's "100ms". Each unit now decides precision on the value it will print. A duration below a hundredth of a millisecond reads "<0.01ms" rather than "0.00ms", for the reason percent says "<0.01%": a four-microsecond span is not a zero-length one, and the trace waterfall is full of them. A negative duration is shown as negative instead of as an em dash, because bad data and missing data should not look alike. Axis ticks no longer borrow the table formatter: "<0.01%" is right in a cell and useless on a gridline, where every tick would carry it. A rate series that is all zeroes now pins its axis instead of letting the chart invent a 100% tick above a window with no errors. The endpoint ordering tiebreaker was zero for every sub-second endpoint, so which rows survived the LIMIT could change between refreshes; it now falls through to method and path and is stable. Also pinned by tests: interpolation grades an endpoint on its calls rather than its bucket — 100 calls at 700ms are healthy, where reporting the 750ms bound called them degraded — and the wider bucket covers the interior of the range, not just its edges. The wider bucket also applies to the logs histogram, which shares the same function. Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk
|
Reviewed in an isolated worktree; ten findings, six fixed here in Medium: the errors column was coloured by the row's health badge, but a service is unhealthy on error rate or latency — so a slow service with no failures rendered "0.00%" in red while the P95 that caused it stayed unstyled. Each figure now uses its own threshold. Verified locally on a service at 2.98s p95 with zero errors: latency red, rate grey. Medium: the latency noise floor dropped the arrow but passed the percentage through, so an earlier half with no traffic printed "↑ 100.0%" inside a grey "stable" badge. Medium: interpolation moves an endpoint out of the health class the bucket bound put it in — 100 calls at 700ms are healthy where the 750ms bound called them degraded. That is the correction working, and it is now pinned by a test. Low: Not changed: the review noted the wider bucket also applies to the logs histogram (288 → 96 over a day). That is the same intent, and a test now covers the interior of the range. The histogram's 300000ms ceiling still disagrees with the rollup percentile for calls slower than five minutes — called out in the PR description as a follow-up. |
What changed
P2 items 14–17 from #232: six places where correct data was presented in a way that made it look wrong. Verified against a local instance seeded with a latency spread wide enough to exercise each one.
Durations read in the largest unit that stays precise. Ten minutes printed as
600.00s— two decimals of false precision on a figure nobody reads in seconds — in the same column as25.0ms, so a glance could not compare them. Now:48.2ms,240ms,7.65s,13.7s,10m,4m 23s,1h 30m. The seeded checkout service reads7m 30swhere it used to read450.13s.A rate that rounds to zero says so.
<0.01%rather than0.00%, which beside a red badge read as a contradiction the reader could not resolve.The latency/error chart has two real axes. The rate was multiplied by a thousand to share the latency axis — that is what put
Error rate × 1000in the legend. Each series now carries its own axis and formatter: latency ticks read1m 40s, the rate reads20.0%, and no single axis mixes0.0mswith100.00s.Endpoint percentiles are interpolated, not bucket bounds. P95 and P99 came back as the containing histogram bucket's upper bound, so most rows showed the same number twice — a table that reads as broken. Six calls at 5, 10, 100, 500, 1000 and 2000ms now report 1700ms and 1940ms rather than 2000ms twice. On the seeded data
/checkoutreports p50 17.8ms, p95 24.8ms, p99 1500ms where it would have shown 25 / 25 / 2000.Latency comparisons ignore sub-millisecond moves. A P50 going 3.9ms → 4.0ms was a red 2.2% regression. The seeded run reports 19.27ms → 19.34ms as stable.
The errors column matches the badge beside it. It had its own threshold, which put a red pill next to a grey rate on the same row and left the reader to pick one.
A day of activity is not 288 points. Buckets widen with the window — a day reads at fifteen minutes instead of five, so the line is a shape rather than a band.
Verification
just checkjust test-racewhen auth, API, ingest, query, MCP, or agent paths changedNew tests cover the formatter across every magnitude and both
NaNand zero, the quantile helper including its empty and overflow paths, the noise floor keeping a real regression visible, and the widened bucket. Existing endpoint tests were updated with the interpolated expectations and the reason they changed.Known limit, unchanged by this PR: the endpoint histogram stops counting at 300000ms, so a call slower than five minutes is reported at that cap while the service-level percentile (computed from the rollup, not the histogram) shows the true figure. The two disagree for such calls; worth a follow-up.
Part of #232 (P2 items 14, 15, 16, 17).