Bug 1281602 - rework automigration telemetry to use an enumerated histogram, r=bsmedberg,dolske

MozReview-Commit-ID: 37XarohGgMN

--HG--
extra : rebase_source : 34134ccfb413eae7d25c811008a8dc647dbbeba4
extra : amend_source : 4d04fc59349673c7f6540fd9468b0d78409262ca
This commit is contained in:
Gijs Kruitbosch 2016-06-23 10:02:59 +01:00
parent 579b36016a
commit 51c24100f1
2 changed files with 14 additions and 11 deletions

View File

@ -31,26 +31,29 @@ const AutoMigrate = {
* failed for some reason.
*/
migrate(profileStartup, migratorKey, profileToMigrate) {
let histogram = Services.telemetry.getKeyedHistogramById("FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_SUCCEEDED");
histogram.add("initialized");
let histogram = Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_PROCESS_SUCCESS");
histogram.add(0);
let migrator = this.pickMigrator(migratorKey);
histogram.add("got-browser");
histogram.add(5);
profileToMigrate = this.pickProfile(migrator, profileToMigrate);
histogram.add("got-profile");
histogram.add(10);
let resourceTypes = migrator.getMigrateData(profileToMigrate, profileStartup);
if (!(resourceTypes & this.resourceTypesToUse)) {
throw new Error("No usable resources were found for the selected browser!");
}
histogram.add("got-data");
histogram.add(15);
let sawErrors = false;
let migrationObserver = function(subject, topic, data) {
if (topic == "Migration:ItemError") {
sawErrors = true;
} else if (topic == "Migration:Ended") {
histogram.add(sawErrors ? "finished-with-errors" : "finished");
histogram.add(25);
if (sawErrors) {
histogram.add(26);
}
Services.obs.removeObserver(migrationObserver, "Migration:Ended");
Services.obs.removeObserver(migrationObserver, "Migration:ItemError");
Services.prefs.setCharPref(kAutoMigrateFinishedPref, Date.now().toString());
@ -61,7 +64,7 @@ const AutoMigrate = {
Services.obs.addObserver(migrationObserver, "Migration:ItemError", false);
Services.prefs.setCharPref(kAutoMigrateStartedPref, Date.now().toString());
migrator.migrate(this.resourceTypesToUse, profileStartup, profileToMigrate);
histogram.add("migrate-called-without-exceptions");
histogram.add(20);
},
/**

View File

@ -4451,14 +4451,14 @@
"releaseChannelCollection": "opt-out",
"description": "The browser that was the default on the initial profile migration. The values correspond to the internal browser ID (see MigrationUtils.jsm)"
},
"FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_SUCCEEDED": {
"FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_PROCESS_SUCCESS": {
"bug_numbers": [1271775],
"alert_emails": ["gijs@mozilla.com"],
"expires_in_version": "53",
"kind": "count",
"keyed": true,
"kind": "enumerated",
"n_values": 27,
"releaseChannelCollection": "opt-out",
"description": "Where automatic migration was attempted, indicates to what degree we succeeded."
"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_DATA_RECENCY": {
"bug_numbers": [1276694],