Bug 1455275 - Instrument deactivation of RDM and Split Console with event telemetry r=yulia
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Mon, 23 Apr 2018 13:50:53 +0100
changeset 471804 1bc7ca9eee85d511ec1ed520e67f75ee2f67342d
parent 471803 9536d401ce06feb399bf4b89c295fa3502354882
child 471805 30abe52251ba22ccd5f6b674c7c41d3a6be25963
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1455275
milestone61.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 1455275 - Instrument deactivation of RDM and Split Console with event telemetry r=yulia This bounced because I was trying to access the toolbox after the ui was destroyed, which fails in tests. I will do a try run this time to make sure there are no issues. MozReview-Commit-ID: 2iHpPLmm9lY
devtools/client/framework/toolbox.js
devtools/client/responsive.html/manager.js
toolkit/components/telemetry/Events.yaml
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1992,16 +1992,22 @@ Toolbox.prototype = {
    * @returns {Promise} a promise that resolves once the tool has been
    *          closed.
    */
   closeSplitConsole: function() {
     this._splitConsole = false;
     Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, false);
     this._refreshConsoleDisplay();
     this.component.setIsSplitConsoleActive(false);
+
+    this._telemetry.recordEvent("devtools.main", "deactivate", "split_console", null, {
+      "host": this._getTelemetryHostString(),
+      "width": Math.ceil(this.win.outerWidth / 50) * 50
+    });
+
     this.emit("split-console");
 
     if (this._lastFocusedElement) {
       this._lastFocusedElement.focus();
     }
     return promise.resolve();
   },
 
--- a/devtools/client/responsive.html/manager.js
+++ b/devtools/client/responsive.html/manager.js
@@ -141,22 +141,30 @@ const ResponsiveUIManager = exports.Resp
    *          - `menu`:     Web Developer menu item
    *          - `shortcut`: Keyboard shortcut
    *        - `reason`: String detailing the specific cause for closing
    * @return Promise
    *         Resolved (with no value) when closing is complete.
    */
   async closeIfNeeded(window, tab, options = {}) {
     if (this.isActiveForTab(tab)) {
-      let ui = this.activeTabs.get(tab);
-      let destroyed = await ui.destroy(options);
+      const ui = this.activeTabs.get(tab);
+      const destroyed = await ui.destroy(options);
       if (!destroyed) {
         // Already in the process of destroying, abort.
         return;
       }
+
+      const hostType = Services.prefs.getStringPref("devtools.toolbox.host");
+      const t = this._telemetry;
+      t.recordEvent("devtools.main", "deactivate", "responsive_design", null, {
+        "host": hostType,
+        "width": Math.ceil(window.outerWidth / 50) * 50
+      });
+
       this.activeTabs.delete(tab);
 
       if (!this.isActiveForWindow(window)) {
         this.removeMenuCheckListenerFor(window);
       }
       this.emit("off", { tab });
       await this.setMenuCheckFor(tab, window);
     }
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -223,8 +223,19 @@ devtools.main:
     notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
     record_in_processes: ["main"]
     description: User activates the responsive_design or split_console in the devtools toolbox.
     release_channel_collection: opt-out
     expiry_version: never
     extra_keys:
       host: "Toolbox host (positioning): bottom, side, window or other."
       width: Toolbox width rounded up to the nearest 50px.
+  deactivate:
+    objects: ["responsive_design", "split_console"]
+    bug_numbers: [1455275]
+    notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
+    record_in_processes: ["main"]
+    description: User deactivates the responsive_design or split_console in the devtools toolbox.
+    release_channel_collection: opt-out
+    expiry_version: never
+    extra_keys:
+      host: "Toolbox host (positioning): bottom, side, window or other."
+      width: Toolbox width rounded up to the nearest 50px.