1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
# [Android Components](../../../README.md) > Service > Nimbus
A wrapper for the Nimbus SDK.
Contents:
- [Usage](#usage)
## Usage
### Setting up the dependency
Use Gradle to download the library from [maven.mozilla.org](https://maven.mozilla.org/) ([Setup repository](../../../README.md#maven-repository)):
```Groovy
implementation "org.mozilla.components:service-nimbus:{latest-version}"
```
### Initializing the Experiments library
**TODO**
### Updating of experiments
**TODO**
### Checking if a user is part of an experiment
**TODO**
## Testing Nimbus
This section contains information about the Kinto and UI schemas needed to set up and run experiments on the "Dev" Kinto instance located at https://kinto.dev.mozaws.net.
**NOTE** The dev server instance requires LDAP authorization, but does not require connection to the internal Mozilla VPN.
## Where to add the Kinto and UI schemas
For testing purposes, create a collection with an id of `nimbus-mobile-experiments` in the `main` bucket on the [Kinto dev server](https://kinto.dev.mozaws.net/v1/admin/).
### JSON Schema
```JSON
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://mozilla.org/example.json",
"type": "object",
"title": "Nimbus Schema",
"description": "This is the description of the current Nimbus experiment schema, which can be found at https://github.com/mozilla/nimbus-shared",
"default": {},
"examples": [
{
"slug": "secure-gold",
"endDate": null,
"branches": [
{
"slug": "control",
"ratio": 1
},
{
"slug": "treatment",
"ratio": 1
}
],
"probeSets": [],
"startDate": null,
"application": "org.mozilla.fenix",
"bucketConfig": {
"count": 100,
"start": 0,
"total": 10000,
"namespace": "secure-gold",
"randomizationUnit": "nimbus_id"
},
"userFacingName": "Diagnostic test experiment",
"referenceBranch": "control",
"isEnrollmentPaused": false,
"proposedEnrollment": 7,
"userFacingDescription": "This is a test experiment for diagnostic purposes.",
"id": "secure-gold"
}
],
"required": [
"slug",
"branches",
"application",
"bucketConfig",
"userFacingName",
"referenceBranch",
"isEnrollmentPaused",
"proposedEnrollment",
"userFacingDescription",
"id"
],
"properties": {
"slug": {
"$id": "#/properties/slug",
"type": "string",
"title": "Slug",
"description": "The slug is the unique identifier for the experiment.",
"default": "",
"examples": ["fenix-search-widget-experiment"]
},
"endDate": {
"$id": "#/properties/endDate",
"type": ["string", "null"],
"format": "date-time",
"title": "End Date",
"description": "This is the date that the experiment will end.",
"default": null,
"examples": [null]
},
"branches": {
"$id": "#/properties/branches",
"type": "array",
"title": "Branches",
"description": "Branches relate to the specific treatments to be applied for the experiment.",
"default": [],
"examples": [
[
{
"slug": "control",
"ratio": 1
},
{
"slug": "treatment",
"ratio": 1
}
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/branches/items",
"anyOf": [
{
"$id": "#/properties/branches/items/anyOf/0",
"type": "object",
"title": "Branch Items",
"description": "Each branch has a slug, or name, and a ratio that weights selection into that branch",
"default": {},
"examples": [
{
"slug": "control",
"ratio": 1
}
],
"required": ["slug", "ratio"],
"properties": {
"slug": {
"$id": "#/properties/branches/items/anyOf/0/properties/slug",
"type": "string",
"title": "Branch Slug",
"description": "The branch slug is the unique name of the branch, within this experiment.",
"default": "control",
"examples": ["control"]
},
"ratio": {
"$id": "#/properties/branches/items/anyOf/0/properties/ratio",
"type": "integer",
"title": "Branch Ratio",
"description": "This is the weighting of the branch for branch selection.",
"default": 1,
"examples": [1]
}
},
"additionalProperties": true
}
]
}
},
"probeSets": {
"$id": "#/properties/probeSets",
"type": "array",
"title": "Probe Sets",
"description": "Currently unimplemented/used",
"default": [],
"examples": [[]],
"additionalItems": true,
"items": {
"$id": "#/properties/probeSets/items"
}
},
"startDate": {
"$id": "#/properties/startDate",
"type": ["string", "null"],
"format": "date-time",
"title": "Start Date",
"description": "The date that the experiment will start",
"default": null,
"examples": [null]
},
"application": {
"$id": "#/properties/application",
"type": "string",
"title": "Application",
"description": "This is the application to target",
"default": "",
"examples": [
"org.mozilla.fenix",
"org.mozilla.firefox",
"org.mozilla.ios.firefox"
]
},
"bucketConfig": {
"$id": "#/properties/bucketConfig",
"type": "object",
"title": "Bucket Configuration",
"description": "This is the configuration of the bucketing for determining the experiment sample size",
"default": {},
"examples": [
{
"count": 2000,
"start": 0,
"total": 10000,
"namespace": "performance-experiments",
"randomizationUnit": "nimbus_id"
}
],
"required": ["count", "start", "total", "namespace", "randomizationUnit"],
"properties": {
"count": {
"$id": "#/properties/bucketConfig/properties/count",
"type": "integer",
"title": "Count",
"description": "The total count of buckets to assign to be eligible to enroll in the experiment.",
"default": 0,
"examples": [2000]
},
"start": {
"$id": "#/properties/bucketConfig/properties/start",
"type": "integer",
"title": "Starting Bucket",
"description": "This is the bucket that the count of buckets will start from.",
"default": 0,
"examples": [0]
},
"total": {
"$id": "#/properties/bucketConfig/properties/total",
"type": "integer",
"title": "Total Buckets",
"description": "This is the total number of buckets to divide the population into for enrollment purposes.",
"default": 10000,
"examples": [10000]
},
"namespace": {
"$id": "#/properties/bucketConfig/properties/namespace",
"type": "string",
"title": "Namespace",
"description": "This is the bucket namespace and should always match the experiment slug",
"default": "",
"examples": ["secure-gold"]
},
"randomizationUnit": {
"$id": "#/properties/bucketConfig/properties/randomizationUnit",
"type": "string",
"title": "Randomization Unit",
"description": "This is the id to use for randomization for the purpose of bucketing. Currently only nimbus_id implemented.",
"default": "nimbus_id",
"examples": ["nimbus_id"]
}
},
"additionalProperties": true
},
"userFacingName": {
"$id": "#/properties/userFacingName",
"type": "string",
"title": "User Facing Name",
"description": "The user-facing name of the experiment.",
"default": "",
"examples": ["Diagnostic test experiment"]
},
"referenceBranch": {
"$id": "#/properties/referenceBranch",
"type": "string",
"title": "Reference Branch",
"description": "Not currently implemented, do not change default",
"default": "control",
"examples": ["control"]
},
"isEnrollmentPaused": {
"$id": "#/properties/isEnrollmentPaused",
"type": "boolean",
"title": "Enrollment Paused",
"description": "True if the enrollment is paused, false if enrollment is active.",
"default": false,
"examples": [false]
},
"proposedEnrollment": {
"$id": "#/properties/proposedEnrollment",
"type": "integer",
"title": "Proposed Enrollment",
"description": "The length in days that enrollment is proposed.",
"default": 7,
"examples": [7]
},
"userFacingDescription": {
"$id": "#/properties/userFacingDescription",
"type": "string",
"title": "User Facing Description",
"description": "This is the description of the experiment that would be presented to the user.",
"default": "",
"examples": ["This is a test experiment for diagnostic purposes."]
},
"id": {
"$id": "#/properties/id",
"type": "string",
"title": "ID",
"description": "An analog of the slug? Not sure, make this match slug...",
"default": "",
"examples": ["secure-gold"]
}
},
"additionalProperties": true
}
```
## UI Schema
```JSON
{
"ui:order": [
"slug",
"userFacingName",
"userFacingDescription",
"application",
"startDate",
"endDate",
"bucketConfig",
"branches",
"referenceBranch",
"isEnrollmentPaused",
"proposedEnrollment",
"id",
"probeSets"
],
"userFacingDescription": {
"ui:widget": "textarea"
},
"bucketConfig": {
"ui:order": ["start", "count", "total", "namespace", "randomizationUnit"]
},
"branches": {
"ui:order": ["slug", "ratio"]
}
}
```
## License
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/
|