Files
bee/bible-local/architecture/charting.md
Michael Chus ec0b7f7ff9 feat(metrics): single chart engine + full-width stacked layout
- One engine: go-analyze/charts (grafana theme) for all live metrics
- Server chart: CPU temp, CPU load%, mem load%, power W, fan RPMs
- GPU charts: temp, load%, mem%, power W — one card per GPU, added dynamically
- Charts 1400x280px SVG, rendered at width:100% in single-column layout
- Add CPU load (from /proc/stat) and mem load (from /proc/meminfo) to LiveMetricSample
- Add GPU mem utilization to GPUMetricRow (nvidia-smi utilization.memory)
- Document charting architecture in bible-local/architecture/charting.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 23:26:13 +03:00

1.5 KiB
Raw Blame History

Charting architecture

Decision: one chart engine for all live metrics

Engine: github.com/go-analyze/charts (pure Go, no CGO, SVG output) Theme: grafana (dark background, coloured lines)

All live metrics charts in the web UI are server-side SVG images served by Go and polled by the browser every 2 seconds via <img src="...?t=now">. There is no client-side canvas or JS chart library.

Why go-analyze/charts

  • Pure Go, no CGO — builds cleanly inside the live-build container
  • SVG output — crisp at any display resolution, full-width without pixelation
  • Grafana theme matches the dark web UI colour scheme
  • Active fork of the archived wcharczuk/go-chart

SAT stress-test charts

The drawGPUChartSVG function in platform/gpu_metrics.go is a separate self-contained SVG renderer used only for completed SAT run reports (HTML export, burn-in summaries). It is not used for live metrics.

Live metrics chart endpoints

Path Content
GET /api/metrics/chart/server.svg CPU temp, CPU load %, mem load %, power W, fan RPMs
GET /api/metrics/chart/gpu/{idx}.svg GPU temp °C, load %, mem %, power W

Charts are 1400 × 280 px SVG. The page renders them at width: 100% in a single-column layout so they always fill the viewport width.

Ring buffers

Each metric is stored in a 120-sample ring buffer (2 minutes of history at 1 Hz). Buffers are per-server or per-GPU and grow dynamically as new GPUs appear.