Bug 1656994: Track how much longer language pack updates take than app update downloads in telemetry. r=mhowell

Uses a linear histogram with buckets of 30 seconds centred around 5 minutes.

Depends on D86273

Differential Revision: https://phabricator.services.mozilla.com/D86274
This commit is contained in:
Dave Townsend 2020-08-07 19:12:25 +00:00
Родитель 6bc311374b
Коммит a0825f1e6e
3 изменённых файлов: 50 добавлений и 2 удалений

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

@ -6777,6 +6777,18 @@
"description": "Update: Result code from downloading a partial update via BITS",
"operating_systems": ["windows"]
},
"UPDATE_LANGPACK_OVERTIME": {
"record_in_processes": ["main"],
"products": ["firefox"],
"alert_emails": ["application-update-telemetry-alerts@mozilla.com", "dtownsend@mozilla.com"],
"expires_in_version": "never",
"kind": "linear",
"high": 600,
"n_buckets": 22,
"releaseChannelCollection": "opt-out",
"bug_numbers": [1656994],
"description": "Update: How much longer langpacks took to download than the app update in seconds."
},
"UPTAKE_REMOTE_CONTENT_RESULT_1": {
"record_in_processes": ["all"],
"products": ["firefox", "fennec", "thunderbird"],

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

@ -4573,6 +4573,10 @@ Downloader.prototype = {
})
.finally(() => {
this._langPackTimeout = null;
if (TelemetryStopwatch.running("UPDATE_LANGPACK_OVERTIME", update)) {
TelemetryStopwatch.finish("UPDATE_LANGPACK_OVERTIME", update);
}
});
LangPackUpdates.set(
@ -5424,6 +5428,14 @@ Downloader.prototype = {
// If we're still waiting on language pack updates then run a timer to time
// out the attempt after an appropriate amount of time.
if (this._langPackTimeout) {
// Start a timer to measure how much longer it takes for the language
// packs to stage.
TelemetryStopwatch.start(
"UPDATE_LANGPACK_OVERTIME",
unwrap(this._update),
{ inSeconds: true }
);
setTimeout(
this._langPackTimeout,
Services.prefs.getIntPref(

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

@ -11,8 +11,9 @@ const { PromiseUtils } = ChromeUtils.import(
"resource://gre/modules/PromiseUtils.jsm"
);
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
gDebugTest = true;
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
);
AddonTestUtils.init(this);
setupTestCommon();
@ -66,6 +67,10 @@ add_task(async function init() {
});
add_task(async function testLangpackUpdateSuccess() {
let histogram = TelemetryTestUtils.getAndClearHistogram(
"UPDATE_LANGPACK_OVERTIME"
);
let updateDownloadNotified = false;
let notified = waitForEvent("update-downloaded").then(
() => (updateDownloadNotified = true)
@ -99,6 +104,14 @@ add_task(async function testLangpackUpdateSuccess() {
resolve();
await notified;
// Because we resolved the lang pack call after the download completed a value
// should have been recorded in telemetry.
let snapshot = histogram.snapshot();
Assert.ok(
!Object.values(snapshot.values).every(val => val == 0),
"Should have recorded a time"
);
});
add_task(async function testLangpackUpdateFails() {
@ -186,6 +199,9 @@ add_task(async function testRedownload() {
// download the complete mar. We should only call the add-ons manager to stage
// language packs once in this case.
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false);
let histogram = TelemetryTestUtils.getAndClearHistogram(
"UPDATE_LANGPACK_OVERTIME"
);
let partialPatch = getRemotePatchString({
type: "partial",
@ -239,6 +255,14 @@ add_task(async function testRedownload() {
Assert.equal(downloadCount, 2, "Should have seen two downloads");
Assert.equal(stageCount, 1, "Should have only tried to stage langpacks once");
// Because we resolved the lang pack call before the download completed a value
// should not have been recorded in telemetry.
let snapshot = histogram.snapshot();
Assert.ok(
Object.values(snapshot.values).every(val => val == 0),
"Should have recorded a time"
);
});
add_task(async function finish() {