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
--- 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.