Bug 1412029 - add probes to about:devtools;r=bgrins,datareview=francois

This changeset adds 3 scalars:
- devtools.aboutdevtools.opened -> logged every time the page is loaded
- devtools.aboutdevtools.installed -> logged when the user clicks on the
  install button
- devtools.aboutdevtools.noinstall_exits -> logged when leaving the page
  if devtools is not enabled

And 2 keyed histograms:
- DEVTOOLS_ABOUT_DEVTOOLS_OPENED_REASON (is it a shortcut, is it a menu
  item etc...)
- DEVTOOLS_ABOUT_DEVTOOLS_OPENED_KEY (in case of a keyshortcut, what is
  the keyshortcut id)


MozReview-Commit-ID: 1DET1ozf8i4

--HG--
extra : rebase_source : f2f96e29a8849dec83b03d6daacbf6c6ca7fce2f
This commit is contained in:
Julian Descottes 2017-11-01 18:41:42 +01:00
Родитель 9d5d22f390
Коммит 2695e6bb98
3 изменённых файлов: 92 добавлений и 0 удалений

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

@ -9,6 +9,12 @@ const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const DEVTOOLS_ENABLED_PREF = "devtools.enabled";
const TELEMETRY_OPENED_KEY = "DEVTOOLS_ABOUT_DEVTOOLS_OPENED_KEY";
const TELEMETRY_OPENED_REASON = "DEVTOOLS_ABOUT_DEVTOOLS_OPENED_REASON";
const TELEMETRY_OPENED = "devtools.aboutdevtools.opened";
const TELEMETRY_INSTALLED = "devtools.aboutdevtools.installed";
const TELEMETRY_NOINSTALL_EXITS = "devtools.aboutdevtools.noinstall_exits";
const MESSAGES = {
AboutDebugging: "about-debugging-message",
ContextMenu: "inspect-element-message",
@ -27,8 +33,12 @@ const keyShortcutsBundle = Services.strings.createBundle(KEY_SHORTCUTS_STRINGS);
// we have to use http in order to have working searchParams.
let url = new URL(window.location.href.replace("about:", "http://"));
let reason = url.searchParams.get("reason");
let keyid = url.searchParams.get("keyid");
let tabid = parseInt(url.searchParams.get("tabid"), 10);
// Keep track of the initial devtools.enabled value to track exits in telemetry.
let isEnabledOnLoad;
function getToolboxShortcut() {
const modifier = Services.appinfo.OS == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+";
return modifier + keyShortcutsBundle.GetStringFromName("toggleToolbox.commandkey");
@ -36,6 +46,12 @@ function getToolboxShortcut() {
function onInstallButtonClick() {
Services.prefs.setBoolPref("devtools.enabled", true);
try {
Services.telemetry.scalarAdd(TELEMETRY_INSTALLED, 1);
} catch (e) {
dump("about:devtools oninstall telemetry failed: " + e + "\n");
}
}
function onCloseButtonClick() {
@ -169,6 +185,20 @@ window.addEventListener("load", function () {
// Update the current page based on the current value of DEVTOOLS_ENABLED_PREF.
updatePage();
try {
if (reason) {
Services.telemetry.getHistogramById(TELEMETRY_OPENED_REASON).add(reason);
}
if (keyid) {
Services.telemetry.getHistogramById(TELEMETRY_OPENED_KEY).add(keyid);
}
Services.telemetry.scalarAdd(TELEMETRY_OPENED, 1);
} catch (e) {
dump("about:devtools onload telemetry failed: " + e + "\n");
}
}, { once: true });
window.addEventListener("beforeunload", function () {
@ -194,4 +224,13 @@ window.addEventListener("unload", function () {
document.getElementById("install").removeEventListener("click", onInstallButtonClick);
document.getElementById("close").removeEventListener("click", onCloseButtonClick);
Services.prefs.removeObserver(DEVTOOLS_ENABLED_PREF, updatePage);
const isEnabled = Services.prefs.getBoolPref("devtools.enabled");
if (!isEnabledOnLoad && !isEnabled) {
try {
Services.telemetry.scalarAdd(TELEMETRY_NOINSTALL_EXITS, 1);
} catch (e) {
dump("about:devtools onunload telemetry failed: " + e + "\n");
}
}
}, {once: true});

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

@ -8504,6 +8504,24 @@
"n_buckets": 1000,
"description": "The time (in milliseconds) that it took to display a selected source to the user."
},
"DEVTOOLS_ABOUT_DEVTOOLS_OPENED_KEY": {
"record_in_processes": ["main"],
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"],
"bug_numbers": [1412029],
"expires_in_version": "60",
"kind": "categorical",
"labels": ["toggleToolbox", "toggleToolboxF12", "inspector", "webconsole", "jsdebugger", "netmonitor", "toggleToolbar", "webide", "browserToolbox", "browserConsole", "responsiveDesignMode", "scratchpad", "styleeditor", "performance", "storage", "dom"],
"description": "Records the key shortcut passed to open the about:devtools page."
},
"DEVTOOLS_ABOUT_DEVTOOLS_OPENED_REASON": {
"record_in_processes": ["main"],
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"],
"bug_numbers": [1412029],
"expires_in_version": "60",
"kind": "categorical",
"labels": ["KeyShortcut", "SystemMenu", "HamburgerMenu", "ContextMenu", "CommandLine"],
"description": "Records the reason for opening the about:devtools page."
},
"MEDIA_RUST_MP4PARSE_SUCCESS": {
"record_in_processes": ["main", "content"],
"alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],

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

@ -921,6 +921,41 @@ devtools:
record_in_processes:
- 'main'
devtools.aboutdevtools:
opened:
bug_numbers:
- 1412029
description: >
Number of times about:devtools was opened.
expires: "60"
kind: uint
notification_emails:
- dev-developer-tools@lists.mozilla.org, jdescottes@mozilla.com
record_in_processes:
- 'main'
installed:
bug_numbers:
- 1412029
description: >
Number of times devtools were enabled/installed in about:devtools.
expires: "60"
kind: uint
notification_emails:
- dev-developer-tools@lists.mozilla.org, jdescottes@mozilla.com
record_in_processes:
- 'main'
noinstall_exits:
bug_numbers:
- 1412029
description: >
Number of times the user left about:devtools without enabling devtools.
expires: "60"
kind: uint
notification_emails:
- dev-developer-tools@lists.mozilla.org, jdescottes@mozilla.com
record_in_processes:
- 'main'
navigator.storage:
estimate_count:
bug_numbers: