Skip to content
Latchkey

How to Do a Canary Rollout With Feature Flags

Target the flag at a small canary segment, watch metrics, then widen the audience or turn it off.

Canary releasing with flags means enabling a feature for a tiny slice of traffic first. You expand exposure only after the canary looks healthy, and revert instantly by flipping the flag off.

Steps

  • Define a canary segment (internal users or 1% of traffic).
  • Enable the flag for that segment only.
  • Monitor error rate and latency for the canary.
  • Widen the rollout or disable the flag based on the result.

Canary targeting rule

flags.yaml
flags:
  new-checkout:
    defaultVariation: false
    rules:
      - segment: canary   # internal users + 1% bucket
        variation: true

Promote after the canary passes

Terminal
# Terminal: widen once canary metrics are clean
flagctl update new-checkout --segment beta --variation true
flagctl update new-checkout --rollout 25

Gotchas

  • A canary segment too small to produce traffic tells you nothing; size it for signal.
  • Pair the canary with alerts so you catch regressions before you widen exposure.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →