How justskiv/goschedviz works
goschedviz is a terminal dashboard for observing a Go program’s runtime scheduler. The CLI starts a target with GODEBUG schedtrace, collects and parses scheduler output, retains recent snapshots, converts them into UI data, and updates the terminal display. A target can optionally use the metrics reporter to emit goroutine counts. The graph follows relationships shown in the excerpts and README; individual widget implementations are linked through the renderer, while unsampled collector details are not inferred.
Main entry points: renderer.go Terminal renderer · main.go Monitor CLI · collector.go GODEBUG collector · parser.go Trace parser
Components 17
Monitoring runtime
- Monitor CLI
cmd/goschedviz/main.go - GODEBUG collector
internal/collector/godebug/collector.go
Metrics and state
- Trace parser
internal/collector/godebug/parser.go - Scheduler snapshots
internal/domain/scheduler.go - Monitor history
internal/domain/scheduler.go
Terminal presentation
- UI data model
internal/ui/dto.go - Presenter contract
internal/ui/presenter.go - Terminal renderer
internal/ui/termui/renderer.go - Current values table
internal/ui/termui/widgets/table.go - Local queue bars
internal/ui/termui/widgets/barchart.go - Metric gauges
internal/ui/termui/widgets/gauge.go - History plots
internal/ui/termui/widgets/plots.go - Plot legend
internal/ui/termui/widgets/legend.go - Info panel
internal/ui/termui/widgets/info.go
Target integration
- Go target process
- Goroutine reporter
pkg/metrics/metrics.go
Other components
- CLI user
Connections 20
- CLI user → Monitor CLI: starts
README.md - Monitor CLI → GODEBUG collector: starts collection
cmd/goschedviz/main.go - GODEBUG collector → Go target process: launches with schedtrace
internal/collector/godebug/collector.go - Go target process → GODEBUG collector: writes stderr
internal/collector/godebug/collector.go - GODEBUG collector → Trace parser: parses output with
internal/collector/godebug/collector.go - Trace parser → Scheduler snapshots: produces
internal/collector/godebug/parser.go - GODEBUG collector → Monitor CLI: sends snapshots
cmd/goschedviz/main.go - Monitor CLI → Monitor history: updates
cmd/goschedviz/main.go - Monitor history → Monitor CLI: returns latest and history
cmd/goschedviz/main.go - Monitor CLI → UI data model: converts snapshots
cmd/goschedviz/main.go - Monitor CLI → Presenter contract: updates
cmd/goschedviz/main.go - Goroutine reporter → Go target process: exports goroutine count
README.md - Trace parser → Scheduler snapshots: adds parsed goroutine count
internal/collector/godebug/parser.go - Terminal renderer → Presenter contract: implements
internal/ui/termui/renderer.go - Terminal renderer → Current values table: updates and renders
internal/ui/termui/renderer.go - Terminal renderer → Local queue bars: updates and renders
internal/ui/termui/renderer.go - Terminal renderer → Metric gauges: updates and renders
internal/ui/termui/renderer.go - Terminal renderer → History plots: updates and renders
internal/ui/termui/renderer.go - Terminal renderer → Plot legend: renders
internal/ui/termui/renderer.go - Terminal renderer → Info panel: updates and renders
internal/ui/termui/renderer.go