Skip to content

Policy schema reference

Generated from: policy/key.go, policy/schema.go.

Types

policy.PolicyKey

Field Type JSON Notes
Namespace string namespace Optional logical namespace (e.g. service name).
Name string name Operation name within the namespace.

policy.BudgetRef

Field Type JSON Notes
Name string name Budget registry name.
Cost int cost Units consumed per attempt (min 1).

policy.RetryPolicy

Field Type JSON Notes
MaxAttempts int max_attempts Maximum attempts per call.
InitialBackoff time.Duration initial_backoff Starting backoff before retries.
MaxBackoff time.Duration max_backoff Upper bound for backoff delays.
BackoffMultiplier float64 backoff_multiplier Exponential backoff multiplier.
Jitter JitterKind jitter Backoff jitter strategy.
TimeoutPerAttempt time.Duration timeout_per_attempt Per-attempt timeout (0 disables).
OverallTimeout time.Duration overall_timeout Total timeout for all attempts (0 disables).
ClassifierName string classifier_name Classifier registry name.
Budget BudgetRef budget Budget gating for retry attempts.

policy.HedgePolicy

Field Type JSON Notes
Enabled bool enabled Enable hedging for this key.
MaxHedges int max_hedges Maximum additional hedged attempts.
HedgeDelay time.Duration hedge_delay Delay before spawning a hedge.
TriggerName string trigger_name Optional dynamic trigger name.
CancelOnFirstTerminal bool cancel_on_first_terminal Cancel on any terminal outcome.
Budget BudgetRef budget Budget gating for hedged attempts.

policy.CircuitPolicy

Field Type JSON Notes
Enabled bool enabled Enable circuit breaking for this key.
Threshold int threshold Consecutive failures to open the circuit.
Cooldown time.Duration cooldown Cooldown before a half-open probe.

policy.NormalizationInfo

Field Type JSON Notes
Changed bool - Whether normalization changed any field.
ChangedFields []string - Dot-delimited field paths that were changed.

policy.Metadata

Field Type JSON Notes
Source PolicySource - Policy resolution source.
Normalization NormalizationInfo - Normalization metadata.

policy.EffectivePolicy

Field Type JSON Notes
Key PolicyKey key Policy key this policy applies to.
ID string id Optional policy identifier.
Retry RetryPolicy retry Retry envelope configuration.
Hedge HedgePolicy hedge Hedging configuration.
Circuit CircuitPolicy circuit Circuit breaker configuration.
Meta Metadata - Resolution metadata (source, normalization).

Default policy values

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

JitterKind values

Name Value
JitterEqual equal
JitterFull full
JitterNone none

PolicySource values

Name Value
PolicySourceDefault default
PolicySourceLKG lkg
PolicySourceRemote remote
PolicySourceStatic static
PolicySourceUnknown unknown

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