Bug 1359306 - Implant telemetry probe for search r=liuche,mconley
☠☠ backed out by c1ed71da5707 ☠ ☠
authorRicky Chien <ricky060709@gmail.com>
Thu, 20 Jul 2017 18:20:00 +0800
changeset 419965 f65f933ecdce1161bed0a3ef3cdf02e4efb197be
parent 419964 282362cd36e35256d49247ad027ca8af6cf9c8af
child 419966 bc2f0aac349f6150b6ae0c9f3c93d3bbbec30ec9
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, mconley
bugs1359306
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1359306 - Implant telemetry probe for search r=liuche,mconley MozReview-Commit-ID: DoVIQbD92CA
browser/components/preferences/in-content-new/findInPage.js
toolkit/components/telemetry/Scalars.yaml
--- a/browser/components/preferences/in-content-new/findInPage.js
+++ b/browser/components/preferences/in-content-new/findInPage.js
@@ -220,16 +220,21 @@ var gSearchResultsPane = {
    *    to search for filted query in
    */
   searchFunction(event) {
     this.query = event.target.value.trim().toLowerCase();
     this.getFindSelection(window).removeAllRanges();
     this.removeAllSearchTooltips();
     this.removeAllSearchMenuitemIndicators();
 
+    // Clear telemetry request if user types very frequently.
+    if (this.telemetryTimer) {
+      clearTimeout(this.telemetryTimer);
+    }
+
     let srHeader = document.getElementById("header-searchResults");
 
     if (this.query) {
       // Showing the Search Results Tag
       gotoPref("paneSearchResults");
 
       let resultsFound = false;
 
@@ -269,16 +274,23 @@ var gSearchResultsPane = {
         let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences";
         let brandName = document.getElementById("bundleBrand").getString("brandShortName");
         // eslint-disable-next-line no-unsanitized/property
         document.getElementById("need-help").innerHTML =
           strings.getFormattedString("searchResults.needHelp2", [helpUrl, brandName]);
       } else {
         // Creating tooltips for all the instances found
         this.listSearchTooltips.forEach((anchorNode) => this.createSearchTooltip(anchorNode, this.query));
+
+        // Implant search telemetry probe after user stops typing for a while
+        if (this.query.length >= 2) {
+          this.telemetryTimer = setTimeout(() => {
+            Services.telemetry.keyedScalarAdd("preferences.search_query", this.query, 1);
+          }, 1000);
+        }
       }
     } else {
       document.getElementById("sorry-message").textContent = "";
       // Going back to General when cleared
       gotoPref("paneGeneral");
     }
   },
 
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -393,16 +393,31 @@ preferences:
       Set to true if user.js exists and was read.
     expires: "62"
     kind: boolean
     notification_emails:
       - bsmedberg@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - main
+  search_query:
+    bug_numbers:
+        - 1359306
+      description: >-
+        Each key is a search query string when user performs a search action within
+        about:preferences, and each value is the number of times that key is recorded.
+        The telemetry data will be recorded if there is a successful search result highlighted.
+      expires: "62"
+      kind: uint
+      keyed: true
+      notification_emails:
+        - chsiang@mozilla.com
+      release_channel_collection: opt-in
+      record_in_processes:
+        - main
 
 # The following section contains WebRTC nICEr scalars
 # For more info on ICE, see https://tools.ietf.org/html/rfc5245
 # For more info on STUN, see https://tools.ietf.org/html/rfc5389
 # For more info on TURN, see https://tools.ietf.org/html/rfc5766
 webrtc.nicer:
   stun_retransmits:
     bug_numbers: