Skip to main content

Rollouts

Using Prefab For Rollouts

So you've built a new pipeline and are hoping to slowly dial up how much traffic uses it. You've got two great ways to do that with Prefab.

One approach is to simply use dynamic config. We can use a floating point number to specify the percent of traffic we want to rollout to and then evaluate that against a random number to determine whether to run the new code.

if rand() < @config.get_float("percent-to-rollout")
do_new_pipeline
end

This approach works fine, but each evaluation of rand() will get you a different result. Sometimes this is what you want, but if you'd like the rollout to be sticky and keep server, requests, users in the new pipeline you may want to use a feature flag.

Prefab.enabled? "new-feature", { user: { tracking_id: user.tracking_id } }