feat(dashboard): log-tracing hub with RealUnit + All-Logs views#1113
Merged
Conversation
Adds a stacked area chart binning trace counts into time buckets (2xx/3xx green, 4xx/5xx red). Bin width scales with the selected range: 30 s for 15 min, 1 min for 1 h, 5 min for 6 h, 15 min for 24 h. Uses ApexCharts via the existing react-apexcharts integration, same pattern as dashboard-financial-* charts. Animations are disabled because the chart re-renders every 5 s with the dashboard refresh.
- useMemo deps reference props directly (windowMs/endTime/binMs), with startTime derived inside the memo bodies — cleaner intent than listing a derived value in the dep array. - Drop the Date.now() fallback in the screen; render the chart only once lastFetched is set.
7 tasks
Switches the RealUnit tracing dashboard to the dark dfxBlue palette to match dashboard/financial/overview: - container: bg-dfxBlue-800, white text - cards: bg-dfxBlue-700 (reusing the shared SummaryCard with dark prop) - range buttons: blue (#3b82f6) for selected, dark navy (#082948) otherwise - table borders and labels: #0A355C / #9AA5B8 - area chart: theme.mode='dark' + matching grid color - the chart's own wrapper is dropped; the screen now wraps it so the border-radius/padding stays consistent with the other dark cards.
At 5s the dashboard generates ~720 /gs/debug/logs audit-log entries per hour, each of which matches `message contains "RealUnitTrace"` (the messageFilter is embedded verbatim in the audit) and crowds real traces out of the 200-row TRACES_BY_MESSAGE response. Polling at 60s reduces that to ~60/h, well below the real-trace volume — no API-side filter needed.
6 tasks
Restructure file naming ahead of adding generic log views:
- src/screens/dashboard-realunit-tracing.screen.tsx
-> src/screens/dashboard-log-tracing-realunit.screen.tsx
- src/hooks/realunit-tracing.hook.ts -> src/hooks/log-tracing.hook.ts
- src/components/dashboard/realunit-trace-time-chart.tsx
-> src/components/dashboard/log-trace-time-chart.tsx
Identifier renames:
- useRealunitTracing -> useLogTracing
- RealUnitTraceTimeChart -> LogTraceTimeChart
- DashboardRealunitTracingScreen -> DashboardLogTracingRealunitScreen
getRealunitTraces stays — it remains the RealUnit-specific fetcher.
Restructure the tracing dashboard around a hub URL with two sub-views: - /dashboard/log-tracing — hub screen with two cards (RealUnit, All Logs) - /dashboard/log-tracing/realunit — existing RealUnit tracing screen - /dashboard/log-tracing/all — new view over all API trace entries Hook expansion in log-tracing.hook.ts: - getAllTraces(hours) — fetches the 'all-traces' template - GenericTrace interface + parseGenericTrace() — extracts [Context] prefix and severity from generic trace rows The All-Logs screen mirrors the RealUnit screen's container, toolbar, and refresh patterns (60s refresh, cancellable, dark theme); time ranges limited to 1h/6h/24h, and the view shows 4 summary cards plus a 50-row recent-entries table grouped by severity and context. The /dashboard hub card 'RealUnit Tracing' is renamed to 'Log Tracing' and now navigates to the new hub URL.
…ly guard The 5s-refresh cadence the disable-animations note referred to no longer exists — the chart now refreshes every 60s, so smooth transitions feel correct and aren't perceived as jitter. Document the choice of useAdminGuard() in the RealUnit screen: backend /gs/debug/logs is RoleGuard(DEBUG), and additionalRoles only grants ADMIN+SUPER_ADMIN — not REALUNIT — so admin-only matches the API gate.
The /gs/debug/logs all-traces template projects the column as operation_Id (snake_case), but the screen was looking it up as operationId. Made every GenericTrace silently empty for that field.
…aming - Adds /dashboard/log-tracing, /log-tracing/realunit, /log-tracing/all that this PR introduces. - Adds /dashboard/financial/overview that was missing pre-existing. - Renames the "Financial Dashboard" section to "Dashboard" since it now covers non-financial sub-pages. - Cross-checked against App.tsx; flags any other gaps in the output.
davidleomay
approved these changes
May 29, 2026
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.
Summary
Restructures the tracing dashboard into a hub URL with two sub-views, on top of the existing RealUnit tracing screen + calls-over-time chart.
New URL structure
/dashboard/log-tracing— hub screen with two cards (dark-themed, matches financial overview):/dashboard/log-tracing/realunit/dashboard/log-tracing/all/dashboard/log-tracing/realunit— the existing RealUnit tracing screen, URL-renamed only (no logic change)/dashboard/log-tracing/all— new generic-logs view: 4 summary cards (Total / Errors / Warnings / Info), 50-row Recent Entries table with severity badge, context, and message (truncated to 240 chars). 1h / 6h / 24h ranges, 60s refresh.The
/dashboardhub card previously labelledRealUnit Tracingis nowLog Tracingand points at/dashboard/log-tracing.Hook expansion
src/hooks/log-tracing.hook.ts(renamed fromrealunit-tracing.hook.ts):getAllTraces(hours)fetching the newall-tracestemplateGenericTraceinterface +parseGenericTrace()that extracts the[Context]prefix and message remainderBackend prerequisite
This screen depends on the
all-traceslog template, added in DFXswiss/api#3757. The/allview only works once that PR is deployed.File renames (all via
git mv, history preserved)src/screens/dashboard-realunit-tracing.screen.tsx->src/screens/dashboard-log-tracing-realunit.screen.tsxsrc/hooks/realunit-tracing.hook.ts->src/hooks/log-tracing.hook.tssrc/components/dashboard/realunit-trace-time-chart.tsx->src/components/dashboard/log-trace-time-chart.tsxIdentifier renames
useRealunitTracing->useLogTracingRealUnitTraceTimeChart->LogTraceTimeChartDashboardRealunitTracingScreen->DashboardLogTracingRealunitScreengetRealunitTracesstays (still the RealUnit-specific fetcher)Drive-by review fixes
useAdminGuard()documenting why admin-only is the right gate (backend/gs/debug/logsisRoleGuard(DEBUG)+ ADMIN/SUPER_ADMIN via additionalRoles, not REALUNIT).Test plan
tsc --noEmitclean for changed pathseslintclean for changed filesnpm run build:devsucceeds/dashboard->Log Tracingcard visible, navigates to/dashboard/log-tracingRealUnitnavigates to/dashboard/log-tracing/realunitand shows the unchanged tracing screenAll Logsnavigates to/dashboard/log-tracing/alland renders summary cards + recent entries (requires feat(gs): add ALL_TRACES template for generic log queries api#3757 deployed)/all-> table reloads and refresh indicator updates