Expand description
Auto-canary analysis (DW-091): metrics-driven promotion/rollback of canary split weights.
A CanaryController holds per-group state (one group per service
split or AI model alias that configures canary_analysis). The
controller maintains its OWN per-version sliding windows for error
rate and latency (no new Prometheus histograms) using atomic
counters and a bounded VecDeque of latency samples — the same
lightweight pattern as the resilience domain’s AdaptiveController
(DW-089) and the balancer’s PeakEwmaTracker.
§Lifecycle
Compiled once per config generation from the canary_analysis
blocks on service splits and AI model aliases; shared via Arc
from the dataplane generation. record_outcome runs on the
response path (after the upstream exchange resolves) and
evaluate runs on the background CanaryRunner loop. Weight
changes are TRANSIENT: the runner calls
DataPlane::apply_service_split_weights /
apply_ai_canary_weights, which clone the current generation’s
split/runtime, rebuild with new weights, and ArcSwap-store. A
config reload rebuilds the generation from the published config,
reverting any transient weight changes (the controller’s sliding
windows reset with the generation, like the adaptive controller).
§Step semantics
Configurable step in weight units. Promote: increase canary weight
by step (up to total_weight). Rollback: decrease by step
(down to 0). Severe regression (>2x the rollback threshold):
immediate rollback to 0. The total weight stays constant: when
the canary weight changes, the baseline absorbs the difference,
preserving the hash distribution for existing sessions (the
DW-040 invariant).
§Guards
- Cooldown: after one adjustment, the next is suppressed until
cooldown_secondselapses. - min_requests: the controller does not act until at least
min_requeststotal observations (baseline + canary) have been recorded. - Disabled: a
canary_analysisblock withenabled: falsecompiles no group (the fast path:record_outcomeandevaluateare no-ops).
Structs§
- Canary
Action - One evaluation result: the controller recommends adjusting
group’s canary weight tonew_canary_weightfor the givenreason. - Canary
Controller - The per-generation canary analysis controller (DW-091). Compiled
once per config generation from the
canary_analysisblocks on service splits and AI model aliases; shared viaArcfrom the dataplane generation.record_outcomeruns on the response path andevaluateruns on the backgroundCanaryRunnerloop. - Canary
Runner - The background canary evaluation loop (DW-091). Spawned by
dwara-bin after the dataplane is initialized; periodically calls
CanaryController::evaluate, applies the returned actions through the dataplane’s transient weight-swap methods, and emitsCanaryPromoted/CanaryRolledBackevents. Dropping the runner (or shutdown) aborts the loop.
Enums§
- Canary
Kind - Whether a canary group is a service-level split or an AI model
canary (DW-091). Determines which
apply_*_weightsmethod the runner calls.