Skip to content

CanaryEvaluator

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Pure decision logic that evaluates a CanaryPolicy against the current results of the canary and control arms.

public static class CanaryEvaluator

objectCanaryEvaluator

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

It does not call a database or model. CanaryEvaluator.Evaluate operates only on already collected ExperimentVariantResult data. Data collection is the responsibility of CanaryEvaluationService. This separation has the same reason as ExperimentAssignmentResolver.SelectVariant: tests run without a database.

This class is public because GET /api/experiments/{name}/canary in AgentPrism.AspNetCore calculates the “latest evaluation” live with this method. This has the same reason as public ExperimentAssignmentResolver.

Evaluate(CanaryPolicy, IReadOnlyList<ExperimentVariantResult>, DateTimeOffset)

Section titled “ Evaluate(CanaryPolicy, IReadOnlyList<ExperimentVariantResult>, DateTimeOffset)”

Evaluates the canary policy against the current results of the canary and control arms.

public static CanaryEvaluation Evaluate(CanaryPolicy policy, IReadOnlyList<ExperimentVariantResult> results, DateTimeOffset now)

policy CanaryPolicy

The canary policy.

results IReadOnlyList<ExperimentVariantResult>

The current results for all experiment arms.

now DateTimeOffset

The evaluation time in UTC.

CanaryEvaluation

The evaluation result.