Skip to content

Add error-rate tracking and per-client incident surfacing#7

Merged
jacobpradels merged 1 commit into
masterfrom
feat/error-rate-incident-tracking
Jul 2, 2026
Merged

Add error-rate tracking and per-client incident surfacing#7
jacobpradels merged 1 commit into
masterfrom
feat/error-rate-incident-tracking

Conversation

@jevansnyc

Copy link
Copy Markdown
Contributor

Summary

Layers live error-rate tracking and incident surfacing onto the existing endpoint dashboard — it goes from "ranked endpoint traffic" to "ranked endpoint traffic + live error/incident detection with per-client attribution."

What's new

  • Error accounting (probes/httptop.js): each endpoint tallies respTotal, errs, err4 (4xx), err5 (5xx) with an errors/sec ring buffer; new exported errRate().
  • Per-client breakdown: a single header pass reads Host plus a configurable client header — --client-header (default x-api-key), falling back to Hostanon. Each endpoint keeps a clients map so you can see who drives traffic and errors.
  • Sort modes: sortMode signal — count (default) or errors — toggled with e.
  • Incident detection: topAlert() finds the worst endpoint over threshold (≥20 responses, ≥15% error rate) and names the client causing most of its errors.

UI

  • List: new ERR% column (red+bold once it clears the noise band).
  • Detail: Errors field (4xx/5xx split), errors/sec sparkline, "By client (worst first)" table.
  • Status bar: red ⚠ incident banner when topAlert() fires.
  • List alignment fix: HOST/PATH/rank are now padded to fixed widths via a new cell() helper. A Text's width is only a max in this tui — it won't pad short content — so columns previously drifted row-to-row; they now line up under their headers and across every row.

Testing

Verified locally against the bundled demo (demo/traffic.sh over lo): ERR% shows ~8% on /api/orders and ~100% on /static/app.js; e re-sorts worst-first; the incident banner fires after the threshold accumulates; the detail by-client table and sparkline populate; columns stay aligned regardless of host/path length. JS re-bundles cleanly (make bundle).

🤖 Generated with Claude Code

Layer live error-rate and incident detection onto the endpoint dashboard.

- probes/httptop.js: tally respTotal/errs/err4/err5 per endpoint with an
  errors/sec ring buffer; export errRate(); parse a configurable client
  header (--client-header, default x-api-key) for a per-endpoint "by
  client" breakdown; add a sortMode signal (count|errors) and topAlert()
  to find the worst over-threshold endpoint and the client driving it.
- lib/format.js: fmtErrPct(), errColor() heat scale, W_ERR/W_PATH widths,
  and a cell() helper that fits a string to an exact column width — a
  Text's width is only a max, so a fixed column must carry its own padding.
- list.jsx: new ERR% column; pad HOST/PATH/rank to fixed widths so every
  column lines up under its header and row-to-row.
- detail.jsx: Errors field (4xx/5xx split), errors/sec sparkline, and a
  "By client (worst first)" table.
- statusbar.jsx: red incident banner when topAlert() fires.
- main.jsx / legend.jsx: wire the `e` sort toggle and its legend hint.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jacobpradels jacobpradels merged commit 1319b5b into master Jul 2, 2026
5 checks passed
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.

2 participants