Bug 1630228 - Add telemetry events for OFF 12 devtools experiment r=nchevobbe,janerik

Depends on D71037

Differential Revision: https://phabricator.services.mozilla.com/D71988
This commit is contained in:
Julian Descottes 2020-04-28 20:22:16 +00:00
Родитель 6e79d3a9f3
Коммит 0c53e2927a
4 изменённых файлов: 70 добавлений и 3 удалений

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

@ -321,7 +321,7 @@ var gDevToolsBrowser = (exports.gDevToolsBrowser = {
);
if (isF12Disabled) {
toggleEnableDevToolsPopup(window.document);
toggleEnableDevToolsPopup(window.document, startTime);
} else {
await gDevToolsBrowser.toggleToolboxCommand(
window.gBrowser,

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

@ -4,6 +4,14 @@
"use strict";
loader.lazyGetter(this, "telemetry", () => {
const Telemetry = require("devtools/client/shared/telemetry");
return new Telemetry();
});
// This session id will be initialized the first time the popup is displayed.
let telemetrySessionId = null;
/**
* Helper dedicated to toggle a popup triggered by pressing F12 if DevTools have
* never been opened by the user.
@ -28,6 +36,20 @@ exports.toggleEnableDevToolsPopup = function(doc) {
if (isVisible) {
popup.hidePopup();
} else {
if (!telemetrySessionId) {
telemetrySessionId = parseInt(telemetry.msSinceProcessStart(), 10);
}
popup.openPopup(anchor, "bottomcenter topright");
telemetry.recordEvent("f12_popup_displayed", "tools", null, {
session_id: telemetrySessionId,
});
}
};
/**
* If a session id was already generated here for telemetry, expose it so that
* the toolbox can use it as its own session id.
*/
exports.getF12SessionId = function() {
return telemetrySessionId;
};

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

@ -212,6 +212,13 @@ loader.lazyRequireGetter(
"devtools/shared/picker-constants"
);
loader.lazyRequireGetter(
this,
"getF12SessionId",
"devtools/client/framework/enable-devtools-popup",
true
);
const DEVTOOLS_F12_DISABLED_PREF = "devtools.experiment.f12.shortcut_disabled";
/**
@ -257,6 +264,19 @@ function Toolbox(
// If the user opened the toolbox, we can now enable the F12 shortcut.
if (Services.prefs.getBoolPref(DEVTOOLS_F12_DISABLED_PREF, false)) {
// If the toolbox is opening while F12 was disabled, the user might have
// pressed F12 and seen the "enable devtools" notification.
// A telemetry session_id was generated for the f12_popup_displayed event.
// Reuse it here in order to link the toolbox session to the
// f12_popup_displayed events.
// getF12SessionId() might return null if the popup was never displayed.
// In this case, fallback on the provided `msSinceProcessStart`.
this.sessionId = getF12SessionId() || msSinceProcessStart;
this.telemetry.recordEvent("f12_enabled", "tools", null, {
session_id: this.sessionId,
});
// Flip the preference.
Services.prefs.setBoolPref(DEVTOOLS_F12_DISABLED_PREF, false);
}
@ -1456,6 +1476,7 @@ Toolbox.prototype = {
const browserWin = this.topWindow;
this.telemetry.preparePendingEvent(browserWin, "open", "tools", null, [
"enable_f12",
"entrypoint",
"first_panel",
"host",

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

@ -1207,6 +1207,30 @@ devtools.main:
panel_name: The name of the panel opened 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.
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
f12_enabled:
objects: ["tools"]
bug_numbers: [1630228]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
products:
- "firefox"
record_in_processes: ["main"]
description: User opened DevTools for the first time, which enables the F12 shortcut.
release_channel_collection: opt-out
expiry_version: "80"
extra_keys:
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
f12_popup_displayed:
objects: ["tools"]
bug_numbers: [1630228]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
products:
- "firefox"
record_in_processes: ["main"]
description: User triggered the "enable devtools" notification after pressing F12.
release_channel_collection: opt-out
expiry_version: "80"
extra_keys:
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
filters_changed:
objects: ["netmonitor", "webconsole"]
bug_numbers: [1463144, 1463095]
@ -1652,7 +1676,7 @@ security.ui.protections:
security.ui.app_menu:
click:
bug_numbers:
- 1603545
- 1603545
- 1616229
description: >
Privacy and Security click events on app menu.
@ -1660,7 +1684,7 @@ security.ui.app_menu:
"open_full_report",
]
expiry_version: "80"
record_in_processes:
record_in_processes:
- main
release_channel_collection: opt-out
notification_emails: