Add support for determining Switchboard buckets locally

RESOLVED FIXED in Firefox 43

Status

()

Firefox for Android
General
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: mfinkle, Assigned: mfinkle)

Tracking

unspecified
Firefox 43
Points:
---

Firefox Tracking Flags

(firefox43 fixed)

Details

Attachments

(1 attachment)

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.
Created attachment 8656374 [details] [diff] [review]
switchboard-buckets v0.1

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
Last Resolved: 3 years ago
status-firefox43: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
You need to log in before you can comment on or make changes to this bug.