Complex Targeting Rules in Feature Flags: Unleash Strategy Variants
Unleash has evolved through continuous improvement and frequent, iterative releases. Every month, we release a new version of Unleash with many improvements.
Occasionally, we release something that is a fundamental breakthrough, something that makes Unleash more adaptable and simpler at the same time. Strategy Variants is one of these moments.
With Unleash 5.5, we have made a significant breakthrough in how we handle variants.
For those familiar with Domain-Driven Design, this is a domain breakthrough. Domain-driven design is software design approach and a set of techniques that we find useful at Unleash. We’ve mentioned it before, including in Building your own feature flag platform might be a mistake.
Feature Flag Variants
In the beginning, Unleash started with feature flag variants that allow for assigning distinct values to different users.
So, if a feature was active for a group of users, you could designate a percentage of those users to receive variant A, variant B, and so on.
This can be seen as a two-tiered approach: first, determining which users have the feature activated and subsequently deciding on the variant to present to each user. Such a system paves the way for A/B/n testing.
For instance, imagine running a test on a website’s headline: 50% of users could be shown “titleA” while the other 50% see “titleB”. This allows for direct comparison of user engagement or other metrics between the two titles, helping to determine which is more effective.
Environment-specific Feature Variants
As our platform evolved, some users expressed the desire to test different variants in both development and production environments. In response, Unleash introduced environment-specific feature variants.
To streamline the process for users who maintain consistent variants across environments, we implemented a feature that facilitates the transfer of variants between environments.
Our initial variants catered to a randomized distribution, ideal for A/B/n testing. However, a growing number of users sought to implement intricate conditions in tandem with percentage distributions.
This opened the door to many complex scenarios, such as:
- Serving the ‘titleForInternalUsers’ to a predefined internal user segment.
- Presenting ‘titleForGmailUsers’ to customers with ‘@gmail.com’ email addresses (utilizing an ‘ends with’ operator).
- Dividing the remaining users equally between ‘genericTitleA’ and ‘genericTitleB’ (a percentage split).
While the obvious course might have been to incorporate these capabilities directly within variants, we opted for a different path.
We realized our feature flag activation strategies already catered to these intricate conditions, supporting constraints, advanced operators, and user segments.
Rather than individually adding these targeting options to variants, we integrated variants into strategies. As a result, every strategy now not only dictates an on/off status but also associates an on condition with a specific variant.
Implementing the new model felt inherently right from a coding perspective and also offers a more intuitive user experience.
It was a domain breakthrough event and we’re incredible proud that it was a mere 3 weeks from ideation to a production-ready solution.