-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
(feature) Support for Custom Assignment/Targeting Keys #2135
Comments
Hi @thomaspoignant! Thanks for taking this suggestion forward. Would it make sense to put As for the fallback behaviour, it would be desirable that assignment fails / returns the default rule when the bucketingKey is not found. Falling back to |
@ricardobeat Yes, it's a great idea to put the For example in this example: my-flag:
variation:
enabled: true
disabled: false
defaultRule:
percentage:
enabled: 10
disabled: 90
bucketingKey: teamId You can see that the |
I see your point, but in that case, the correct action would be to return the default (off) value for the flag. Assigning variants based on another key ( Say you want bucketing per team, with In fact, the |
In the same line of thought, when using my-flag:
bucketingKey: teamId
variation:
A: false
B: true
targeting:
- name: 'Teams in beta program'
query: key in [3338, 1337]
variation: B
defaultRule:
variation: A |
@thomaspoignant I've made a draft PR implementing this to see what it looks like, curious to hear your thoughts. I'm not sure about the naming: something like |
I would avoid to use I found it easier to understand to have something like this: my-flag:
bucketingKey: teamId
variation:
A: false
B: true
targeting:
- name: 'Teams in beta program'
query: teamId in [3338, 1337] # <-- more explicit to use the actual key from the context (and the split will still happen based on teamId)
variation: B
defaultRule:
variation: A
I kinda like
|
Description
This feature was originally asked by Ricardo Tomasi in this slack conversation.
This feature request proposes to do the percentages rollout based on another field than the targeting key.
This would allow for greater flexibility in defining target audiences for feature flags, specifically facilitating scenarios where flags need to be assigned based on attributes other than the user ID.
Current Behavior:
Currently, GO Feature Flagassign variations are based on the targetingKey by default. This presents limitations when targeting needs to be based on other attributes, like team ID.
This can cause some limitations, especially when using a client-side SDK that uses a single evaluation context to evaluate all the flags and it is not possible to change it per flags.
Note
In a percentage split the way we affect users to the variation is something like
Desired Behavior:
Dynamic Targeting Key: Introduce a new field within the feature flag configuration to allow choosing which field from the evaluation context will be used to do the variation affectation in a percentage split of the traffic.
Proposed solution
To support this feature we can add a new field in the rules called
bucketingKey
that will allow to specify which key from the evaluation context will be used to split the traffic.It will look like this:
Now when evaluating a flag with an evaluation context looking like this:
Instead of affecting like this :
We will do
bucketingKey
is not available in the evaluation context, we will use thetargetingKey
as a fallback method to affect the right variation.The text was updated successfully, but these errors were encountered: