Bug 708123 - Add a telemetry probe for update status; r=rstrong

This commit is contained in:
Ehsan Akhgari 2011-12-09 11:37:16 -05:00
Родитель 67bd55b57f
Коммит 18b164c594
2 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -270,6 +270,11 @@ HISTOGRAM(PLACES_DATABASE_SIZE_PER_PAGE_B, 500, 10240, 20, EXPONENTIAL, "PLACES:
HISTOGRAM(PLACES_EXPIRATION_STEPS_TO_CLEAN, 1, 10, 10, LINEAR, "PLACES: Expiration steps to cleanup the database")
HISTOGRAM(PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS, 50, 500, 10, EXPONENTIAL, "PLACES: Time for first autocomplete result if > 50ms (ms)")
/**
* Updater telemetry.
*/
HISTOGRAM(UPDATE_STATUS, 0, 16004, 18, LINEAR, "Updater: the status of the latest update performed")
/**
* Thunderbird-specific telemetry.
*/

Просмотреть файл

@ -134,6 +134,7 @@ const STATE_FAILED = "failed";
// From updater/errors.h:
const WRITE_ERROR = 7;
const UNEXPECTED_ERROR = 8;
const ELEVATION_CANCELED = 9;
const CERT_ATTR_CHECK_FAILED_NO_UPDATE = 100;
@ -1363,6 +1364,7 @@ UpdateService.prototype = {
createInstance(Ci.nsIUpdatePrompt);
update.state = status;
this._submitTelemetryPing(status);
if (status == STATE_SUCCEEDED) {
update.statusText = gUpdateBundle.GetStringFromName("installSuccess");
@ -1426,6 +1428,31 @@ UpdateService.prototype = {
}
},
/**
* Submit the results of applying the update via telemetry.
*
* @param status
* The status of the update as read from the update.status file
*/
_submitTelemetryPing: function AUS__submitTelemetryPing(status) {
try {
let parts = status.split(":");
if ((parts.length == 1 && status != STATE_SUCCEEDED) ||
(parts.length > 1 && parts[0] != STATE_FAILED)) {
// we only want to report success or failure
return;
}
let result = 0; // 0 means success
if (parts.length > 1) {
result = parseInt(parts[1]) || UNEXPECTED_ERROR;
}
Services.telemetry.getHistogramById("UPDATE_STATUS").add(result);
} catch(e) {
// Don't allow any exception to be propagated.
Components.utils.reportError(e);
}
},
/**
* Notified when a timer fires
* @param timer