Bug 1455273 - Instrument activation of RDM and Split Console with event telemetry r?yulia
Another simple one... tests will be in
bug 1456098.
MozReview-Commit-ID: LFgxlceCakC
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1972,16 +1972,20 @@ Toolbox.prototype = {
// Ensure split console is visible if console was already loaded in background
let iframe = this.webconsolePanel.querySelector(".toolbox-panel-iframe");
if (iframe) {
this.setIframeVisible(iframe, true);
}
return this.loadTool("webconsole").then(() => {
this.component.setIsSplitConsoleActive(true);
+ this._telemetry.recordEvent("devtools.main", "activate", "split_console", null, {
+ "host": this._getTelemetryHostString(),
+ "width": Math.ceil(this.win.outerWidth / 50) * 50
+ });
this.emit("split-console");
this.focusConsoleInput();
});
},
/**
* Closes the split console.
*
--- a/devtools/client/responsive.html/manager.js
+++ b/devtools/client/responsive.html/manager.js
@@ -18,29 +18,32 @@ loader.lazyRequireGetter(this, "swapToIn
loader.lazyRequireGetter(this, "startup", "devtools/client/responsive.html/utils/window", true);
loader.lazyRequireGetter(this, "message", "devtools/client/responsive.html/utils/message");
loader.lazyRequireGetter(this, "showNotification", "devtools/client/responsive.html/utils/notification", true);
loader.lazyRequireGetter(this, "l10n", "devtools/client/responsive.html/utils/l10n");
loader.lazyRequireGetter(this, "EmulationFront", "devtools/shared/fronts/emulation", true);
loader.lazyRequireGetter(this, "PriorityLevels", "devtools/client/shared/components/NotificationBox", true);
loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
+loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
const RELOAD_CONDITION_PREF_PREFIX = "devtools.responsive.reloadConditions.";
const RELOAD_NOTIFICATION_PREF = "devtools.responsive.reloadNotification.enabled";
function debug(msg) {
// console.log(`RDM manager: ${msg}`);
}
/**
* ResponsiveUIManager is the external API for the browser UI, etc. to use when
* opening and closing the responsive UI.
*/
const ResponsiveUIManager = exports.ResponsiveUIManager = {
+ _telemetry: new Telemetry(),
+
activeTabs: new Map(),
/**
* Toggle the responsive UI for a tab.
*
* @param window
* The main browser chrome window.
* @param tab
@@ -89,21 +92,29 @@ const ResponsiveUIManager = exports.Resp
if (tab.linkedBrowser.hasAttribute("usercontextid")) {
this.showNoContainerTabsNotification(window, tab, options);
return promise.reject(new Error("RDM not available for container tabs."));
}
if (!this.isActiveForTab(tab)) {
this.initMenuCheckListenerFor(window);
// Track whether a toolbox was opened before RDM was opened.
- let hasToolbox = !!gDevTools.getToolbox(TargetFactory.forTab(tab));
+ const toolbox = gDevTools.getToolbox(TargetFactory.forTab(tab));
+ const hostType = toolbox ? toolbox.hostType : "none";
+ const hasToolbox = !!toolbox;
if (hasToolbox) {
Services.telemetry.scalarAdd("devtools.responsive.toolbox_opened_first", 1);
}
+ const t = this._telemetry;
+ t.recordEvent("devtools.main", "activate", "responsive_design", null, {
+ "host": hostType,
+ "width": Math.ceil(window.outerWidth / 50) * 50
+ });
+
// Track opens keyed by the UI entry point used.
let { trigger } = options;
if (!trigger) {
trigger = "unknown";
}
Services.telemetry.keyedScalarAdd("devtools.responsive.open_trigger", trigger, 1);
let ui = new ResponsiveUI(window, tab);
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -212,8 +212,19 @@ devtools.main:
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.
next_panel: The name of the panel closed, webconsole, inspector, jsdebugger, styleeditor, netmonitor, storage or other.
panel_name: The name of the panel opened, webconsole, inspector, jsdebugger, styleeditor, netmonitor, storage or other
reason: debuggerStatement, breakpoint, exception, tab_switch, toolbox_show, initial_panel, toggle_settings_off, toggle_settings_on, key_shortcut, select_next_key, select_prev_key, tool_unloaded, inspect_dom, toolbox_closed, unknown etc.
+ activate:
+ objects: ["responsive_design", "split_console"]
+ bug_numbers: [1455273]
+ 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.