Skip to content

feat(dashboard): RealUnit API tracing dashboard#1112

Merged
TaprootFreak merged 3 commits into
developfrom
feature/realunit-tracing-dashboard
May 23, 2026
Merged

feat(dashboard): RealUnit API tracing dashboard#1112
TaprootFreak merged 3 commits into
developfrom
feature/realunit-tracing-dashboard

Conversation

@TaprootFreak

Copy link
Copy Markdown
Collaborator

Summary

Adds a live dashboard for the RealUnit internal test phase under /dashboard/realunit-tracing.

  • Calls the existing POST /gs/debug/logs endpoint with template traces-by-message and filter RealUnitTraceno API change required.
  • Auto-refresh every 5s, time-range buttons for 15 min / 1 h / 6 h / 24 h.
  • Sections:
    • Summary cards: total calls, 5xx errors, 4xx responses, slow ≥ 2 s
    • Top endpoints (count / errors / median / p95) — paths normalized (:address, :id, :uuid)
    • Top IPs (count, last seen)
    • Recent activity feed (last 30) with color-coded status and duration
  • Card link added to /dashboard.

Why no API change

The backend already exposes log queries via /gs/debug/logs with the traces-by-message template. The dashboard parses each [RealUnitTrace] METHOD URL → STATUS (Nms) client=… ip=… headline client-side and aggregates locally. 200-row cap covers ~15 min of activity at current load, which is fine for a live monitoring view.

Auth

useAdminGuard(). Backend's RoleGuard(UserRole.DEBUG) accepts ADMIN/SUPER_ADMIN through additionalRoles, so admin users pass both layers. The frontend @dfx.swiss/react UserRole enum has no DEBUG value, so a pure-DEBUG-role user can't reach the screen via UI — acceptable trade-off for the test phase.

Linked

Test plan

  • npm run build:dev succeeds
  • npx tsc --noEmit clean
  • npx eslint clean on changed files
  • Login as admin → navigate /dashboard → click RealUnit Tracing card
  • Verify live data flows in, 5s auto-refresh works
  • Switch time ranges, check aggregations update

Adds a live dashboard for the RealUnit internal test phase. The screen
calls the existing /gs/debug/logs endpoint with the traces-by-message
template (filter: RealUnitTrace) and renders summary cards, top
endpoints (count / median / p95), top IPs and a recent-activity feed.
Auto-refresh every 5s, time ranges 15min/1h/6h/24h. Reachable via
/dashboard/realunit-tracing, with a card link added to the main
dashboard hub. Admin-guarded; backend gating remains on the existing
DEBUG-role endpoint (admins are included via RoleGuard additionalRoles).
- cancellation-safe refresh on range change (H1)
- correct API granularity comment (H2)
- tighter trace-headline regex (M1)
- keep dashboard visible during range refresh (L1)
- stable React keys, robust timestamp sort (L2, L5)
- default range = 1h, full UUID + interpolated p95 (N1-N3)
- drop raw message from client state (S1)
- explicit tightenToMs discriminator on TIME_RANGES (N5)
- consistent getTime-based comparison in aggregateIps (N7)
- remove redundant parens in percentile (N4)
@TaprootFreak TaprootFreak marked this pull request as ready for review May 23, 2026 11:58
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner May 23, 2026 11:58
@TaprootFreak TaprootFreak merged commit 89355d7 into develop May 23, 2026
6 checks passed
@TaprootFreak TaprootFreak deleted the feature/realunit-tracing-dashboard branch May 23, 2026 11:58
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