зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1178964 - Track editing actions in WebIDE with telemetry. r=ochameau
This commit is contained in:
Родитель
04fd69b77b
Коммит
307355dd84
|
@ -151,9 +151,9 @@ Telemetry.prototype = {
|
|||
timerHistogram: "DEVTOOLS_NETMONITOR_TIME_ACTIVE_SECONDS"
|
||||
},
|
||||
storage: {
|
||||
histogram: "DEVTOOLS_STORAGE_OPENED_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_STORAGE_OPENED_PER_USER_FLAG",
|
||||
timerHistogram: "DEVTOOLS_STORAGE_TIME_ACTIVE_SECONDS"
|
||||
histogram: "DEVTOOLS_STORAGE_OPENED_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_STORAGE_OPENED_PER_USER_FLAG",
|
||||
timerHistogram: "DEVTOOLS_STORAGE_TIME_ACTIVE_SECONDS"
|
||||
},
|
||||
tilt: {
|
||||
histogram: "DEVTOOLS_TILT_OPENED_BOOLEAN",
|
||||
|
@ -197,6 +197,23 @@ Telemetry.prototype = {
|
|||
userHistogram: "DEVTOOLS_WEBIDE_OPENED_PER_USER_FLAG",
|
||||
timerHistogram: "DEVTOOLS_WEBIDE_TIME_ACTIVE_SECONDS"
|
||||
},
|
||||
webideProjectEditor: {
|
||||
histogram: "DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_PER_USER_FLAG",
|
||||
timerHistogram: "DEVTOOLS_WEBIDE_PROJECT_EDITOR_TIME_ACTIVE_SECONDS"
|
||||
},
|
||||
webideProjectEditorSave: {
|
||||
histogram: "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_PER_USER_FLAG",
|
||||
},
|
||||
webideNewProject: {
|
||||
histogram: "DEVTOOLS_WEBIDE_NEW_PROJECT_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_WEBIDE_NEW_PROJECT_PER_USER_FLAG",
|
||||
},
|
||||
webideImportProject: {
|
||||
histogram: "DEVTOOLS_WEBIDE_IMPORT_PROJECT_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_WEBIDE_IMPORT_PROJECT_PER_USER_FLAG",
|
||||
},
|
||||
custom: {
|
||||
histogram: "DEVTOOLS_CUSTOM_OPENED_BOOLEAN",
|
||||
userHistogram: "DEVTOOLS_CUSTOM_OPENED_PER_USER_FLAG",
|
||||
|
@ -225,6 +242,15 @@ Telemetry.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Record that an action occurred. Aliases to `toolOpened`, so it's just for
|
||||
* readability at the call site for cases where we aren't actually opening
|
||||
* tools.
|
||||
*/
|
||||
actionOccurred(id) {
|
||||
this.toolOpened(id);
|
||||
},
|
||||
|
||||
toolClosed: function(id) {
|
||||
let charts = this._histograms[id];
|
||||
|
||||
|
|
|
@ -147,6 +147,8 @@ let UI = {
|
|||
window.removeEventListener("message", this.onMessage);
|
||||
this.updateConnectionTelemetry();
|
||||
this._telemetry.toolClosed("webide");
|
||||
this._telemetry.toolClosed("webideProjectEditor");
|
||||
this._telemetry.destroy();
|
||||
},
|
||||
|
||||
canCloseProject: function() {
|
||||
|
@ -670,13 +672,18 @@ let UI = {
|
|||
}
|
||||
},
|
||||
|
||||
updateProjectEditorMenusVisibility: function() {
|
||||
/**
|
||||
* Called when selecting or deselecting the project editor panel.
|
||||
*/
|
||||
onChangeProjectEditorSelected: function() {
|
||||
if (this.projecteditor) {
|
||||
let panel = document.querySelector("#deck").selectedPanel;
|
||||
if (panel && panel.id == "deck-panel-projecteditor") {
|
||||
this.projecteditor.menuEnabled = true;
|
||||
this._telemetry.toolOpened("webideProjectEditor");
|
||||
} else {
|
||||
this.projecteditor.menuEnabled = false;
|
||||
this._telemetry.toolClosed("webideProjectEditor");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -691,8 +698,9 @@ let UI = {
|
|||
menubar: document.querySelector("#main-menubar"),
|
||||
menuindex: 1
|
||||
});
|
||||
this.projecteditor.on("onEditorSave", (editor, resource) => {
|
||||
this.projecteditor.on("onEditorSave", () => {
|
||||
AppManager.validateAndUpdateProject(AppManager.selectedProject);
|
||||
this._telemetry.actionOccurred("webideProjectEditorSave");
|
||||
});
|
||||
return this.projecteditor.loaded;
|
||||
},
|
||||
|
@ -748,11 +756,11 @@ let UI = {
|
|||
|
||||
// Show ProjectEditor
|
||||
|
||||
this.selectDeckPanel("projecteditor");
|
||||
|
||||
this.getProjectEditor().then(() => {
|
||||
this.updateProjectEditorHeader();
|
||||
}, console.error);
|
||||
|
||||
this.selectDeckPanel("projecteditor");
|
||||
},
|
||||
|
||||
autoStartProject: Task.async(function*() {
|
||||
|
@ -806,6 +814,8 @@ let UI = {
|
|||
|
||||
// Select project
|
||||
AppManager.selectedProject = project;
|
||||
|
||||
this._telemetry.actionOccurred("webideImportProject");
|
||||
}),
|
||||
|
||||
// Remember the last selected project on the runtime
|
||||
|
@ -919,7 +929,7 @@ let UI = {
|
|||
panel.setAttribute("src", lazysrc);
|
||||
}
|
||||
deck.selectedPanel = panel;
|
||||
this.updateProjectEditorMenusVisibility();
|
||||
this.onChangeProjectEditorSelected();
|
||||
this.updateToolboxFullscreenState();
|
||||
},
|
||||
|
||||
|
@ -927,7 +937,7 @@ let UI = {
|
|||
this.resetFocus();
|
||||
let deck = document.querySelector("#deck");
|
||||
deck.selectedPanel = null;
|
||||
this.updateProjectEditorMenusVisibility();
|
||||
this.onChangeProjectEditorSelected();
|
||||
},
|
||||
|
||||
buildIDToDate(buildID) {
|
||||
|
|
|
@ -11,6 +11,7 @@ const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
|||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||
const utils = require("devtools/webide/utils");
|
||||
const Telemetry = require("devtools/shared/telemetry");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
|
||||
|
||||
|
@ -23,6 +24,7 @@ module.exports = ProjectList = function(win, parentWindow) {
|
|||
this._parentWindow = parentWindow;
|
||||
this._panelNodeEl = "toolbarbutton";
|
||||
this._sidebarsEnabled = Services.prefs.getBoolPref("devtools.webide.sidebars");
|
||||
this._telemetry = new Telemetry();
|
||||
|
||||
if (this._sidebarsEnabled) {
|
||||
this._panelNodeEl = "div";
|
||||
|
@ -77,6 +79,7 @@ ProjectList.prototype = {
|
|||
*/
|
||||
newApp: function(testOptions) {
|
||||
let parentWindow = this._parentWindow;
|
||||
let self = this;
|
||||
return this._UI.busyUntil(Task.spawn(function*() {
|
||||
// Open newapp.xul, which will feed ret.location
|
||||
let ret = {location: null, testOptions: testOptions};
|
||||
|
@ -89,6 +92,8 @@ ProjectList.prototype = {
|
|||
|
||||
// Select project
|
||||
AppManager.selectedProject = project;
|
||||
|
||||
self._telemetry.actionOccurred("webideNewProject");
|
||||
}), "creating new app");
|
||||
},
|
||||
|
||||
|
|
|
@ -164,10 +164,17 @@
|
|||
function checkResults() {
|
||||
let result = Telemetry.prototype.telemetryInfo;
|
||||
for (let [histId, value] of Iterator(result)) {
|
||||
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
|
||||
if (histId.endsWith("_PER_USER_FLAG")) {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
"Per user value " + histId + " has a single value of true");
|
||||
} else if (histId.endsWith("OPENED_BOOLEAN")) {
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_IMPORT_PROJECT_BOOLEAN") {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
histId + " has 1 successful entry");
|
||||
} else if (histId ===
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_BOOLEAN") {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
histId + " has 1 successful entry");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_OPENED_BOOLEAN") {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
|
@ -175,7 +182,7 @@
|
|||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries are true");
|
||||
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
|
||||
} else if (histId.endsWith("WEBIDE_TIME_ACTIVE_SECONDS")) {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
|
@ -183,6 +190,9 @@
|
|||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries have time > 0");
|
||||
} else if (histId.endsWith("EDITOR_TIME_ACTIVE_SECONDS")) {
|
||||
ok(value.length === 1 && value[0] > 0,
|
||||
histId + " has 1 entry with time > 0");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_RESULT") {
|
||||
ok(value.length === 6, histId + " has 6 connection results");
|
||||
|
||||
|
|
|
@ -164,10 +164,17 @@
|
|||
function checkResults() {
|
||||
let result = Telemetry.prototype.telemetryInfo;
|
||||
for (let [histId, value] of Iterator(result)) {
|
||||
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
|
||||
if (histId.endsWith("_PER_USER_FLAG")) {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
"Per user value " + histId + " has a single value of true");
|
||||
} else if (histId.endsWith("OPENED_BOOLEAN")) {
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_IMPORT_PROJECT_BOOLEAN") {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
histId + " has 1 successful entry");
|
||||
} else if (histId ===
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_BOOLEAN") {
|
||||
ok(value.length === 1 && !!value[0],
|
||||
histId + " has 1 successful entry");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_OPENED_BOOLEAN") {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
|
@ -175,7 +182,7 @@
|
|||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries are true");
|
||||
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
|
||||
} else if (histId.endsWith("WEBIDE_TIME_ACTIVE_SECONDS")) {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
|
@ -183,6 +190,9 @@
|
|||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries have time > 0");
|
||||
} else if (histId.endsWith("EDITOR_TIME_ACTIVE_SECONDS")) {
|
||||
ok(value.length === 1 && value[0] > 0,
|
||||
histId + " has 1 entry with time > 0");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_RESULT") {
|
||||
ok(value.length === 6, histId + " has 6 connection results");
|
||||
|
||||
|
|
|
@ -6695,6 +6695,26 @@
|
|||
"kind": "boolean",
|
||||
"description": "How many times has the DevTools WebIDE been opened?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_BOOLEAN": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"description": "How many times has the DevTools WebIDE project editor been opened?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_BOOLEAN": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"description": "How many times has a file been saved in the DevTools WebIDE project editor?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_NEW_PROJECT_BOOLEAN": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"description": "How many times has a new project been created in the DevTools WebIDE?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_IMPORT_PROJECT_BOOLEAN": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"description": "How many times has a project been imported into the DevTools WebIDE?"
|
||||
},
|
||||
"DEVTOOLS_CUSTOM_OPENED_BOOLEAN": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
|
@ -6840,6 +6860,26 @@
|
|||
"kind": "flag",
|
||||
"description": "How many users have opened the DevTools WebIDE?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_OPENED_PER_USER_FLAG": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"description": "How many users have opened the DevTools WebIDE project editor?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_PER_USER_FLAG": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"description": "How many users have saved a file in the DevTools WebIDE project editor?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_NEW_PROJECT_PER_USER_FLAG": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"description": "How many users have created a new project in the DevTools WebIDE?"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_IMPORT_PROJECT_PER_USER_FLAG": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"description": "How many users have imported a project into the DevTools WebIDE?"
|
||||
},
|
||||
"DEVTOOLS_CUSTOM_OPENED_PER_USER_FLAG": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
|
@ -7020,6 +7060,13 @@
|
|||
"n_buckets": 100,
|
||||
"description": "How long has WebIDE been active (seconds)"
|
||||
},
|
||||
"DEVTOOLS_WEBIDE_PROJECT_EDITOR_TIME_ACTIVE_SECONDS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": "10000000",
|
||||
"n_buckets": 100,
|
||||
"description": "How long has WebIDE's project editor been active (seconds)"
|
||||
},
|
||||
"DEVTOOLS_CUSTOM_TIME_ACTIVE_SECONDS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
|
Загрузка…
Ссылка в новой задаче