From d71d400a4ad8eab9a9b2f0d98a102a53fbc53915 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Thu, 30 Jun 2016 19:02:46 +0100 Subject: [PATCH] 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 --- browser/components/migration/AutoMigrate.jsm | 16 +++++++++++++++- toolkit/components/telemetry/Histograms.json | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/browser/components/migration/AutoMigrate.jsm b/browser/components/migration/AutoMigrate.jsm index f602e295d32c..f9131d08e3c4 100644 --- a/browser/components/migration/AutoMigrate.jsm +++ b/browser/components/migration/AutoMigrate.jsm @@ -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); }), }; diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 87d68d7ca68f..c7f9f1b09268 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -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"],