Bug 1462725 - Dupe 'search' event probe under 'savant' category; r=rhelmer draft
authorBianca Danforth <bdanforth@mozilla.com>
Wed, 23 May 2018 07:19:12 -0700
changeset 803320 49e28f5799e12e8ecf963473717efa43161fcba0
parent 803319 04e7182ed09a4fb2139859687cb48bd43de6446c
child 803321 4fbcdc0e445b856ae79b6d19ee13e80505ca42ca
push id112069
push userbdanforth@mozilla.com
push dateSun, 03 Jun 2018 04:54:10 +0000
reviewersrhelmer
bugs1462725
milestone62.0a1
Bug 1462725 - Dupe 'search' event probe under 'savant' category; r=rhelmer The duplication is so that this study’s use of the probe does not affect and is not affected by other uses of the probe. MozReview-Commit-ID: ILYu2izhMDB
browser/modules/BrowserUsageTelemetry.jsm
browser/modules/ShieldStudySavant.jsm
toolkit/components/telemetry/Events.yaml
--- a/browser/modules/BrowserUsageTelemetry.jsm
+++ b/browser/modules/BrowserUsageTelemetry.jsm
@@ -434,16 +434,19 @@ let BrowserUsageTelemetry = {
   },
 
   _recordSearch(engine, source, action = null) {
     let scalarKey = action ? "search_" + action : "search";
     Services.telemetry.keyedScalarAdd("browser.engagement.navigation." + source,
                                       scalarKey, 1);
     Services.telemetry.recordEvent("navigation", "search", source, action,
                                    { engine: getSearchEngineId(engine) });
+    Services.telemetry.recordEvent("savant", "search", source, action,
+                                   { subcategory: "navigation",
+                                   engine: getSearchEngineId(engine) });
   },
 
   _handleSearchAction(engine, source, details) {
     switch (source) {
       case "urlbar":
       case "oneoff-urlbar":
       case "searchbar":
       case "oneoff-searchbar":
--- a/browser/modules/ShieldStudySavant.jsm
+++ b/browser/modules/ShieldStudySavant.jsm
@@ -102,22 +102,22 @@ class TelemetryEvents {
   }
 
   sendEvent(method, object, value, extra) {
     Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, method, object, value, extra);
   }
 
   enableCollection() {
     log.debug("Study has been enabled; turning ON data collection.");
-    // Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, true);
+    Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, true);
   }
 
   disableCollection() {
     log.debug("Study has been disabled; turning OFF data collection.");
-    // Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, false);
+    Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, false);
   }
 
   // Returns the first 10 characters of a hash of the telemetry client ID and addon ID
   // Reference: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
   async getFlowID(str) {
     log.debug(`Hashing string, ${ str }, with telemetry client ID, ${ this.TELEMETRY_CLIENT_ID }`);
     const saltedStr = `${ str }${ this.TELEMETRY_CLIENT_ID }`;
     const messageBuffer = new TextEncoder("utf-8").encode(saltedStr);
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -80,16 +80,38 @@ navigation:
     bug_numbers: [1316281]
     notification_emails:
       - "past@mozilla.com"
       - "dzeber@mozilla.com"
     expiry_version: "65"
     extra_keys:
       engine: The id of the search engine used.
 
+# This category contains event entries used for the Savant Shield study.
+savant:
+  # Mostly a dupe of "search" event from "navigation" category to ensure only Savant
+  # code enables/disables it.
+  search:
+    objects: ["about_home", "about_newtab", "contextmenu", "oneoff",
+              "suggestion", "alias", "enter", "searchbar", "urlbar"]
+    release_channel_collection: opt-out
+    record_in_processes: ["main"]
+    description: >
+      This is recorded on each search navigation.
+      The value field records the action used to trigger the search:
+        "enter", "oneoff", "suggestion", "alias", null (for contextmenu)
+    bug_numbers: [1316281, 1457226]
+    notification_emails:
+      - "bdanforth@mozilla.com"
+      - "shong@mozilla.com"
+    expiry_version: "65"
+    extra_keys:
+      subcategory: The broad event category for this probe. E.g. navigation
+      engine: The id of the search engine used.
+
 # This category contains event entries used for Telemetry tests.
 # They will not be sent out with any pings.
 telemetry.test:
   test:
     methods: ["test1", "test2"]
     objects: ["object1", "object2"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]