Defaults and safety model¶
Generated from: policy/schema.go, retry/executor.go, retry/defaults.go, retry/budget.go, retry/group.go, classify/builtins.go, retry/global.go.
retry.DefaultExecutor uses retry.NewDefaultExecutor unless a global executor is set.
Policy defaults¶
Defaults are taken from policy.DefaultPolicyFor. Normalization may adjust values when fields are zero or out of bounds.
| Field path | Default |
|---|---|
Circuit.Cooldown |
0 |
Circuit.Enabled |
false |
Circuit.Threshold |
0 |
Hedge.Budget.Cost |
1 |
Hedge.CancelOnFirstTerminal |
false |
Hedge.Enabled |
false |
Hedge.HedgeDelay |
0 |
Hedge.MaxHedges |
0 |
Key |
key |
Meta.Source |
PolicySourceDefault |
Retry.BackoffMultiplier |
2 |
Retry.Budget.Cost |
1 |
Retry.InitialBackoff |
10 * time.Millisecond |
Retry.Jitter |
JitterNone |
Retry.MaxAttempts |
3 |
Retry.MaxBackoff |
250 * time.Millisecond |
Retry.OverallTimeout |
0 |
Retry.TimeoutPerAttempt |
0 |
Normalization limits¶
Values are defined in policy/schema.go and used by EffectivePolicy.Normalize.
| Constant | Value |
|---|---|
maxBackoffCeiling |
30 * time.Second |
maxBackoffMultiplier |
10.0 |
maxHedges |
3 |
maxRetryAttempts |
10 |
minBackoffFloor |
1 * time.Millisecond |
minCircuitCooldown |
100 * time.Millisecond |
minCircuitThreshold |
1 |
minHedgeDelayFloor |
10 * time.Millisecond |
minTimeoutFloor |
1 * time.Millisecond |
Executor defaults (NewExecutorFromOptions)¶
When an option is nil, the executor supplies a fallback.
| Component | Default |
|---|---|
| Provider | &controlplane.StaticProvider{} |
| Observer | &observe.NoopObserver{} |
| Clock | time.Now |
| Sleep | sleepWithContext |
| Classifiers | classify.NewRegistry() + classify.RegisterBuiltins (always, auto, http) |
| Triggers | hedge.NewRegistry() |
| Circuits | circuit.NewRegistry() |
| Default classifier | classify.AlwaysRetryOnError{} |
| Budgets | nil |
Default failure modes¶
Failure modes control what happens when policy, budgets, classifiers, or triggers are missing.
| Missing mode | Default | Notes |
|---|---|---|
| MissingPolicyMode | FailureDeny |
Policy resolution errors fail closed (NoPolicyError). |
| MissingBudgetMode | FailureDeny |
Missing or invalid budgets deny attempts. |
| MissingClassifierMode | FailureFallback |
Fallback to the default classifier. |
| MissingTriggerMode | FailureFallback |
Missing trigger falls back to fixed delay hedging. |
NewDefaultExecutor additions¶
NewDefaultExecutor builds on NewExecutorFromOptions with these defaults.
| Component | Value |
|---|---|
| Built-in classifiers | always, auto, http |
| Default classifier | classify.AutoClassifier{} |
| Budget registry entries | unlimited |
| Hedge trigger registry entries | fixed_delay, p90, p95, p99 |
| Observer | &observe.NoopObserver{} |