summaryrefslogtreecommitdiffstats
path: root/toolkit/components/normandy/docs/data-collection.rst
blob: a2a2afb5a999b01a687a842a5c2cd69f76ec75cb (plain)
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
Data Collection
===============
This document describes the types of data that Normandy collects.

Uptake
------
Normandy monitors the execution of recipes and reports to
:ref:`telemetry` the amount of successful and failed runs. This data
is reported using :ref:`telemetry/collection/uptake` under the
``normandy`` namespace.

Runner Status
^^^^^^^^^^^^^
Once per-fetch and execution of recipes, one of the following statuses is
reported under the key ``normandy/runner``:

.. data:: RUNNER_SUCCESS

   :Telemetry value: success

   The operation completed successfully. Individual failures with actions and
   recipes may have been reported separately.

.. data:: RUNNER_SERVER_ERROR

   :Telemetry value: server_error

   The data returned by the server when fetching the recipe is invalid in some
   way.

Action Status
^^^^^^^^^^^^^
For each action available from the Normandy service, one of the
following statuses is reported under the key
``normandy/action/<action name>``:

.. data:: ACTION_NETWORK_ERROR

   :Telemetry value: network_error

   There was a network-related error while fetching actions

.. data:: ACTION_PRE_EXECUTION_ERROR

   :Telemetry value: custom_1_error

   There was an error while running the pre-execution hook for the action.

.. data:: ACTION_POST_EXECUTION_ERROR

   :Telemetry value: custom_2_error

   There was an error while running the post-execution hook for the action.

.. data:: ACTION_SERVER_ERROR

   :Telemetry value: server_error

   The data returned by the server when fetching the action is invalid in some
   way.

.. data:: ACTION_SUCCESS

   :Telemetry value: success

   The operation completed successfully. Individual failures with recipes may
   be reported separately.

Recipe Status
^^^^^^^^^^^^^
For each recipe that is fetched and executed, one of the following statuses is
reported under the key ``normandy/recipe/<recipe id>``:

.. data:: RECIPE_ACTION_DISABLED

   :Telemetry value: custom_1_error

   The action for this recipe failed in some way and was disabled, so the recipe
   could not be executed.

.. data:: RECIPE_DIDNT_MATCH_FILTER

   :Telemetry value: backoff

   The recipe included a Jexl filter that the client did not match, so
   the recipe was not executed.

.. data:: RECIPE_EXECUTION_ERROR

   :Telemetry value: apply_error

   An error occurred while executing the recipe.

.. data:: RECIPE_FILTER_BROKEN

   :Telemetry value: content_error

   An error occurred while evaluating the Jexl filter for this
   recipe. Sometimes this represents a bug in the Jexl filter
   parser/evaluator, such as in `bug 1477156
   <https://bugzilla.mozilla.org/show_bug.cgi?id=1477156>`_, or it can
   represent an error fetching some data that a Jexl recipe needs such
   as `bug 1447804
   <https://bugzilla.mozilla.org/show_bug.cgi?id=1447804>`_.

.. data:: RECIPE_INVALID_ACTION

   :Telemetry value: download_error

   The action specified by the recipe was invalid and it could not be executed.

.. data:: RECIPE_SUCCESS

   :Telemetry value: success

   The recipe was executed successfully.

.. data:: RECIPE_SIGNATURE_INVALID

   :Telemetry value: signature_error

   Normandy failed to verify the signature of the recipe.


Additionally, Normandy reports a :ref:`keyed scalar <Scalars>` to measure recipe
freshness. This scalar is called ``normandy.recipe_freshness``, and it
corresponds to the ``last_modified`` date of each recipe (using its ID
as the key), reported as seconds since 1970 in UTC.


Enrollment
-----------
Normandy records enrollment and unenrollment of users into studies, and
records that data using :ref:`Telemetry Events <eventtelemetry>`. All data is stored in the
``normandy`` category.


Enrollment IDs
^^^^^^^^^^^^^^

Most Normandy telemetry carries an *enrollment ID*. These IDs are generated
when Normandy enrolls the client in a change, be it a study, rollout, or
something else. These enrollment IDs are used for the lifetime of that
change, and are only used for that change (not shared between similar
changes). Once a change ends (either via unenrollment, graduation, or another
method) the enrollment ID should not be used again.

When Telemetry upload is disabled, we must clear these enrollment IDs. This
is done by replacing existing enrollment IDs with a filler value. New changes
continue to receive a enrollment IDs as normal. The only thing that
enrollment IDs are used for Telemetry, and so generated them while Telemetry
is disabled is fine. They don't correlate to anything else, and won't be sent
anywhere.

Preference Studies
^^^^^^^^^^^^^^^^^^
Enrollment
   method
      The string ``"enroll"``
   object
      The string ``"preference_study"``
   value
      The name of the study (``recipe.arguments.slug``).
   extra
      branch
         The name of the branch the user was assigned to (example:
         ``"control"`` or ``"experiment"``).
      experimentType
         The type of preference experiment. Currently this can take
         values "exp" and "exp-highpop", the latter being for
         experiments targeting large numbers of users.
      enrollmentId
         A UUID that is unique to this users enrollment in this study. It
         will be included in all future telemetry for this user in this
         study.

Enrollment Failed
   method
      The string ``"enrollFailed"``
   object
      The string ``"preference_study"``
   value
      The slug of the study (``recipe.arguments.slug``)
   extra
      reason
         The reason for unenrollment. Possible values are:

         * ``"invalid-branch"``: The recipe specifies an invalid preference
           branch (not to be confused with the experiment branch). Valid values
           are "default" and "user".
      preferenceBranch
         If the reason was ``"invalid-branch"``, the branch that was
         specified, truncated to 80 characters.

Unenrollment
   method
      The string ``"unenroll"``.
   object
      The string ``"preference_study"``.
   value
      The name of the study (``recipe.arguments.slug``).
   extra
      didResetValue
         The string ``"true"`` if the preference was set back to its
         original value, ``"false"`` if it was left as its current
         value. This can happen when, for example, the user changes a
         preference that was involved in a user-branch study.
      reason
         The reason for unenrollment. Possible values are:

         * ``"recipe-not-seen"``: The recipe was no longer
           applicable to this client This can be because the recipe
           was disabled, or the user no longer matches the recipe's
           filter.
         * ``"unknown"``: A reason was not specified. This should be
           considered a bug.
      enrollmentId
         The ID that was generated at enrollment.

Unenroll Failed
   method
      The string ``"unenrollFailed"``.
   object
      The string ``"preference_study"``.
   value
      The name of the study (``recipe.arguments.slug``)
   extra
      enrollmentId
         The ID that was generated at enrollment.
      reason
         A code describing the reason the unenroll failed. Possible values are:

         * ``"does-not-exist"``: The system attempted to unenroll a study that
           does not exist. This is a bug.
         * ``"already-unenrolled"``: The system attempted to unenroll a study
           that has already been unenrolled. This is likely a bug.
      caller
         On Nightly builds only, a string identifying the source of the requested stop.
      originalReason
         The code that would had been used for the unenrollment, had it not failed.

Experimental Preference Changed
   method
      The string ``"expPrefChanged"``
   object
      The string ``"preference_study"``.
   value
      The name of the study (``recipe.arguments.slug``)
   extra
      enrollmentId
         The ID that was generated at enrollment.
      preferenceName
         The name of the preference that changed. Note that the value of the
         preference (old or new) is not given.
      reason
         A code describing the reason that Normandy detected the preference
         change. Possible values are:

         * ``"atEnroll"``: The preferences already had user value when the
           experiment started.
         * ``"sideload"``: A preference was changed while Normandy's observers
           weren't active, likely while the browser was shut down.
         * ``"observer"``: The preference was observed to change by Normandy at
           runtime.

Preference Rollouts
^^^^^^^^^^^^^^^^^^^
Enrollment
   Sent when a user first enrolls in a rollout.

   method
      The string ``"enroll"``
   object
      The string ``"preference_rollout"``
   value
      The slug of the rollout (``recipe.arguments.slug``)
   extra
      enrollmentId
         A UUID that is unique to this user's enrollment in this rollout. It
         will be included in all future telemetry for this user in this
         rollout.

Enroll Failed
   Sent when a user attempts to enroll in a rollout, but the enrollment process fails.

   method
      The string ``"enrollFailed"``
   object
      The string ``"preference_rollout"``
   value
      The slug of the rollout (``recipe.arguments.slug``)
   extra
      reason
         A code describing the reason the unenroll failed. Possible values are:

         * ``"invalid type"``: The preferences specified in the rollout do not
           match the preferences built in to the browser. The represents a
           misconfiguration of the preferences in the recipe on the server.
         * ``"would-be-no-op"``: All of the preference specified in the rollout
           already have the given values. This represents an error in targeting
           on the server.
         * ``"conflict"``: At least one of the preferences specified in the
           rollout is already managed by another active rollout.
      preference
         For ``reason="invalid type"``, the first preference that was invalid.
         For ``reason="conflict"``, the first preference that is conflicting.

Update
   Sent when the preferences specified in the recipe have changed, and the
   client updates the preferences of the browser to match.

   method
      The string ``"update"``
   object
      The string ``"preference_rollout"``
   value
      The slug of the rollout (``recipe.arguments.slug``)
   extra
      previousState
         The state the rollout was in before this update (such as ``"active"`` or ``"graduated"``).
      enrollmentId
         The ID that was generated at enrollment.

Graduation
   Sent when Normandy determines that further intervention is no longer
   needed for this rollout. After this point, Normandy will stop making
   changes to the browser for this rollout, unless the rollout recipe changes
   to specify preferences different than the built-in.

   method
      The string ``"graduate"``
   object
      The string ``"preference_rollout"``
   value
      The slug of the rollout (``recipe.arguments.slug``)
   extra
      reason
         A code describing the reason for the graduation. Possible values are:

         * ``"all-prefs-match"``: All preferences specified in the rollout now
           have built-in values that match the rollouts values.
           ``"in-graduation-set"``: The browser has changed versions (usually
           updated) to one that specifies this rollout no longer applies and
           should be graduated regardless of the built-in preference values.
           This behavior is controlled by the constant
           ``PreferenceRollouts.GRADUATION_SET``.
      enrollmentId
         The ID that was generated at enrollment.

Add-on Studies
^^^^^^^^^^^^^^
Enrollment
   method
      The string ``"enroll"``
   object
      The string ``"addon_study"``
   value
      The name of the study (``recipe.arguments.name``).
   extra
      addonId
         The add-on's ID (example: ``"feature-study@shield.mozilla.com"``).
      addonVersion
         The add-on's version (example: ``"1.2.3"``).
      enrollmentId
         A UUID that is unique to this users enrollment in this study. It
         will be included in all future telemetry for this user in this
         study.

Enroll Failure
   method
      The string ``"enrollFailed"``
   object
      The string ``"addon_study"``
   value
      The name of the study (``recipe.arguments.name``).
   reason
      A string containing the filename and line number of the code
      that failed, and the name of the error thrown. This information
      is purposely limited to avoid leaking personally identifiable
      information. This should be considered a bug.

Update
   method
      The string ``"update"``,
   object
      The string ``"addon_study"``,
   value
      The name of the study (``recipe.arguments.name``).
   extra
      addonId
         The add-on's ID (example: ``"feature-study@shield.mozilla.com"``).
      addonVersion
         The add-on's version (example: ``"1.2.3"``).
      enrollmentId
         The ID that was generated at enrollment.

Update Failure
   method
      The string ``"updateFailed"``
   object
      The string ``"addon_study"``
   value
      The name of the study (``recipe.arguments.name``).
   extra
      reason
         A string containing the filename and line number of the code
         that failed, and the name of the error thrown. This information
         is purposely limited to avoid leaking personally identifiable
         information. This should be considered a bug.
      enrollmentId
         The ID that was generated at enrollment.

Unenrollment
   method
      The string ``"unenroll"``.
   object
      The string ``"addon_study"``.
   value
      The name of the study (``recipe.arguments.name``).
   extra
      addonId
         The add-on's ID (example: ``"feature-study@shield.mozilla.com"``).
      addonVersion
         The add-on's version (example: ``"1.2.3"``).
      reason
         The reason for unenrollment. Possible values are:

         * ``"install-failure"``: The add-on failed to install.
         * ``"individual-opt-out"``: The user opted-out of this
           particular study.
         * ``"general-opt-out"``: The user opted-out of studies in
           general.
         * ``"recipe-not-seen"``: The recipe was no longer applicable
           to this client. This can be because the recipe was
           disabled, or the user no longer matches the recipe's
           filter.
         * ``"uninstalled"``: The study's add-on as uninstalled by some
           mechanism. For example, this could be a user action or the
           add-on self-uninstalling.
         * ``"uninstalled-sideload"``: The study's add-on was
           uninstalled while Normandy was inactive. This could be that
           the add-on is no longer compatible, or was manually removed
           from a profile.
         * ``"unknown"``: A reason was not specified. This should be
           considered a bug.
      enrollmentId
         The ID that was generated at enrollment.