Bug 1456984 - Instrument inspection of shortcut combination used for toolbox opening with event telemetry r=yulia

MozReview-Commit-ID: HA6Tasq2iZu

--HG--
extra : rebase_source : c5d7ef7f574148d38a75ca14dfbf5ee82821134e
This commit is contained in:
Michael Ratcliffe 2018-05-23 13:14:25 +01:00
Родитель 206284937b
Коммит 9b4265bed3
3 изменённых файлов: 27 добавлений и 10 удалений

Просмотреть файл

@ -716,13 +716,11 @@ Toolbox.prototype = {
// Log current theme. The question we want to answer is:
// "What proportion of users use which themes?"
let currentTheme = Services.prefs.getCharPref("devtools.theme");
const currentTheme = Services.prefs.getCharPref("devtools.theme");
this.telemetry.keyedScalarAdd(CURRENT_THEME_SCALAR, currentTheme, 1);
this.telemetry.preparePendingEvent(
"devtools.main", "open", "tools", null,
["entrypoint", "first_panel", "host", "splitconsole", "width"]
);
this.telemetry.preparePendingEvent("devtools.main", "open", "tools", null,
["entrypoint", "first_panel", "host", "shortcut", "splitconsole", "width"]);
this.telemetry.addEventProperty(
"devtools.main", "open", "tools", null, "host", this._getTelemetryHostString()
);

Просмотреть файл

@ -591,7 +591,7 @@ DevToolsStartup.prototype = {
// gDevTools.showToolbox, the complete time it takes to open the toolbox.
// i.e. especially take `initDevTools` into account.
let startTime = Cu.now();
let require = this.initDevTools("KeyShortcut");
let require = this.initDevTools("KeyShortcut", key);
let { gDevToolsBrowser } = require("devtools/client/framework/devtools-browser");
gDevToolsBrowser.onKeyShortcut(window, key, startTime);
}
@ -619,14 +619,14 @@ DevToolsStartup.prototype = {
return k;
},
initDevTools: function(reason) {
initDevTools: function(reason, key = "") {
// If an entry point is fired and tools are not enabled open the installation page
if (!Services.prefs.getBoolPref(DEVTOOLS_ENABLED_PREF)) {
this.openInstallPage(reason);
return null;
}
this.sendEntryPointTelemetry(reason);
this.sendEntryPointTelemetry(reason, key);
this.initialized = true;
let { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
@ -839,11 +839,29 @@ DevToolsStartup.prototype = {
}
},
sendEntryPointTelemetry(reason) {
sendEntryPointTelemetry(reason, key = "") {
if (!reason) {
return;
}
let keys = "";
if (reason === "KeyShortcut") {
let { modifiers, shortcut } = key;
modifiers = modifiers.replace(",", "+");
if (shortcut.startsWith("VK_")) {
shortcut = shortcut.substr(3);
}
keys = `${modifiers}+${shortcut}`;
}
this.telemetry.addEventProperty(
"devtools.main", "open", "tools", null, "shortcut", keys
);
this.telemetry.addEventProperty(
"devtools.main", "open", "tools", null, "entrypoint", reason
);

Просмотреть файл

@ -196,7 +196,7 @@ telemetry.test.second:
devtools.main:
open:
objects: ["tools"]
bug_numbers: [1416024]
bug_numbers: [1416024, 1456984]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
record_in_processes: ["main"]
description: User opens devtools toolbox.
@ -208,6 +208,7 @@ devtools.main:
host: "Toolbox host (positioning): bottom, side, window or other."
splitconsole: Indicates whether the split console was open.
width: Toolbox width rounded up to the nearest 50px.
shortcut: The key combination pressed. Used only in the case that entrypoint === KeyShortcut.
close:
objects: ["tools"]
bug_numbers: [1453312]