Bug 1214352 - Add telemetry for Scratchpad as top level window. r=jryans,p=bsmedberg

This commit is contained in:
Alexandre Poirot 2016-02-04 02:20:55 -08:00
parent dd4512a3dd
commit 5a1faaaf7f
3 changed files with 40 additions and 0 deletions

View File

@ -15,6 +15,10 @@ const SCRATCHPAD_WINDOW_URL = "chrome://devtools/content/scratchpad/scratchpad.x
const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
Cu.import("resource://gre/modules/Services.jsm");
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const Telemetry = require("devtools/client/shared/telemetry");
/**
* The ScratchpadManager object opens new Scratchpad windows and manages the state
@ -26,6 +30,8 @@ this.ScratchpadManager = {
_nextUid: 1,
_scratchpads: [],
_telemetry: new Telemetry(),
/**
* Get the saved states of open scratchpad windows. Called by
* session restore.
@ -125,6 +131,12 @@ this.ScratchpadManager = {
let win = Services.ww.openWindow(null, SCRATCHPAD_WINDOW_URL, "_blank",
SCRATCHPAD_WINDOW_FEATURES, params);
this._telemetry.toolOpened("scratchpad-window");
let onClose = () => {
this._telemetry.toolClosed("scratchpad-window");
};
win.addEventListener("unload", onClose);
// Only add the shutdown observer if we've opened a scratchpad window.
ShutdownObserver.init();

View File

@ -175,6 +175,11 @@ Telemetry.prototype = {
userHistogram: "DEVTOOLS_SCRATCHPAD_OPENED_PER_USER_FLAG",
timerHistogram: "DEVTOOLS_SCRATCHPAD_TIME_ACTIVE_SECONDS"
},
"scratchpad-window": {
histogram: "DEVTOOLS_SCRATCHPAD_WINDOW_OPENED_BOOLEAN",
userHistogram: "DEVTOOLS_SCRATCHPAD_WINDOW_OPENED_PER_USER_FLAG",
timerHistogram: "DEVTOOLS_SCRATCHPAD_WINDOW_TIME_ACTIVE_SECONDS"
},
responsive: {
histogram: "DEVTOOLS_RESPONSIVE_OPENED_BOOLEAN",
userHistogram: "DEVTOOLS_RESPONSIVE_OPENED_PER_USER_FLAG",

View File

@ -6868,6 +6868,13 @@
"kind": "boolean",
"description": "How many times has the devtool's Scratchpad been opened via the toolbox button?"
},
"DEVTOOLS_SCRATCHPAD_WINDOW_OPENED_BOOLEAN": {
"alert_emails": ["dev-developer-tools@lists.mozilla.org"],
"expires_in_version": "50",
"kind": "boolean",
"description": "How many times has the devtool's Scratchpad standalone window been opened?",
"bug_numbers": [1214352]
},
"DEVTOOLS_RESPONSIVE_OPENED_BOOLEAN": {
"expires_in_version": "never",
"kind": "boolean",
@ -7044,6 +7051,13 @@
"kind": "flag",
"description": "How many users have opened the devtool's Scratchpad been opened via the toolbox button?"
},
"DEVTOOLS_SCRATCHPAD_WINDOW_OPENED_PER_USER_FLAG": {
"alert_emails": ["dev-developer-tools@lists.mozilla.org"],
"expires_in_version": "50",
"kind": "flag",
"description": "How many users have opened the devtool's Scratchpad standalone window been opened?",
"bug_numbers": [1214352]
},
"DEVTOOLS_RESPONSIVE_OPENED_PER_USER_FLAG": {
"expires_in_version": "never",
"kind": "flag",
@ -7266,6 +7280,15 @@
"n_buckets": 100,
"description": "How long has Scratchpad been active (seconds)"
},
"DEVTOOLS_SCRATCHPAD_WINDOW_TIME_ACTIVE_SECONDS": {
"alert_emails": ["dev-developer-tools@lists.mozilla.org"],
"expires_in_version": "50",
"kind": "exponential",
"high": "10000000",
"n_buckets": 100,
"description": "How long has Scratchpad standalone window been active (seconds)",
"bug_numbers": [1214352]
},
"DEVTOOLS_RESPONSIVE_TIME_ACTIVE_SECONDS": {
"expires_in_version": "never",
"kind": "exponential",