CanaryPolicy
AgentPrism.Abstractions.dllDefines automatic rollback and gradual traffic-increase rules for an experiment canary variant.
public sealed record CanaryPolicy : IEquatable<CanaryPolicy>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This policy can only be defined for two-variant experiments.
CanaryPolicy.CanaryVariant is the canary and the one remaining variant is the
control. With more than two variants, proportional control-weight redistribution
could not guarantee session stability. This
constraint keeps the canary range fixed at [0, canaryWeight) and makes
the control range contiguous.
Comparison is relative. The canary rolls back when its error rate is CanaryPolicy.MaxErrorRateDelta higher than the control rate. An absolute threshold, such as “stop at a 5% error rate”, would unfairly stop a canary for an agent whose control is also unhealthy.
Constructors
Section titled “Constructors”CanaryPolicy()
Section titled “ CanaryPolicy()”public CanaryPolicy()Properties
Section titled “Properties”CanaryVariant
Section titled “ CanaryVariant”Gets the canary variant name. It must exist in the experiment Variants list.
public required string CanaryVariant { get; init; }Property Value
Section titled “Property Value”MaxErrorRateDelta
Section titled “ MaxErrorRateDelta”Gets the maximum absolute error-rate difference from the control, from 0.0 through 1.0. The canary rolls back when its rate is higher. No error-rate check runs when this value is null.
public double? MaxErrorRateDelta { get; init; }Property Value
Section titled “Property Value”MinSampleSize
Section titled “ MinSampleSize”Gets the minimum completed run count that both the canary and control variants must reach before a decision is made.
public int MinSampleSize { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”This is the same rule as
OnlineEvaluationOptions.MinSampleSize. It has the same
default of 20 and the same a threshold reacts to noise
with a small sample. Gradual increases use the same value to advance to
the next step; a second threshold property is not added.
MinScore
Section titled “ MinScore”Gets the minimum average canary score from 0 through 100. The canary rolls back below this threshold. No score check runs when this value is null.
public int? MinScore { get; init; }Property Value
Section titled “Property Value”int?
RampInterval
Section titled “ RampInterval”Gets the minimum time between steps.
public TimeSpan RampInterval { get; init; }Property Value
Section titled “Property Value”RampSteps
Section titled “ RampSteps”Gets the canary-weight steps that increase over time, for example
[5, 25, 50, 100]. An empty list disables gradual increases. The
canary weight stays at the value set through SaveAsync and only
rollback is evaluated.
public IReadOnlyList<int> RampSteps { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(CanaryPolicy?)
Section titled “ Equals(CanaryPolicy?)”public bool Equals(CanaryPolicy? other)Parameters
Section titled “Parameters”other CanaryPolicy?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(CanaryPolicy?, CanaryPolicy?)
Section titled “ operator ==(CanaryPolicy?, CanaryPolicy?)”public static bool operator ==(CanaryPolicy? left, CanaryPolicy? right)Parameters
Section titled “Parameters”left CanaryPolicy?
right CanaryPolicy?
Returns
Section titled “Returns”operator !=(CanaryPolicy?, CanaryPolicy?)
Section titled “ operator !=(CanaryPolicy?, CanaryPolicy?)”public static bool operator !=(CanaryPolicy? left, CanaryPolicy? right)Parameters
Section titled “Parameters”left CanaryPolicy?
right CanaryPolicy?