Bug 1268424 - Collect Telemetry data about the search plugin count, data-review=bsmedberg, r=adw.
authorFlorian Quèze <florian@queze.net>
Tue, 24 May 2016 13:14:19 +0200
changeset 298282 98fc8be146c7b95bf48d19d0476797bf272e7700
parent 298281 23ff7e5ee0048a98fa8410ace003f5d6a88763ae
child 298283 bf3b012748a42d2af8406064c3466706c7d9f0c8
push id19353
push userflorian@queze.net
push dateTue, 24 May 2016 11:17:17 +0000
treeherderfx-team@bf3b012748a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1268424
milestone49.0a1
Bug 1268424 - Collect Telemetry data about the search plugin count, data-review=bsmedberg, r=adw.
toolkit/components/search/nsSearchService.js
toolkit/components/telemetry/Histograms.json
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -2734,17 +2734,17 @@ SearchService.prototype = {
 
     gInitialized = true;
     this._cacheFileJSON = null;
 
     this._initObservers.resolve(this._initRV);
 
     Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "init-complete");
     Services.telemetry.getHistogramById("SEARCH_SERVICE_INIT_SYNC").add(true);
-    this._recordEnginesWithUpdate();
+    this._recordEngineTelemetry();
 
     LOG("_syncInit end");
   },
 
   /**
    * Asynchronous implementation of the initializer.
    *
    * @returns {Promise} A promise, resolved successfully if the initialization
@@ -2777,17 +2777,17 @@ SearchService.prototype = {
         LOG("_asyncInit: failure loading engines: " + ex);
       }
       this._addObservers();
       gInitialized = true;
       this._cacheFileJSON = null;
       this._initObservers.resolve(this._initRV);
       Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "init-complete");
       Services.telemetry.getHistogramById("SEARCH_SERVICE_INIT_SYNC").add(false);
-      this._recordEnginesWithUpdate();
+      this._recordEngineTelemetry();
 
       LOG("_asyncInit: Completed _asyncInit");
     }.bind(this));
   },
 
   _metaData: { },
   setGlobalAttr(name, val) {
     this._metaData[name] = val;
@@ -3149,17 +3149,17 @@ SearchService.prototype = {
         // Due to the HTTP requests done by ensureKnownCountryCode, it's possible that
         // at this point a synchronous init has been forced by other code.
         if (!gInitialized)
           yield this._asyncLoadEngines(cache);
 
         // Typically we'll re-init as a result of a pref observer,
         // so signal to 'callers' that we're done.
         Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "init-complete");
-        this._recordEnginesWithUpdate();
+        this._recordEngineTelemetry();
         gInitialized = true;
       } catch (err) {
         LOG("Reinit failed: " + err);
         Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "reinit-failed");
       } finally {
         Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "reinit-complete");
       }
     }.bind(this));
@@ -4259,17 +4259,19 @@ SearchService.prototype = {
         uri.userPass = ""; // Avoid reporting a username or password.
         result.submissionURL = uri.spec;
       }
     }
 
     return result;
   },
 
-  _recordEnginesWithUpdate: function() {
+  _recordEngineTelemetry: function() {
+    Services.telemetry.getHistogramById("SEARCH_SERVICE_ENGINE_COUNT")
+            .add(Object.keys(this._engines).length);
     let hasUpdates = false;
     let hasIconUpdates = false;
     for (let name in this._engines) {
       let engine = this._engines[name];
       if (engine._hasUpdates) {
         hasUpdates = true;
         if (engine._iconUpdateURL) {
           hasIconUpdates = true;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5513,16 +5513,26 @@
     "description": "Time (ms) it takes to initialize the search service"
   },
   "SEARCH_SERVICE_INIT_SYNC": {
     "alert_emails": ["rvitillo@mozilla.com", "gavin@mozilla.com"],
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "search service has been initialized synchronously"
   },
+  "SEARCH_SERVICE_ENGINE_COUNT": {
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["florian@mozilla.com"],
+    "expires_in_version": "55",
+    "bug_numbers": [1268424],
+    "kind": "linear",
+    "high": 200,
+    "n_buckets": 50,
+    "description": "Recorded once per session near startup: records the search plugin count, including both built-in plugins (including the ones the user has hidden) and user-installed plugins."
+  },
   "SEARCH_SERVICE_HAS_UPDATES": {
     "alert_emails": ["florian@mozilla.com"],
     "expires_in_version": "50",
     "kind": "boolean",
     "bug_numbers": [1259510],
     "description": "Recorded once per session near startup: records true/false whether the search service has engines with update URLs.",
     "releaseChannelCollection": "opt-out"
   },