Bug 1283565 - add telemetry to determine whether undo works and how often it's unavailable due to sync, r=dolske,data-r=bsmedberg

MozReview-Commit-ID: LwFrwbEQLtV

--HG--
extra : transplant_source : %151E%E3%5E%C0%1C%EB%3D%13%99%10%BC%C7%0C%F4%21%EEL%E8
This commit is contained in:
Gijs Kruitbosch 2016-06-30 19:02:46 +01:00
parent dbefb150d6
commit d71d400a4a
2 changed files with 32 additions and 1 deletions

View File

@ -145,15 +145,26 @@ const AutoMigrate = {
// Return a promise resolving to false if we're signed into sync, resolve
// to true otherwise.
let {fxAccounts} = Cu.import("resource://gre/modules/FxAccounts.jsm", {});
return fxAccounts.getSignedInUser().then(user => !user, () => Promise.resolve(true));
return fxAccounts.getSignedInUser().then(user => {
if (user) {
Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_CANT_UNDO_BECAUSE_SYNC").add(true);
}
return !user;
}, () => Promise.resolve(true));
},
undo: Task.async(function* () {
let histogram = Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_UNDO");
histogram.add(0);
if (!(yield this.canUndo())) {
histogram.add(5);
throw new Error("Can't undo!");
}
histogram.add(10);
yield PlacesUtils.bookmarks.eraseEverything();
histogram.add(15);
// NB: we drop the start time of the migration for now. This is because
// imported history will always end up being 'backdated' to the actual
@ -168,14 +179,17 @@ const AutoMigrate = {
beginDate: new Date(0),
endDate: range[1]
});
histogram.add(20);
try {
Services.logins.removeAllLogins();
} catch (ex) {
// ignore failure.
}
histogram.add(25);
Services.prefs.clearUserPref("browser.migrate.automigrate-started");
Services.prefs.clearUserPref("browser.migrate.automigrate-finished");
histogram.add(30);
}),
};

View File

@ -4324,6 +4324,23 @@
"releaseChannelCollection": "opt-out",
"description": "Where automatic migration was attempted, indicates to what degree we succeeded. Values 0-25 indicate progress through the automatic migration sequence, with 25 indicating the migration finished. 26 is only used when the migration produced errors before it finished."
},
"FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_UNDO": {
"bug_numbers": [1283565],
"alert_emails": ["gijs@mozilla.com"],
"expires_in_version": "53",
"kind": "enumerated",
"n_values": 31,
"releaseChannelCollection": "opt-out",
"description": "Where undo of the automatic migration was attempted, indicates to what degree we succeeded to undo. 0 means we started to undo, 5 means we bailed out from the undo because it was not possible to complete it (there was nothing to undo or the user was signed in to sync). All higher values indicate progression through the undo sequence, with 30 indicating we finished the undo without exceptions in the middle."
},
"FX_STARTUP_MIGRATION_CANT_UNDO_BECAUSE_SYNC": {
"bug_numbers": [1283565],
"alert_emails": ["gijs@mozilla.com"],
"expires_in_version": "53",
"kind": "boolean",
"releaseChannelCollection": "opt-out",
"description": "Where undo of the automatic migration was requested and denied because the user was logged into sync."
},
"FX_STARTUP_MIGRATION_DATA_RECENCY": {
"bug_numbers": [1276694],
"alert_emails": ["gijs@mozilla.com"],