Bug 1840917 - Add a probe to measure how long it takes to show both the legacy and new migration wizard. data-review=jhirsch,r=tgiles
Differential Revision: https://phabricator.services.mozilla.com/D182389
This commit is contained in:
@@ -24,6 +24,7 @@ var gFileMigrators = null;
|
||||
var gProfileStartup = null;
|
||||
var gL10n = null;
|
||||
var gPreviousDefaultBrowserKey = "";
|
||||
var gHasOpenedLegacyWizard = false;
|
||||
|
||||
let gForceExitSpinResolve = false;
|
||||
let gKeepUndoData = false;
|
||||
@@ -689,6 +690,11 @@ class MigrationUtils {
|
||||
return Promise.resolve();
|
||||
}
|
||||
// Legacy migration dialog
|
||||
if (!gHasOpenedLegacyWizard) {
|
||||
gHasOpenedLegacyWizard = true;
|
||||
aOptions.openedTime = Cu.now();
|
||||
}
|
||||
|
||||
const DIALOG_URL = "chrome://browser/content/migration/migration.xhtml";
|
||||
let features = "chrome,dialog,modal,centerscreen,titlebar,resizable=no";
|
||||
if (AppConstants.platform == "macosx" && !this.isStartupMigration) {
|
||||
|
||||
@@ -35,6 +35,12 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
LoginCSVImport: "resource://gre/modules/LoginCSVImport.jsm",
|
||||
});
|
||||
|
||||
/**
|
||||
* Set to true once the first instance of MigrationWizardParent has received
|
||||
* a "GetAvailableMigrators" message.
|
||||
*/
|
||||
let gHasOpenedBefore = false;
|
||||
|
||||
/**
|
||||
* This class is responsible for communicating with MigrationUtils to do the
|
||||
* actual heavy-lifting of any kinds of migration work, based on messages from
|
||||
@@ -75,6 +81,8 @@ export class MigrationWizardParent extends JSWindowActorParent {
|
||||
|
||||
switch (message.name) {
|
||||
case "GetAvailableMigrators": {
|
||||
let start = Cu.now();
|
||||
|
||||
let availableMigrators = [];
|
||||
for (const key of MigrationUtils.availableMigratorKeys) {
|
||||
availableMigrators.push(this.#getMigratorAndProfiles(key));
|
||||
@@ -98,6 +106,15 @@ export class MigrationWizardParent extends JSWindowActorParent {
|
||||
return b.lastModifiedDate - a.lastModifiedDate;
|
||||
});
|
||||
|
||||
let elapsed = Cu.now() - start;
|
||||
if (!gHasOpenedBefore) {
|
||||
gHasOpenedBefore = true;
|
||||
Services.telemetry.scalarSet(
|
||||
"migration.time_to_produce_migrator_list",
|
||||
elapsed
|
||||
);
|
||||
}
|
||||
|
||||
return filteredResults;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ var MigrationWizard = {
|
||||
_autoMigrate: null,
|
||||
_receivedPermissions: new Set(),
|
||||
_succeededMigrationEventArgs: null,
|
||||
_openedTime: null,
|
||||
|
||||
init() {
|
||||
Services.telemetry.setEventRecordingEnabled("browser.migration", true);
|
||||
@@ -71,6 +72,14 @@ var MigrationWizard = {
|
||||
.getHistogramById("FX_MIGRATION_ENTRY_POINT")
|
||||
.add(entryPointId);
|
||||
|
||||
// If the caller passed openedTime, that means this is the first time that
|
||||
// the migration wizard is opening, and we want to measure its performance.
|
||||
// Stash the time that opening was invoked so that we can measure the
|
||||
// total elapsed time when the source list is shown.
|
||||
if (args.openedTime) {
|
||||
this._openedTime = args.openedTime;
|
||||
}
|
||||
|
||||
this.isInitialMigration =
|
||||
entrypoint == MigrationUtils.MIGRATION_ENTRYPOINTS.FIRSTRUN;
|
||||
|
||||
@@ -289,6 +298,17 @@ var MigrationWizard = {
|
||||
document.getElementById("importAll").hidden = true;
|
||||
}
|
||||
|
||||
// This must be the first time we're opening the migration wizard,
|
||||
// and we want to know how long it took to get to this point, where
|
||||
// we're showing the source list.
|
||||
if (this._openedTime !== null) {
|
||||
let elapsed = Cu.now() - this._openedTime;
|
||||
Services.telemetry.scalarSet(
|
||||
"migration.time_to_produce_legacy_migrator_list",
|
||||
elapsed
|
||||
);
|
||||
}
|
||||
|
||||
// Advance to the next page if the caller told us to.
|
||||
if (this._migrator && this._skipImportSourcePage) {
|
||||
this._wiz.advance();
|
||||
|
||||
@@ -54,6 +54,15 @@ add_task(async function test_successful_migrations() {
|
||||
]);
|
||||
});
|
||||
|
||||
// We should make sure that the migration.time_to_produce_migrator_list
|
||||
// scalar was set, since we know that at least one migration wizard has
|
||||
// been opened.
|
||||
let scalars = TelemetryTestUtils.getProcessScalars("parent", false, false);
|
||||
Assert.ok(
|
||||
scalars["migration.time_to_produce_migrator_list"] > 0,
|
||||
"Non-zero scalar value recorded for migration.time_to_produce_migrator_list"
|
||||
);
|
||||
|
||||
// Scenario 2: Several resource types are available, but only 1
|
||||
// is checked / expected.
|
||||
migration = waitForTestMigration(
|
||||
|
||||
@@ -99,4 +99,13 @@ add_task(async function test_legacy_wizard() {
|
||||
TelemetryTestUtils.assertHistogram(legacyHistogram, entrypointId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// We should make sure that the migration.time_to_produce_legacy_migrator_list
|
||||
// scalar was set, since we know that at least one legacy migration wizard has
|
||||
// been opened.
|
||||
let scalars = TelemetryTestUtils.getProcessScalars("parent", false, false);
|
||||
Assert.ok(
|
||||
scalars["migration.time_to_produce_legacy_migrator_list"] > 0,
|
||||
"Non-zero scalar value recorded for migration.time_to_produce_migrator_list"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8348,6 +8348,36 @@ migration:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- main
|
||||
time_to_produce_legacy_migrator_list:
|
||||
bug_numbers:
|
||||
- 1840917
|
||||
description: >
|
||||
The amount of time it took in milliseconds to produce the list of migrators in the
|
||||
legacy migration wizard.
|
||||
expires: never
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- mconley@mozilla.com
|
||||
release_channel_collection: opt-out
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- main
|
||||
time_to_produce_migrator_list:
|
||||
bug_numbers:
|
||||
- 1840917
|
||||
description: >
|
||||
The amount of time it took in milliseconds to produce the list of migrators and profiles
|
||||
for the first time the migration wizard opened during the process lifetime.
|
||||
expires: never
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- mconley@mozilla.com
|
||||
release_channel_collection: opt-out
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- main
|
||||
|
||||
contextual.services.topsites:
|
||||
impression:
|
||||
|
||||
Reference in New Issue
Block a user