You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
End-to-end keyviz wiring on each node binary. Stacked on top of #645
(coordinator `WithSampler`) and #646 (admin server `RegisterSampler`) —
those two PRs are merged into this branch via merge commits, so this
PR's incremental diff is `main.go` + `main_keyviz_test.go`.
- Three new flags: `--keyvizEnabled` (off by default — opt-in),
`--keyvizStep`, `--keyvizMaxTrackedRoutes`,
`--keyvizMaxMemberRoutesPerSlot`. Defaults pull from `keyviz.Default*`
so flag help and code stay in sync.
- `buildKeyVizSampler()` returns `*keyviz.MemSampler` when enabled,
`nil` otherwise — the single decision point for "keyviz on/off."
- `seedKeyVizRoutes()` copies the engine's startup route catalogue into
the sampler. Route-watch propagation post-startup is a follow-up (Phase
3 in the design doc).
- `startKeyVizFlusher()` runs `RunFlusher` in the existing errgroup and
calls one final `Flush()` after ctx fires so the in-progress step is
harvested at graceful shutdown.
- Coordinator: chained `.WithSampler(...)` onto the existing
`.WithLeaseReadObserver(...)` call so the dispatch hot path observes
mutations.
- AdminServer: `setupAdminService` now takes the `*MemSampler` and only
calls `RegisterSampler` when it's non-nil — operators with keyviz
disabled get `codes.Unavailable` on `GetKeyVizMatrix` instead of a
spurious empty success.
Implements `docs/admin_ui_key_visualizer_design.md` §5 / §10. After this
lands the heatmap is fully usable end-to-end.
## Test plan
- [x] `TestBuildKeyVizSamplerHonorsEnabledFlag` — flag on/off contract.
- [x] `TestSeedKeyVizRoutesCopiesEngineCatalogue` — `engine.Stats()`
seed path.
- [x] `TestSeedKeyVizRoutesNoOpOnNilSampler` — disabled-sampler safety.
- [x] `TestStartKeyVizFlusherReturnsAfterCancel` — graceful shutdown
drains the pre-cancel counters via the final `Flush`.
- [x] `go build .`, `go vet .`, `golangci-lint run ./...` clean.
- [x] `go test -race -count=1 -run
'TestBuildKeyVizSampler|TestSeedKeyVizRoutes|TestStartKeyVizFlusher' .`
passes.
## Merge order
1. Merge #645 (coordinator wiring).
2. Merge #646 (admin server wiring).
3. Rebase this branch on `main` (the merge commits in this PR collapse
to no-ops) and merge.
0 commit comments