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
--- a/devtools/shim/aboutdevtools/aboutdevtools.js
+++ b/devtools/shim/aboutdevtools/aboutdevtools.js
@@ -4,16 +4,22 @@
"use strict";
const { utils: Cu } = Components;
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",
HamburgerMenu: "menu-message",
KeyShortcut: "key-shortcut-message",
SystemMenu: "menu-message",
};
@@ -22,25 +28,35 @@ const aboutDevtoolsBundle = Services.str
const KEY_SHORTCUTS_STRINGS = "chrome://devtools-shim/locale/key-shortcuts.properties";
const keyShortcutsBundle = Services.strings.createBundle(KEY_SHORTCUTS_STRINGS);
// URL constructor doesn't support about: scheme,
// 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");
}
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() {
window.close();
}
function updatePage() {
const installPage = document.getElementById("install-page");
@@ -164,16 +180,30 @@ window.addEventListener("load", function
let featuresContainer = document.querySelector(".features-list");
for (let feature of features) {
featuresContainer.appendChild(createFeatureEl(feature));
}
// 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 () {
// Focus the tab that triggered the DevTools onboarding.
if (document.visibilityState != "visible") {
// Only try to focus the correct tab if the current tab is the about:devtools page.
return;
}
@@ -189,9 +219,18 @@ window.addEventListener("beforeunload",
gBrowser.selectedTab = originalTab;
}
}, {once: true});
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});
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8499,16 +8499,34 @@
"DEVTOOLS_DEBUGGER_DISPLAY_SOURCE_REMOTE_MS": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 10000,
"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"],
"expires_in_version": "60",
"kind": "boolean",
"bug_numbers": [1220885],
"description": "Whether the rust mp4 demuxer successfully parsed a stream segment."
},
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -916,16 +916,51 @@ devtools:
kind: uint
keyed: true
notification_emails:
- dev-developer-tools@lists.mozilla.org
release_channel_collection: opt-out
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:
- 1359708
description: >
Number of times navigator.storage.estimate has been used.
expires: "60"
kind: uint