Skip to content

Migrate trace dashboard charts to @schemavaults/ui components - #237

Merged
jalexw merged 2 commits into
mainfrom
claude/wonderful-mccarthy-8n9vn1
Sep 27, 2026
Merged

jalexw merged 2 commits into
mainfrom
claude/wonderful-mccarthy-8n9vn1

Conversation

@jalexw

@jalexw jalexw commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Replaces custom chart implementations in the server traces dashboard with reusable chart components from the @schemavaults/ui package, reducing code duplication and improving maintainability.

Summary

This PR migrates the trace dashboard from custom SVG chart implementations to standardized chart components exported by @schemavaults/ui. The custom chart files (TimeSeriesChart, DurationScatter, DurationHistogram, RankedBarList, and chart-primitives) are removed and replaced with LineChart, ScatterPlot, Histogram, and BarList components from the shared UI package.

Key Changes

  • Removed custom chart implementations:

    • TimeSeriesChart.tsx – replaced by LineChart from @schemavaults/ui
    • DurationScatter.tsx – replaced by ScatterPlot from @schemavaults/ui
    • DurationHistogram.tsx – replaced by Histogram from @schemavaults/ui
    • RankedBarList.tsx – replaced by BarList from @schemavaults/ui
    • chart-primitives.tsx – utilities now provided by @schemavaults/ui
  • Updated tile components:

    • DistributionTiles.tsx: Migrated DurationHistogramTile and DurationScatterTile to use Histogram and ScatterPlot
    • TimeTiles.tsx: Migrated time series charts to use LineChart; extracted TimeLineChart helper component
    • BreakdownTiles.tsx: Migrated to use BarList from @schemavaults/ui
  • Simplified trace analytics:

    • Removed buildDurationHistogram(), niceTicks(), and related histogram-specific functions from trace-analytics.ts
    • Kept niceAxisTop() and niceStep() as they're still used by the new chart components
    • Updated tests to reflect removed functions
  • Updated trace categories:

    • Replaced custom color variable definitions with imports from @schemavaults/ui (CHART_SERIES_COLORS, CHART_OTHER_COLOR)
    • Simplified color management by leveraging shared UI color palette
  • Removed measurement utilities:

    • Deleted MeasuredChart component from TraceTileCard.tsx (charts now handle their own sizing)
    • Removed useMeasuredWidth usage from UsersGrowthCard.tsx
  • Type updates:

    • Imported HistogramScaleId from @schemavaults/ui instead of trace-analytics
    • Updated format functions to work with new HistogramBucket type from @schemavaults/ui

Implementation Details

  • The new chart components handle their own responsive sizing and layout, eliminating the need for custom measurement wrappers
  • Time series charts now use LineChart with a helper component (TimeLineChart) that adapts the trace analytics data format
  • Histogram and scatter plot components use the same data transformation logic but with the standardized component APIs
  • All chart accessibility features (keyboard navigation, ARIA labels, tooltips) are preserved through the new components
  • Version bumps applied to affected packages: auth-server (0.46.1 → 0.46.2), auth-ui (0.17.0 → 0.17.1), and related packages

https://claude.ai/code/session_01Cf3XfSV7aPL398ffXS1tEP

…server-sdk:0.31.1, trpc-backend-init:0.9.67, openapi-docs-ui:0.1.8, auth-server:0.46.2, example-nextjs-resource-server:0.5.9 - @schemavaults/ui 0.110.1 + theme 0.29.0; traces charts on ui components

Update @schemavaults/ui (0.101.0 -> 0.110.1) and @schemavaults/theme
(0.26.1 -> 0.29.0) everywhere, and replace the hand-rolled charts with the
chart components the new ui ships:

- /admin/traces: the duration histogram is ui's Histogram (bins from
  binValues with a 1 ms minimum bin, same buckets as before), the scatter
  plot is ScatterPlot (log scale, p50/p95 reference lines, operation
  highlight on hover), latency over time and throughput are LineChart
  (gaps, area, crosshair readout; markers only for isolated buckets), and
  the slowest/busiest rankings are BarList (click to filter). The charts/
  directory, MeasuredChart and the --trace-series-* color variables are
  gone: charts size themselves with width="auto" and colors come from the
  theme's --chart-* palette (the same hues).
- The scatter plot no longer filters on click: ui's ScatterPlot makes every
  clickable point a Tab stop, which with a 1,000-trace sample would bury the
  rest of the dashboard behind 1,000 tab presses. The rankings and the
  per-operation table still filter by operation.
- auth-ui: in ui 0.110 the "default" chart color is palette slot 1 rather
  than the brand blue, so the users breakdown legend swatches now come from
  getChartColorClasses() and match their slices; the users growth
  sparklines use width="auto". auth-ui's useMeasuredWidth is deprecated in
  favour of the ui charts' own sizing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cf3XfSV7aPL398ffXS1tEP
auth-ui's own width hook is now a re-export of the one @schemavaults/ui
0.110 ships for its charts' width="auto", instead of a deprecated
duplicate. The root export, the default export and the lib/ deep path all
resolve to the ui hook. Its ref is a callback ref (it was a ref object) and
the result gains isMeasured; passing the ref to an element works as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cf3XfSV7aPL398ffXS1tEP
@jalexw jalexw self-assigned this Sep 27, 2026
@jalexw
jalexw merged commit 3095846 into main Sep 27, 2026
55 checks passed
@jalexw
jalexw deleted the claude/wonderful-mccarthy-8n9vn1 branch September 27, 2026 14:57
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