Add feature flag support for gradual rollouts #2825
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Add the ability to rollout features to users based on percentages. This PR will essentially replace our experimental features configuration with a much more granular and controlled rolled out strategy.
Note: I'll leave removing the old experimental features setting to a future PR.
Implementation
The idea is to combine the user's machine ID and the feature flag name to generate a number that can be checked against the desired rollout percentage.
With this strategy, we can guarantee that if we increase the percentage, users who already had the feature enabled will continue to do so.
From our side, the idea is to maintain a constant with the feature names and the desired rollout, so that we can gradually increase it as needed.
Automated Tests
Added tests.