A rule or the default rule can serve a percentage rollout instead of one variation: each variation gets a weight, and each context gets one variation, the same one every time.
Weights
Weights are integers in thousandths of a percent and add up to exactly 100000: 25000 is
25%, 33333 is 33.333%. The console’s slider works in whole percents.
{
"rollout": {
"bucketBy": "targetingKey",
"weights": [
{ "variation": "true", "weight": 25000 },
{ "variation": "false", "weight": 75000 }
]
}
}Bucketing
A context’s bucket comes from the flag’s key and the bucketBy attribute, targetingKey unless
you name another. So:
- The same context gets the same variation on every evaluation and in every provider.
- Bucketing by another attribute (
companyId) rolls out by account: everyone in an account gets the same variation. - Raising a variation’s share keeps who already had it, as long as the weights stay in the same
order (the console and
ezgh flags rolloutkeep it). Going from 10% to 25% adds contexts; nobody in the first 10% loses the variation. - Flags bucket independently: being in one flag’s 10% says nothing about another’s.
- A context without the
bucketByattribute gets the first variation with a non-zero weight, and so does one whosebucketByvalue isn’t a string or an integer below 1015 (a boolean, an object, a fraction).
From the command line
For a flag with two variations, ezgh flags rollout sets the default rule: --percent goes to
true for a boolean flag, else to the flag’s first variation or --variation. A default rule
that’s already a rollout keeps its order and bucketing, and only its weights change.
ezgh flags rollout new-checkout --env production --percent 25 --comment "A quarter"
ezgh flags rollout new-checkout --env production --percent 25 --bucket-by companyId
ezgh flags rollout banner-color --env production --percent 10 --variation greenA rollout applies while the flag is on in that environment.