///|
pub fn example_plan() -> RolloutPlan {
RolloutPlan(
name="checkout-latency-canary",
salt="checkout-2026-08",
segments=[
SegmentRule(
name="pro-and-enterprise-low-risk",
include_regions=[NA, EU, APAC],
include_tiers=[Pro, Enterprise],
require_tags=["checkout"],
exclude_tags=["vip-contract"],
min_version="2.4.0",
),
SegmentRule(
name="staff-shadow",
include_tiers=[Staff, Internal],
require_tags=["staff"],
max_bucket_bp=5000,
),
],
phases=[
RolloutPhase(
name="shadow-1",
start_minute=0,
duration_minutes=30,
percent_bp=500,
mode=Shadow,
),
RolloutPhase(
name="dry-run-5",
start_minute=30,
duration_minutes=30,
percent_bp=500,
mode=DryRun,
),
RolloutPhase(
name="live-10",
start_minute=60,
duration_minutes=60,
percent_bp=1000,
mode=Live,
),
RolloutPhase(
name="live-25",
start_minute=120,
duration_minutes=60,
percent_bp=2500,
mode=Live,
),
RolloutPhase(
name="live-50",
start_minute=180,
duration_minutes=60,
percent_bp=5000,
mode=Live,
require_manual_approval=true,
),
],
budget=RiskBudget(
max_error_per_million=3500,
max_latency_p95_ms=650,
min_samples=20,
max_saturation_bp=7600,
max_blast_radius_bp=6000,
require_synthetic_pass=true,
max_dependency_failures=0,
),
owner="EJJ-ai-nb",
repository="https://github.com/EJJ-ai-nb/canaryring",
package_name="EJJ-ai-nb/canaryring",
)
}
///|
pub fn example_users() -> Array[UserProfile] {
[
UserProfile(
id="u-001",
region=NA,
tier=Pro,
version="2.4.1",
tags=["checkout"],
traffic_units=5,
),
UserProfile(
id="u-002",
region=EU,
tier=Enterprise,
version="2.5.0",
tags=["checkout"],
traffic_units=20,
),
UserProfile(
id="u-003",
region=APAC,
tier=Pro,
version="2.4.2",
tags=["checkout"],
traffic_units=6,
),
UserProfile(
id="u-004",
region=CN,
tier=Pro,
version="2.4.1",
tags=["checkout"],
traffic_units=8,
),
UserProfile(
id="u-005",
region=NA,
tier=Free,
version="2.4.1",
tags=["checkout"],
traffic_units=1,
),
UserProfile(
id="u-006",
region=EU,
tier=Staff,
version="2.6.0",
tags=["staff", "checkout"],
staff=true,
traffic_units=2,
),
UserProfile(
id="u-007",
region=NA,
tier=Enterprise,
version="2.4.1",
tags=["checkout", "vip-contract"],
traffic_units=40,
),
UserProfile(
id="u-008",
region=LATAM,
tier=Pro,
version="2.4.1",
tags=["checkout"],
traffic_units=3,
),
UserProfile(
id="u-009",
region=APAC,
tier=Enterprise,
version="2.5.2",
tags=["checkout"],
traffic_units=30,
),
UserProfile(
id="u-010",
region=NA,
tier=Internal,
version="2.7.0",
tags=["staff", "checkout"],
staff=true,
traffic_units=1,
),
UserProfile(
id="u-011",
region=MEA,
tier=Pro,
version="2.4.1",
tags=["checkout"],
traffic_units=3,
),
UserProfile(
id="u-012",
region=EU,
tier=Pro,
version="2.3.9",
tags=["checkout"],
traffic_units=4,
),
UserProfile(
id="u-013",
region=APAC,
tier=Enterprise,
version="2.4.4",
tags=["checkout"],
traffic_units=18,
),
UserProfile(
id="u-014",
region=NA,
tier=Pro,
version="2.4.3",
tags=["checkout", "beta"],
traffic_units=7,
),
UserProfile(
id="u-015",
region=EU,
tier=Enterprise,
version="2.5.1",
tags=["checkout", "beta"],
traffic_units=22,
),
UserProfile(
id="u-016",
region=OtherRegion,
tier=Pro,
version="2.4.1",
tags=["checkout"],
traffic_units=2,
),
]
}
///|
pub fn healthy_metrics() -> Array[MetricsSnapshot] {
[
MetricsSnapshot(
minute=29,
sample_count=32,
error_per_million=1000,
latency_p95_ms=420,
saturation_bp=4100,
),
MetricsSnapshot(
minute=59,
sample_count=40,
error_per_million=1200,
latency_p95_ms=430,
saturation_bp=4300,
),
MetricsSnapshot(
minute=119,
sample_count=80,
error_per_million=1400,
latency_p95_ms=450,
saturation_bp=4700,
),
MetricsSnapshot(
minute=179,
sample_count=120,
error_per_million=1800,
latency_p95_ms=480,
saturation_bp=5200,
),
MetricsSnapshot(
minute=239,
sample_count=200,
error_per_million=2200,
latency_p95_ms=520,
saturation_bp=6100,
),
]
}
///|
pub fn failing_metrics() -> Array[MetricsSnapshot] {
[
MetricsSnapshot(
minute=29,
sample_count=32,
error_per_million=1000,
latency_p95_ms=420,
saturation_bp=4100,
),
MetricsSnapshot(
minute=59,
sample_count=40,
error_per_million=1200,
latency_p95_ms=430,
saturation_bp=4300,
),
MetricsSnapshot(
minute=119,
sample_count=80,
error_per_million=9000,
latency_p95_ms=900,
saturation_bp=8600,
synthetic_pass=false,
dependency_failures=1,
),
]
}