зеркало из https://github.com/mozilla/gecko-dev.git
Bug 731025 - Add telemetry for migrator usage and errors, r=MattN,p=bsmedberg
--HG-- extra : commitid : 1TzjbWkzOq7 extra : rebase_source : fad923bd73689a49315e0e737553f0fd146a8d57
This commit is contained in:
Родитель
a8cc7601a0
Коммит
b4048dc695
|
@ -13,6 +13,7 @@ const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmar
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/Task.jsm");
|
Cu.import("resource://gre/modules/Task.jsm");
|
||||||
|
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||||
"resource://gre/modules/PlacesUtils.jsm");
|
"resource://gre/modules/PlacesUtils.jsm");
|
||||||
|
@ -545,12 +546,21 @@ this.MigrationUtils = Object.freeze({
|
||||||
* Show the migration wizard. On mac, this may just focus the wizard if it's
|
* Show the migration wizard. On mac, this may just focus the wizard if it's
|
||||||
* already running, in which case aOpener and aParams are ignored.
|
* already running, in which case aOpener and aParams are ignored.
|
||||||
*
|
*
|
||||||
* @param [optional] aOpener
|
* @param {Window} [aOpener]
|
||||||
* the window that asks to open the wizard.
|
* optional; the window that asks to open the wizard.
|
||||||
* @param [optioanl] aParams
|
* @param {Array} [aParams]
|
||||||
* arguments for the migration wizard, in the form of an nsIArray.
|
* optional arguments for the migration wizard, in the form of an array
|
||||||
* This is passed as-is for the params argument of
|
* This is passed as-is for the params argument of
|
||||||
* nsIWindowWatcher.openWindow.
|
* nsIWindowWatcher.openWindow. The array elements we expect are, in
|
||||||
|
* order:
|
||||||
|
* - {Number} migration entry point constant (see below)
|
||||||
|
* - {String} source browser identifier
|
||||||
|
* - {nsIBrowserProfileMigrator} actual migrator object
|
||||||
|
* - {Boolean} whether this is a startup migration
|
||||||
|
* - {Boolean} whether to skip the 'source' page
|
||||||
|
* NB: If you add new consumers, please add a migration entry point
|
||||||
|
* constant below, and specify at least the first element of the array
|
||||||
|
* (the migration entry point for purposes of telemetry).
|
||||||
*/
|
*/
|
||||||
showMigrationWizard:
|
showMigrationWizard:
|
||||||
function MU_showMigrationWizard(aOpener, aParams) {
|
function MU_showMigrationWizard(aOpener, aParams) {
|
||||||
|
@ -636,18 +646,18 @@ this.MigrationUtils = Object.freeze({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let params = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
let migrationEntryPoint = this.MIGRATION_ENTRYPOINT_FIRSTRUN;
|
||||||
let keyCSTR = Cc["@mozilla.org/supports-cstring;1"].
|
if (migrator && skipSourcePage && migratorKey == AppConstants.MOZ_APP_NAME) {
|
||||||
createInstance(Ci.nsISupportsCString);
|
migrationEntryPoint = this.MIGRATION_ENTRYPOINT_FXREFRESH;
|
||||||
keyCSTR.data = migratorKey;
|
}
|
||||||
let skipImportSourcePageBool = Cc["@mozilla.org/supports-PRBool;1"].
|
|
||||||
createInstance(Ci.nsISupportsPRBool);
|
|
||||||
skipImportSourcePageBool.data = skipSourcePage;
|
|
||||||
params.appendElement(keyCSTR, false);
|
|
||||||
params.appendElement(migrator, false);
|
|
||||||
params.appendElement(aProfileStartup, false);
|
|
||||||
params.appendElement(skipImportSourcePageBool, false);
|
|
||||||
|
|
||||||
|
let params = [
|
||||||
|
migrationEntryPoint,
|
||||||
|
migratorKey,
|
||||||
|
migrator,
|
||||||
|
aProfileStartup,
|
||||||
|
skipSourcePage
|
||||||
|
];
|
||||||
this.showMigrationWizard(null, params);
|
this.showMigrationWizard(null, params);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -658,5 +668,26 @@ this.MigrationUtils = Object.freeze({
|
||||||
gMigrators = null;
|
gMigrators = null;
|
||||||
gProfileStartup = null;
|
gProfileStartup = null;
|
||||||
gMigrationBundle = null;
|
gMigrationBundle = null;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
MIGRATION_ENTRYPOINT_UNKNOWN: 0,
|
||||||
|
MIGRATION_ENTRYPOINT_FIRSTRUN: 1,
|
||||||
|
MIGRATION_ENTRYPOINT_FXREFRESH: 2,
|
||||||
|
MIGRATION_ENTRYPOINT_PLACES: 3,
|
||||||
|
MIGRATION_ENTRYPOINT_PASSWORDS: 4,
|
||||||
|
|
||||||
|
_sourceNameToIdMapping: {
|
||||||
|
"nothing": 1,
|
||||||
|
"firefox": 2,
|
||||||
|
"edge": 3,
|
||||||
|
"ie": 4,
|
||||||
|
"chrome": 5,
|
||||||
|
"chromium": 6,
|
||||||
|
"canary": 7,
|
||||||
|
"safari": 8,
|
||||||
|
"360se": 9,
|
||||||
|
},
|
||||||
|
getSourceIdForTelemetry(sourceName) {
|
||||||
|
return this._sourceNameToIdMapping[sourceName] || 0;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,7 @@ var Cu = Components.utils;
|
||||||
const kIMig = Ci.nsIBrowserProfileMigrator;
|
const kIMig = Ci.nsIBrowserProfileMigrator;
|
||||||
const kIPStartup = Ci.nsIProfileStartup;
|
const kIPStartup = Ci.nsIProfileStartup;
|
||||||
|
|
||||||
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource:///modules/MigrationUtils.jsm");
|
Cu.import("resource:///modules/MigrationUtils.jsm");
|
||||||
|
|
||||||
var MigrationWizard = {
|
var MigrationWizard = {
|
||||||
|
@ -21,8 +22,7 @@ var MigrationWizard = {
|
||||||
|
|
||||||
init: function ()
|
init: function ()
|
||||||
{
|
{
|
||||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
let os = Services.obs;
|
||||||
.getService(Components.interfaces.nsIObserverService);
|
|
||||||
os.addObserver(this, "Migration:Started", false);
|
os.addObserver(this, "Migration:Started", false);
|
||||||
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
|
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
|
||||||
os.addObserver(this, "Migration:ItemAfterMigrate", false);
|
os.addObserver(this, "Migration:ItemAfterMigrate", false);
|
||||||
|
@ -31,18 +31,20 @@ var MigrationWizard = {
|
||||||
|
|
||||||
this._wiz = document.documentElement;
|
this._wiz = document.documentElement;
|
||||||
|
|
||||||
if ("arguments" in window && window.arguments.length > 1) {
|
let args = (window.arguments && window.arguments[0]) || [];
|
||||||
this._source = window.arguments[0];
|
let entryPointId = args[0] || MigrationUtils.MIGRATION_ENTRYPOINT_UNKNOWN;
|
||||||
this._migrator = window.arguments[1] instanceof kIMig ?
|
Services.telemetry.getHistogramById("FX_MIGRATION_ENTRY_POINT").add(entryPointId);
|
||||||
window.arguments[1] : null;
|
|
||||||
this._autoMigrate = window.arguments[2].QueryInterface(kIPStartup);
|
if (args.length > 1) {
|
||||||
this._skipImportSourcePage = window.arguments[3];
|
this._source = args[1];
|
||||||
|
this._migrator = args[2] instanceof kIMig ? args[2] : null;
|
||||||
|
this._autoMigrate = args[3].QueryInterface(kIPStartup);
|
||||||
|
this._skipImportSourcePage = args[4];
|
||||||
|
|
||||||
if (this._autoMigrate) {
|
if (this._autoMigrate) {
|
||||||
// Show the "nothing" option in the automigrate case to provide an
|
// Show the "nothing" option in the automigrate case to provide an
|
||||||
// easily identifiable way to avoid migration and create a new profile.
|
// easily identifiable way to avoid migration and create a new profile.
|
||||||
var nothing = document.getElementById("nothing");
|
document.getElementById("nothing").hidden = false;
|
||||||
nothing.hidden = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +124,11 @@ var MigrationWizard = {
|
||||||
var newSource = document.getElementById("importSourceGroup").selectedItem.id;
|
var newSource = document.getElementById("importSourceGroup").selectedItem.id;
|
||||||
|
|
||||||
if (newSource == "nothing") {
|
if (newSource == "nothing") {
|
||||||
|
// Need to do telemetry here because we're closing the dialog before we get to
|
||||||
|
// do actual migration. For actual migration, this doesn't happen until after
|
||||||
|
// migration takes place.
|
||||||
|
Services.telemetry.getHistogramById("FX_MIGRATION_SOURCE_BROWSER")
|
||||||
|
.add(MigrationUtils.getSourceIdForTelemetry("nothing"));
|
||||||
document.documentElement.cancel();
|
document.documentElement.cancel();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -357,12 +364,27 @@ var MigrationWizard = {
|
||||||
this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
|
this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
|
||||||
|
|
||||||
this._listItems("migratingItems");
|
this._listItems("migratingItems");
|
||||||
setTimeout(this.onMigratingMigrate, 0, this);
|
setTimeout(() => this.onMigratingMigrate(), 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
onMigratingMigrate: function (aOuter)
|
onMigratingMigrate: function ()
|
||||||
{
|
{
|
||||||
aOuter._migrator.migrate(aOuter._itemsFlags, aOuter._autoMigrate, aOuter._selectedProfile);
|
this._migrator.migrate(this._itemsFlags, this._autoMigrate, this._selectedProfile);
|
||||||
|
|
||||||
|
Services.telemetry.getHistogramById("FX_MIGRATION_SOURCE_BROWSER")
|
||||||
|
.add(MigrationUtils.getSourceIdForTelemetry(this._source));
|
||||||
|
if (!this._autoMigrate) {
|
||||||
|
let hist = Services.telemetry.getKeyedHistogramById("FX_MIGRATION_USAGE");
|
||||||
|
let exp = 0;
|
||||||
|
let items = this._itemsFlags;
|
||||||
|
while (items) {
|
||||||
|
if (items & 1) {
|
||||||
|
hist.add(this._source, exp);
|
||||||
|
}
|
||||||
|
items = items >> 1;
|
||||||
|
exp++
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_listItems: function (aID)
|
_listItems: function (aID)
|
||||||
|
@ -409,6 +431,8 @@ var MigrationWizard = {
|
||||||
break;
|
break;
|
||||||
case "Migration:Ended":
|
case "Migration:Ended":
|
||||||
if (this._autoMigrate) {
|
if (this._autoMigrate) {
|
||||||
|
Services.telemetry.getKeyedHistogramById("FX_MIGRATION_HOMEPAGE_IMPORTED")
|
||||||
|
.add(this._source, !!this._newHomePage);
|
||||||
if (this._newHomePage) {
|
if (this._newHomePage) {
|
||||||
try {
|
try {
|
||||||
// set homepage properly
|
// set homepage properly
|
||||||
|
@ -451,8 +475,9 @@ var MigrationWizard = {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "Migration:ItemError":
|
case "Migration:ItemError":
|
||||||
var type = "undefined";
|
let type = "undefined";
|
||||||
switch (parseInt(aData)) {
|
let numericType = parseInt(aData);
|
||||||
|
switch (numericType) {
|
||||||
case Ci.nsIBrowserProfileMigrator.SETTINGS:
|
case Ci.nsIBrowserProfileMigrator.SETTINGS:
|
||||||
type = "settings";
|
type = "settings";
|
||||||
break;
|
break;
|
||||||
|
@ -478,6 +503,8 @@ var MigrationWizard = {
|
||||||
Cc["@mozilla.org/consoleservice;1"]
|
Cc["@mozilla.org/consoleservice;1"]
|
||||||
.getService(Ci.nsIConsoleService)
|
.getService(Ci.nsIConsoleService)
|
||||||
.logStringMessage("some " + type + " did not successfully migrate.");
|
.logStringMessage("some " + type + " did not successfully migrate.");
|
||||||
|
Services.telemetry.getKeyedHistogramById("FX_MIGRATION_ERRORS")
|
||||||
|
.add(this._source, Math.log2(numericType));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<description id="importBookmarks" control="importSourceGroup" hidden="true">&importFromBookmarks.label;</description>
|
<description id="importBookmarks" control="importSourceGroup" hidden="true">&importFromBookmarks.label;</description>
|
||||||
|
|
||||||
<radiogroup id="importSourceGroup" align="start">
|
<radiogroup id="importSourceGroup" align="start">
|
||||||
|
# NB: if you add items to this list, please also assign them a unique migrator ID in MigrationUtils.jsm
|
||||||
<radio id="firefox" label="&importFromFirefox.label;" accesskey="&importFromFirefox.accesskey;"/>
|
<radio id="firefox" label="&importFromFirefox.label;" accesskey="&importFromFirefox.accesskey;"/>
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
<radio id="edge" label="&importFromEdge.label;" accesskey="&importFromEdge.accesskey;"/>
|
<radio id="edge" label="&importFromEdge.label;" accesskey="&importFromEdge.accesskey;"/>
|
||||||
|
|
|
@ -362,7 +362,8 @@ var PlacesOrganizer = {
|
||||||
* cookies, history, preferences, and bookmarks.
|
* cookies, history, preferences, and bookmarks.
|
||||||
*/
|
*/
|
||||||
importFromBrowser: function PO_importFromBrowser() {
|
importFromBrowser: function PO_importFromBrowser() {
|
||||||
MigrationUtils.showMigrationWizard(window);
|
// We pass in the type of source we're using for use in telemetry:
|
||||||
|
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PLACES]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -452,5 +452,6 @@ function escapeKeyHandler() {
|
||||||
|
|
||||||
function OpenMigrator() {
|
function OpenMigrator() {
|
||||||
const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
|
const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
|
||||||
MigrationUtils.showMigrationWizard(window);
|
// We pass in the type of source we're using for use in telemetry:
|
||||||
|
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4177,6 +4177,43 @@
|
||||||
"kind": "boolean",
|
"kind": "boolean",
|
||||||
"description": "THUMBNAILS: Thumbnail found"
|
"description": "THUMBNAILS: Thumbnail found"
|
||||||
},
|
},
|
||||||
|
"FX_MIGRATION_ENTRY_POINT": {
|
||||||
|
"expires_in_version": "49",
|
||||||
|
"kind": "enumerated",
|
||||||
|
"n_values": 10,
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "Where the migration wizard was entered from. 0=Other/catch-all, 1=first-run, 2=refresh-firefox, 3=Places window, 4=Password manager"
|
||||||
|
},
|
||||||
|
"FX_MIGRATION_SOURCE_BROWSER": {
|
||||||
|
"expires_in_version": "49",
|
||||||
|
"kind": "enumerated",
|
||||||
|
"n_values": 15,
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "The browser that data is pulled from. The values correspond to the internal browser ID (see MigrationUtils.jsm)"
|
||||||
|
},
|
||||||
|
"FX_MIGRATION_ERRORS": {
|
||||||
|
"expires_in_version": "49",
|
||||||
|
"kind": "enumerated",
|
||||||
|
"keyed": "true",
|
||||||
|
"n_values": 12,
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "Errors encountered during migration in buckets defined by the datatype, keyed by the string description of the browser."
|
||||||
|
},
|
||||||
|
"FX_MIGRATION_USAGE": {
|
||||||
|
"expires_in_version": "49",
|
||||||
|
"kind": "enumerated",
|
||||||
|
"keyed": "true",
|
||||||
|
"n_values": 12,
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "Usage of migration for each datatype when migration is run through the post-firstrun flow which allows individual datatypes, keyed by the string description of the browser."
|
||||||
|
},
|
||||||
|
"FX_MIGRATION_HOMEPAGE_IMPORTED": {
|
||||||
|
"expires_in_version": "49",
|
||||||
|
"kind": "boolean",
|
||||||
|
"keyed": "true",
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "Whether the homepage was imported during browser migration. Only available on release builds during firstrun."
|
||||||
|
},
|
||||||
"EVENTLOOP_UI_LAG_EXP_MS": {
|
"EVENTLOOP_UI_LAG_EXP_MS": {
|
||||||
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
|
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
|
||||||
"expires_in_version": "never",
|
"expires_in_version": "never",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче