1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Added docs about provided activation strategies.

This commit is contained in:
Ivar 2017-02-11 11:39:47 +01:00 committed by Ivar Conradi Østhus
parent 4a989c169a
commit dc9b0109f5
2 changed files with 67 additions and 11 deletions

View File

@ -1,14 +1,48 @@
# Activation Strategies
Activation strategies is a crutial part of Unleash.
It is powerful to be able to turn a feature on and off instantaneously, without redeploying the application. The next level of control comes when you are able to enable a feature for specific users or enable it for a small subset of the users. We achieve this level of control with the help of activation strategies. The simplest strategy is the “default” strategy, which basically means that the feature should be enabled to everyone.
TODO!
- Definition lives in unleash-server
- Implementation lives in the client implementations
- Configuration is assiated with a feature toggle
- Document common strategies, and how to implement them
- gradual rollout (sticky vs. random)
- active for user with id
- active for host
- active for remote host
- totally custom
The definition of an activation strategy lives in the Unleash API and can be created via the Unleash UI. The implementation of activation strategies lives in the various client implementations.
Unleash comes with a few common activation strategies. Some of them requires the client to provide the [unleash-context](./unleash-context.md), which gives necessary context for unleash.
## default
Is the simples activation strategies and basically means "active for everyone".
## userWithId
Active for users with a userId defined in the userIds-list. Typically I want to enable a new feature only for myself in production, before I enable it of everyone else. To achieve this we can use the “UserWithIdStrategy”. This strategy allows you to specify a list of specific user ids that you want to expose the new feature for. (A user id may of course be an email if that is more appropriate in your system.)
**Parameters**
- userIds - *List of user ids you want the feature toggle should be enabled for*
## gradualRolloutUserId
Gradually activate feature toggle for logged in users. Stickiness based on user id. ers. This strategy guarantees that the same user gets the same experience every time, across devices. It also guarantees that a user which is among the first 10% will also be among 20% roll-out degree. Thus we ensures that users gets the same experience, even if we gradually increase the number of users we expose the feature to. To achieve this we use a clever hash-algorithm where we normalize the user-id to a number between 1 and 100.
**Parameters**
- percentage - *The percentage (0-100) you want to enable to feature toggle for.*
- groupId - *Used to define a activation groups, which allows you to correlate across feature toggles.*
## gradualRolloutSessionId
Gradually activate feature toggle. Stickiness based on session id. It is almost identical to the gradualRolloutUserId-strategy, with the exception that it works on session ids. This makes it possible to target all users (not just logged in users), guaranteeing that a user will get the same experience within a session. But might get different experience in different sessions.
**Parameters**
- percentage - *The percentage (0-100) you want to enable to feature toggle for.*
- groupId - *Used to define a activation groups, which allows you to correlate across feature toggles.*
## gradualRolloutRandom
Randomly activate the feature toggle. No stickiness. We have found this rollout strategy very useful in some scenarios, especially when we are enabling a feature which is not visible to the user. It is also the strategy we use to sample metrics and error reports.
**Parameters**
- percentage - *The percentage (0-100) you want to enable to feature toggle for.*
## remoteAddress
Active for remote addresses defined in the IPs list. We sometimes use this strategy to enable a feature only for IP's in our office network.
**Parameters**
- IPS - *List of IPs to enable the feature for.*
## applicationHostname
Active for client instances with a hostName in the hostNames-list.
**Parameters**
- hostNames - *List of hostnames to enable the feature toggle for.*

22
docs/unleash-context.md Normal file
View File

@ -0,0 +1,22 @@
# Unleash Context
In order to standardize a few activation strategies we also needed to
standardize a unleash context, which contains some fields that varies
per requests, needed to implement the activation strategies.
The unleash context is defined by these fields:
- userId: String,
- sessionId: String,
- remoteAddress: String,
- properties: Map<String, String>
All fields are optional, but if they are not set you will not be able to use
certain activation strategies.
E.g. the userWithId-strategy obviously depends on the userId field.
The properties field is more generic and can be used to probide more abritary
data to the strategies. A common usage is to add more metadata, e.g. that the
current user is a beta user, and thus the betaUser-strategy will use this info
in it's implementation.