Bug 1283565 - add telemetry to determine whether undo works and how often it's unavailable due to sync, r=dolske,r?bsmedberg
MozReview-Commit-ID: H9sABIISxTP
--- a/browser/components/migration/AutoMigrate.jsm
+++ b/browser/components/migration/AutoMigrate.jsm
@@ -140,42 +140,56 @@ const AutoMigrate = {
canUndo() {
if (!this.getUndoRange()) {
return Promise.resolve(false);
}
// 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
// visit time recorded by the browser from which we imported. As a result,
// a lower bound on this item doesn't really make sense.
// Note that for form data this could be different, but we currently don't
// support form data import from any non-Firefox browser, so it isn't
// imported from other browsers by the automigration code, nor do we
// remove it here.
let range = this.getUndoRange();
yield PlacesUtils.history.removeVisitsByFilter({
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);
}),
};
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -4319,16 +4319,33 @@
"bug_numbers": [1271775],
"alert_emails": ["gijs@mozilla.com"],
"expires_in_version": "53",
"kind": "enumerated",
"n_values": 27,
"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."
+ },
+ "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"],
"expires_in_version": "53",
"keyed": true,
"kind": "exponential",
"n_buckets": 50,
"high": 8760,