Feature flags are the greatest thing in the world and when we built them for ourselves at Ratelim.it we decided to make the same APIs we use internally available to all.
Feature flags can be created and controlled from within the Ratelim.it UI. Each feature flag can be set to anywhere from 0 to 100% on.
Additionally each feature flag can have an array of whitelisted tokens. When you call
feature_is_on_for? you can pass in
a token as well as additional attributes and if they match they will have the feature turned on.
limiter = RateLimit::Limiter.new(apikey: "ACCT_ID|APIKEY") if @limiter.feature_is_on?("MyFeatures::V2Interface") # if MyFeatures::V2Interface is at 100% ungated if @limiter.feature_is_on_for?("MyFeatures::BetaGroup", "myuserid", attributes: ["team:team1"]) # if myuserid is whitelisted # or team:team1 is whitelisted # or MyFeatures::BetaGroup is ungated to a percent of people and "myuserid" hashes into that percent do_the_thing end end
ApiClient apiClient = new ApiClient.Builder() .build(); if apiClient.featureIsOnFor("MyFeatures::V2Interface") // if MyFeatures::V2Interface is at 100% ungated if apiClient.featureIsOnFor("MyFeatures::BetaGroup", Optional.of("myuserid"), Lists.newArrayList("team:team1", "level:pro")) // if myuserid is whitelisted // or team:team1 is whitelisted // or MyFeatures::BetaGroup is ungated to a percent of people and "myuserid" hashes into that percent do_the_thing end end
It's highly recommended to configure your FeatureFlag caching. See Configuration for documentation on setting up a cache as well as an in_process cache.
For Java you will also be able to control
FeatureFlagInProcessCacheSecs which can help
you tune the background fetching of new FeatureFlag values.
Next read about Stats & Metrics