Skip to content

feat(admin): HTTP request analytics on Traces view (v26.05.10)#21

Merged
ancongui merged 1 commit into
mainfrom
feat/admin-traces-analytics
May 31, 2026
Merged

feat(admin): HTTP request analytics on Traces view (v26.05.10)#21
ancongui merged 1 commit into
mainfrom
feat/admin-traces-analytics

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

Summary

The admin Traces view now leads with live HTTP request analytics, computed entirely client-side from the trace stream:

  • Stat cards — Total Requests, Avg Duration, Error Rate (4xx+5xx %, tinted amber/red when elevated), Max Latency.
  • Status Mix — a segmented bar + color-coded legend showing the 2xx/3xx/4xx/5xx split with counts and percentages.
  • Latency Distribution — a histogram across latency buckets (<10ms≥1s) plus a p50 / p90 / p95 / p99 percentile strip.
  • Everything updates live as requests arrive (debounced 400 ms) and resets on Clear.

Hardening (from the adversarial review workflow)

A 3-dimension review (lifecycle / analytics / CSS-a11y) with independent verification confirmed 5 findings; all addressed:

  • Bounded client buffer (500) — the in-memory array, the table DOM, and the per-refresh O(n log n) analytics no longer grow without bound on a long-lived tab (matches the server ring buffer). (high)
  • Fixed a latent placeholder bug: a live insert while a filter showed "No traces" left the stale placeholder row. (found while fixing)
  • Avg Duration now reads -- (not 0.0 ms) when no trace carries a duration, consistent with Max/percentiles. (nit)
  • The decorative status bar is aria-hidden; the legend carries the numbers for assistive tech. (a11y)
  • cleanup() disconnects SSE, clears the debounce timer, and destroys the chart.

Verification (Playwright, live)

Desktop + light & dark themes, mobile 390px (no overflow, cards/charts stack & resize), live SSE insert (Total 74→79 as requests streamed), filter→placeholder→back, and navigation cleanup (re-entry works, zero console errors). Status mix / percentiles / histogram all numerically correct against generated 2xx+4xx traffic.

Gates

ruff ✓ · ruff format --check ✓ · mypy --strict (577 files) ✓ · pytest tests/admin tests/web352 passed.

Version

Bumps to v26.05.10 (pyproject 26.5.10, __version__, uv.lock). CHANGELOG + admin docs updated. JS/CSS-only feature (no Python changes).

The Traces view now leads with live request analytics computed from the
trace stream:

- Stat cards: Total Requests, Avg Duration, Error Rate (4xx+5xx %, tinted
  amber/red when elevated), Max Latency.
- Status Mix: a segmented bar + legend with the 2xx/3xx/4xx/5xx split
  (counts + percentages).
- Latency Distribution: a histogram across buckets (<10ms … ≥1s) plus a
  p50/p90/p95/p99 percentile strip.
- All update live as requests arrive (debounced refresh), reset on Clear.

Hardening (from adversarial review):
- Bound the client trace buffer to 500 (matching the server ring buffer):
  the in-memory array, the table DOM and the per-refresh O(n log n) analytics
  no longer grow without bound on a long-lived tab.
- Fix a latent bug where a live insert left a stale "No traces" placeholder.
- Avg Duration reads '--' (not '0.0 ms') when no trace carries a duration.
- The decorative status bar is aria-hidden; the legend carries the numbers.
- cleanup() disconnects SSE, clears the debounce timer, and destroys the chart.

Responsive (cards/charts stack + resize on mobile) and theme-aware (dark +
light). Verified live via Playwright (desktop/light/dark/mobile, live SSE
insert, filter placeholder, navigation cleanup). Gates green: ruff, format,
mypy --strict (577 files); 352 admin+web tests pass.
@ancongui ancongui merged commit 224928c into main May 31, 2026
5 checks passed
@ancongui ancongui deleted the feat/admin-traces-analytics branch May 31, 2026 19:00
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