-
Notifications
You must be signed in to change notification settings - Fork 421
RFC: Support for Modulo Range Conditions in Feature Flags #2003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Reading.. |
hey @ajwad-shaikh thank you so much for taking the time to write this RFC. I like the value it adds to a business use case. I have some initial questions for you:
Adding a label to signal we want to hear from more customers. Thanks a lot!! |
Hey @heitorlessa, thank you so much for taking out the time and reviewing the RFC. Addressing your questions below.
Thanks! |
Hey @heitorlessa @ajwad-shaikh . Awesome RFC. On one hand, i think it's really interesting idea. @ajwad-shaikh why do you think it should also be implemented at the client side and not just the server side (AppConfig)? I do like the bring your own condition though, +1 for that. |
Reading now |
The concept of modulo can be hard to grasp for people that have no math or CS background. However, to be honest, I can't think of another name, besides "remainder" which doesn't help. I think the original proposal still makes sense, as it gives you the flexibility to apply a feature flag to whatever part of the input/context. I like the UX. However, we have to be extremely spot on in the documentation for this to make sense. @ajwad-shaikh would you be interested in implementing this? |
@rubenfonseca Thanks for the review. You're right, the documentation is more important than the implementation. I realised that while I was writing this RFC. I'll make sure that the feature is documented comprehensively. |
@rubenfonseca raised a PR for this #2331 |
@ajwad-shaikh can this method work if i have non number ids? |
|
@ajwad-shaikh congratulations for the awesome work, both in the RFC and the implementation, with such attention to detail and the documentation! From the bottom of my heart, THANK YOU! |
Is this related to an existing feature request or issue?
aws-powertools/powertools-lambda#87
Which AWS Lambda Powertools utility does this relate to?
Feature flags
Summary
Add action to support modulo condition evaluations within feature flag utility.
Use case
Feature flags are instrumental in experimentation. An important aspect of product experimentation is to allow the feature to be visible to a subset of the users spectrum. This is done in most experiments using the
modulo
operator on an identifier. To experiment with 20% of the users, the feature flag should be enabled for say -0 <= user_id % 100 <= 19
. A parallel experiment could run for -20 <= user_id % 100 <= 39
Proposal
The modulo operator is a standard mathematical operator easy to implement and has varied use-cases in experimentation.
Add a new action to support modulo evaluation in the feature flag utility.
lambda a, b: b.start <= a % b.base <= b.end
Tasks
RuleActionEnum
-MODULO_RANGE
in feature_flags/schema.py_match_by_action
in feature_flags/feature_flags.pyOut of scope
Anything beyond design development and documentation of the modulo condition to be added as part of this proposal is beyond the scope.
Potential challenges
One potential challenge is the configuration of the condition.
When someone wants the feature for say, 40% of the users, the only number in their head is the number forty.
When configuring the rule, the user may simply add the number to the start of the range and this might lead to unexpected behaviour. We must communicate explicitly that the start and end range are inclusive to avoid this mistake.
A parallel thought is to introduce
size
of as a parameter instead ofend
. In that case - the condition would look like -The condition implies that the modulo of
user_id
base100
should fall within a range starting from 0 with a size of 20 for this condition to evaluate to true.Lambda expression
Validation
Dependencies and Integrations
No response
Alternative solutions
[0, 19]
instead of two variables for start and endAcknowledgment
The text was updated successfully, but these errors were encountered: