Closed Bug 1201384 Opened 6 years ago Closed 6 years ago

Add support for determining Switchboard buckets locally

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: mfinkle, Assigned: mfinkle)

Details

Attachments

(1 file)

Switchboard allows us to define experiments on the server by subsetting 0 to 100 buckets. A given user is placed in a bucket, determined by CRCing the UUID. The JSON configuration of the active and inactive experiments for a user is returned from the server.

This is dynamic, because we can change the bucketing for the experiments to move people in and out of certain experiments. We can also stop experiments. No client side changes required. This is great.

Except for client code that needs to run really early.It takes a few seconds to get the JSON configuration from the server. We could hard code the bucketing for an experiment in the client side for early code paths. We lose the dynamic features and any changes need to be made to the client side code.
This patch adds a public method:
boolean SwitchBoard.isInBucket(Context c, int low, int high)

And a private method:
int SwitchBoard.getUserBucket(Context c)

This matches the server side methods. I tested that for the same UUID both the server and the client will return the same bucket value. This allows us to hard code experiment configurations client side, when needed.

 if (SwitchBoard.isInBucket(context, 0, 33)) {
   // onboarding-a
 else if (SwitchBoard.isInBucket(context, 33, 66)) {
   // onboarding-b
 else {
   // onboarding-c
 }
Assignee: nobody → mark.finkle
Attachment #8656374 - Flags: review?(liuche)
Comment on attachment 8656374 [details] [diff] [review]
switchboard-buckets v0.1

Review of attachment 8656374 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/thirdparty/com/keepsafe/switchboard/SwitchBoard.java
@@ +380,5 @@
>  		return null;
>  	}
> +
> +	/**
> +		* Return the bucket number of the user. There a 100 possible buckets.

Nit: alignment and typo "are 100 possible"
Attachment #8656374 - Flags: review?(liuche) → review+
Updated alignment and fixed typo
https://hg.mozilla.org/mozilla-central/rev/d0ded395464d
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.