1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5"use strict";
6
7ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
8
9ChromeUtils.defineModuleGetter(
10  this, "UptakeTelemetry", "resource://services-common/uptake-telemetry.js");
11
12var EXPORTED_SYMBOLS = ["Uptake"];
13
14const SOURCE_PREFIX = "normandy";
15
16var Uptake = {
17  // Action uptake
18  ACTION_NETWORK_ERROR: UptakeTelemetry.STATUS.NETWORK_ERROR,
19  ACTION_PRE_EXECUTION_ERROR: UptakeTelemetry.STATUS.CUSTOM_1_ERROR,
20  ACTION_POST_EXECUTION_ERROR: UptakeTelemetry.STATUS.CUSTOM_2_ERROR,
21  ACTION_SERVER_ERROR: UptakeTelemetry.STATUS.SERVER_ERROR,
22  ACTION_SUCCESS: UptakeTelemetry.STATUS.SUCCESS,
23
24  // Per-recipe uptake
25  RECIPE_ACTION_DISABLED: UptakeTelemetry.STATUS.CUSTOM_1_ERROR,
26  RECIPE_EXECUTION_ERROR: UptakeTelemetry.STATUS.APPLY_ERROR,
27  RECIPE_INVALID_ACTION: UptakeTelemetry.STATUS.DOWNLOAD_ERROR,
28  RECIPE_SUCCESS: UptakeTelemetry.STATUS.SUCCESS,
29
30  // Uptake for the runner as a whole
31  RUNNER_INVALID_SIGNATURE: UptakeTelemetry.STATUS.SIGNATURE_ERROR,
32  RUNNER_NETWORK_ERROR: UptakeTelemetry.STATUS.NETWORK_ERROR,
33  RUNNER_SERVER_ERROR: UptakeTelemetry.STATUS.SERVER_ERROR,
34  RUNNER_SUCCESS: UptakeTelemetry.STATUS.SUCCESS,
35
36  reportRunner(status) {
37    UptakeTelemetry.report(`${SOURCE_PREFIX}/runner`, status);
38  },
39
40  reportRecipe(recipeId, status) {
41    UptakeTelemetry.report(`${SOURCE_PREFIX}/recipe/${recipeId}`, status);
42  },
43
44  reportAction(actionName, status) {
45    UptakeTelemetry.report(`${SOURCE_PREFIX}/action/${actionName}`, status);
46  },
47};
48