Overview
This developer guide will assist you in configuring your server-side Ruby platform for Feature Flags using the Mixpanel Ruby SDK. Feature Flags allow you to control the rollout of your features, conduct A/B testing, and manage application behavior without deploying new code.
Prerequisites
Before implementing Feature Flags, ensure:
Flag Evaluation Scenarios
There are two scenarios available for using the Ruby SDK for feature flagging: Local Evaluation and Remote Evaluation.
For local evaluation, the SDK will poll Mixpanel servers for feature flag configurations. Assignment of user contexts to variants will be done locally within the SDK. This mode is recommended for low latency since there is no network call made at assignment time.
For remote evaluation, the SDK will make a network call to Mixpanel servers at assignment time. This mode is recommended for use cases where you want to leverage Mixpanel cohorts for user targeting or sticky variants for persistent variant assignments.
In either case there is also the capability to evaluate all flags for a given user context at once, to avoid needing to make multiple calls to get individual flag variants for the same user. This is particularly useful for remote evaluation to avoid incurring additional network calls.
Local Evaluation
Targeting by Mixpanel cohorts and sticky variants are not supported in Local Evaluation mode.
-
The SDK is configured with a
local_flags_config hash that specifies parameters:
api_host - If your project is in the EU/IN region, this should be set to route to api-eu.mixpanel.com/api-in.mixpanel.com respectively.
enable_polling - This should be set to true to enable polling for new flag configurations.
polling_interval_in_seconds - This is the interval in seconds at which the SDK will poll Mixpanel servers for feature flag configurations.
-
The SDK will continue to poll for the lifetime of the SDK instance or until stopped.
Remote Evaluation
- The SDK is configured with a
remote_flags_config hash to use remote evaluation.
Get a specific variant
Evaluate all flags at once
Below is a remote evaluation sample of evaluating all flags for a given user context at once.