Documentation
¶
Overview ¶
Package canarypolicy holds the stage schedule, thresholds and env defaults of staged canary releases. It is a leaf so the app spec can import it.
Index ¶
Constants ¶
const ( EnvStages = "APP_CANARY_STAGES" EnvInterval = "APP_CANARY_INTERVAL" EnvMaxErrorRate = "APP_CANARY_MAX_ERROR_RATE" EnvMaxP95Ratio = "APP_CANARY_MAX_P95_RATIO" EnvMinRequests = "APP_CANARY_MIN_REQUESTS" EnvP95FloorMS = "APP_CANARY_P95_FLOOR_MS" EnvTick = "APP_CANARY_TICK" )
Env vars that tune the defaults a per-app policy or start request can override.
const ( // MaxStages bounds a stage schedule. MaxStages = 10 // MaxWeight is the largest share ingress gives a canary; 100 means promote. MaxWeight = 99 // Full is the stage value that means "promote". Full = 100 )
Variables ¶
This section is empty.
Functions ¶
func ParseStages ¶
ParseStages parses "10,25,50,100"; an empty string yields no stages.
func ValidateStages ¶
ValidateStages checks a schedule: ascending percents of 1 to 100, at least one below 100 so something is judged before promotion.
Types ¶
type Limits ¶
type Limits struct {
// MinRequests is the canary request count a stage needs before it is judged.
MinRequests uint64
// P95FloorMS ignores latency ratios while the canary p95 is below it.
P95FloorMS float64
Tick time.Duration
}
Limits are the judgement knobs that are global rather than per app.
func DefaultLimits ¶
DefaultLimits returns the global limits overridden by APP_CANARY_* env vars.
type Policy ¶
type Policy struct {
Stages []int
// Interval is how long each stage observes traffic before it may advance.
Interval time.Duration
// MaxErrorRate is how far (as a fraction, 0.02 is two points) the canary's
// 5xx rate may exceed the stable release's before the canary is rolled back.
MaxErrorRate float64
// MaxP95Ratio is how many times the stable p95 the canary's p95 may reach.
MaxP95Ratio float64
}
Policy is the stage schedule and breach thresholds of one staged canary.
func DefaultPolicy ¶
DefaultPolicy returns the built-in defaults overridden by APP_CANARY_* env vars.