зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1289436 - add telemetry for the length of time we take to import data, r=jaws,bsmedberg
MozReview-Commit-ID: CkbHJVRucr5 --HG-- extra : rebase_source : fc6c698e7df76a54fd7a30d5b840f5d838370c7b
This commit is contained in:
Родитель
7116496e95
Коммит
e8ac5e77fb
|
@ -10,19 +10,21 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
|||
const TOPIC_WILL_IMPORT_BOOKMARKS = "initial-migration-will-import-default-bookmarks";
|
||||
const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmarks";
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
|
||||
"resource://gre/modules/BookmarkHTMLUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||
"resource://gre/modules/PromiseUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AutoMigrate",
|
||||
"resource:///modules/AutoMigrate.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
|
||||
"resource://gre/modules/BookmarkHTMLUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||
"resource://gre/modules/PromiseUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
||||
var gMigrators = null;
|
||||
var gProfileStartup = null;
|
||||
|
@ -197,6 +199,10 @@ this.MigratorPrototype = {
|
|||
return types.reduce((a, b) => a |= b, 0);
|
||||
},
|
||||
|
||||
getKey: function MP_getKey() {
|
||||
return this.contractID.match(/\=([^\=]+)$/)[1];
|
||||
},
|
||||
|
||||
/**
|
||||
* DO NOT OVERRIDE - After deCOMing migration, the UI will just call
|
||||
* migrate for each resource.
|
||||
|
@ -218,6 +224,31 @@ this.MigratorPrototype = {
|
|||
});
|
||||
};
|
||||
|
||||
let getHistogramForResourceType = resourceType => {
|
||||
if (resourceType == MigrationUtils.resourceTypes.HISTORY) {
|
||||
return "FX_MIGRATION_HISTORY_IMPORT_MS";
|
||||
}
|
||||
if (resourceType == MigrationUtils.resourceTypes.BOOKMARKS) {
|
||||
return "FX_MIGRATION_BOOKMARKS_IMPORT_MS";
|
||||
}
|
||||
if (resourceType == MigrationUtils.resourceTypes.PASSWORDS) {
|
||||
return "FX_MIGRATION_LOGINS_IMPORT_MS";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
let maybeStartTelemetryStopwatch = (resourceType, resource) => {
|
||||
let histogram = getHistogramForResourceType(resourceType);
|
||||
if (histogram) {
|
||||
TelemetryStopwatch.startKeyed(histogram, this.getKey(), resource);
|
||||
}
|
||||
};
|
||||
let maybeStopTelemetryStopwatch = (resourceType, resource) => {
|
||||
let histogram = getHistogramForResourceType(resourceType);
|
||||
if (histogram) {
|
||||
TelemetryStopwatch.finishKeyed(histogram, this.getKey(), resource);
|
||||
}
|
||||
};
|
||||
|
||||
// Called either directly or through the bookmarks import callback.
|
||||
let doMigrate = Task.async(function*() {
|
||||
let resourcesGroupedByItems = new Map();
|
||||
|
@ -246,8 +277,10 @@ this.MigratorPrototype = {
|
|||
for (let res of itemResources) {
|
||||
// Workaround bug 449811.
|
||||
let resource = res;
|
||||
maybeStartTelemetryStopwatch(migrationType, resource);
|
||||
let completeDeferred = PromiseUtils.defer();
|
||||
let resourceDone = function(aSuccess) {
|
||||
maybeStopTelemetryStopwatch(migrationType, resource);
|
||||
itemResources.delete(resource);
|
||||
itemSuccess |= aSuccess;
|
||||
if (itemResources.size == 0) {
|
||||
|
|
|
@ -4588,6 +4588,39 @@
|
|||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Whether the homepage was imported during browser migration. Only available on release builds during firstrun."
|
||||
},
|
||||
"FX_MIGRATION_BOOKMARKS_IMPORT_MS": {
|
||||
"bug_numbers": [1289436],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
"expires_in_version": "54",
|
||||
"kind": "exponential",
|
||||
"n_buckets": 70,
|
||||
"high": 100000,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"keyed": true,
|
||||
"description": "How long it took to import bookmarks from another browser, keyed by the name of the browser."
|
||||
},
|
||||
"FX_MIGRATION_HISTORY_IMPORT_MS": {
|
||||
"bug_numbers": [1289436],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
"expires_in_version": "54",
|
||||
"kind": "exponential",
|
||||
"n_buckets": 70,
|
||||
"high": 100000,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"keyed": true,
|
||||
"description": "How long it took to import history from another browser, keyed by the name of the browser."
|
||||
},
|
||||
"FX_MIGRATION_LOGINS_IMPORT_MS": {
|
||||
"bug_numbers": [1289436],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
"expires_in_version": "54",
|
||||
"kind": "exponential",
|
||||
"n_buckets": 70,
|
||||
"high": 100000,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"keyed": true,
|
||||
"description": "How long it took to import logins (passwords) from another browser, keyed by the name of the browser."
|
||||
},
|
||||
"FX_STARTUP_MIGRATION_BROWSER_COUNT": {
|
||||
"bug_numbers": [1275114],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче