Bug 1615087 - Remove expiring BITS update telemetry, supporting code, and tests specific to it r=mhowell

This patch is effectively very close to backing out Bug 1539154, which added telemetry to monitor download times of BITS vs our internal downloader. This was useful to make sure we weren't worsening update times when we added BITS support. But at this point, these probes have outlived their usefulness to us.

Also adds the TelemetryTestUtils import to browser/components/urlbar/tests/browser/interventions_update/head.js since it was relying on that being imported in toolkit/mozapps/update/tests/data/shared.js where it is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D64477

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kirk Steuber 2020-02-27 17:56:29 +00:00
parent a9947c9768
commit d06097f7b6
24 changed files with 7 additions and 1995 deletions

View File

@ -26,6 +26,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarProviderInterventions:
"resource:///modules/UrlbarProviderInterventions.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.jsm",
});
// For each intervention type, a search string that trigger the intervention.

View File

@ -3671,972 +3671,6 @@ update:
operating_systems:
- windows
update.startup:
from_app_version:
bug_numbers:
- 1539154
- 1578262
description: >
Records the previous application version that the update was applied to
when the update makes it to the last phase where the application has
exited and started.
expires: "76"
kind: string
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- 'main'
mar_partial_size_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes of a partial update MAR file when
the update makes it to the last phase where the application has exited and
started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
mar_complete_size_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes of a complete update MAR file when
the update makes it to the last phase where the application has exited and
started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
update.startup.intervals:
check:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the check phase of the update process
when an update makes it to the last phase where the application has exited
and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
download_bits_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the BITS downloader for a partial update MAR file when the
update makes it to the last phase where the application has exited and
and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
download_bits_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the BITS downloader for a complete update MAR file when the
update makes it to the last phase where the application has exited and
started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
download_internal_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the internal application downloader for a partial update MAR
file when the update makes it to the last phase where the application has
exited and and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
download_internal_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the internal application downloader for a complete update
MAR file when the update makes it to the last phase where the application
has exited and and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
stage_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the stage phase of the update process
for a partial update MAR file when the update makes it to the last phase
where the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
stage_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the stage phase of the update process
for a complete update MAR file when the update makes it to the last phase
where the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
apply_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the apply phase of the update process
for a partial update MAR file when the update makes it to the last phase
where the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
apply_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the apply phase of the update process
for a complete update MAR file when the update makes it to the last phase
where the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
update.startup.downloads:
bits_partial_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the BITS downloader for
a partial update MAR file when the update makes it to the last phase where
the application has exited and started. This value can be different than
the size of the update MAR file because the value is only monitored
during the initial download while the application is running and not if
the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_partial_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the BITS downloader for a
partial update MAR file when the update makes it to the last phase where
the application has exited and started. This value can be used with the
value of update.startup.downloads.bits_partial_bytes to estimate the bytes
per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_complete_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the BITS downloader for
a complete update MAR file when the update makes it to the last phase
where the application has exited and started. This value can be different
than the size of the update MAR file because the value is only monitored
during the initial download while the application is running and not if
the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_complete_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the BITS downloader for a
complete update MAR file when the update makes it to the last phase where
the application has exited and started. This value can be used with the
value of update.startup.downloads.bits_complete_bytes to estimate the
bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
internal_partial_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the internal application
downloader for a partial update MAR file when the update makes it to the
last phase where the application has exited and started. This value can be
different than the size of the update MAR file because the value is only
monitored during the initial download while the application is running and
not if the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_partial_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the internal application
downloader for a partial update MAR file when the update makes it to the
last phase where the application has exited and started. This value can be
used with the value of update.startup.downloads.internal_partial_bytes to
estimate the bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_complete_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded by the internal
application downloader for a complete update MAR file when an update makes
it to the last phase where the application has exited and started. This
value can be different than the size of the update MAR file because the
value is only monitored during the initial download while the
application is running and not if the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_complete_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the internal application
downloader for a complete update MAR file when the update makes it to the
last phase where the application has exited and started. This value can be
used with the value of update.startup.downloads.internal_complete_bytes to
estimate the bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
update.session:
from_app_version:
bug_numbers:
- 1539154
- 1578262
description: >
Records the previous application version that the update was applied to
when the update has finished due to a failure before the application has
exited and started.
expires: "76"
kind: string
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- 'main'
mar_partial_size_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes of a partial update MAR file when
the update has finished due to a failure before the application has exited
and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
mar_complete_size_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes of a complete update MAR file when
the update has finished due to a failure before the application has exited
and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
update.session.intervals:
check:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the check phase of the update process
when an update has finished due to a failure before the application has
exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
download_bits_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the BITS downloader for a partial update MAR file when the
update has finished due to a failure before the application has exited
and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
download_bits_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the BITS downloader for a complete update MAR file when the
update has finished due to a failure before the application has exited and
started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
download_internal_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the internal application downloader for a partial update MAR
file when the update has finished due to a failure before the application
has exited and and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
download_internal_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the download phase of the update
process using the internal application downloader for a complete update
MAR file when the update has finished due to a failure before the
application has exited and and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
stage_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the stage phase of the update process
for a partial update MAR file when the update has finished due to a
failure before the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
stage_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the stage phase of the update process
for a complete update MAR file when the update has finished due to a
failure before the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
apply_partial:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the apply phase of the update process
for a partial update MAR file when the update has finished due to a
failure before the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
apply_complete:
bug_numbers:
- 1539154
- 1578262
description: >
Records the interval in seconds of the apply phase of the update process
for a complete update MAR file when the update has finished due to a
failure before the application has exited and started.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
update.session.downloads:
bits_partial_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the BITS downloader for
a partial update MAR file when the update has finished due to a failure
before the application has exited and started. This value can be
different than the size of the update MAR file because the value is only
monitored during the initial download while the application is running and
not if the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_partial_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the BITS downloader for a
partial update MAR file when the update has finished due to a failure
before the application has exited and started. This value can be used with
the value of update.session.downloads.bits_partial_bytes to estimate the
bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_complete_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the BITS downloader for
a complete update MAR file when the update has finished due to a failure
before the application has exited and started. This value can be different
than the size of the update MAR file because the value is only monitored
during the initial download while the application is running and not if
the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
bits_complete_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the BITS downloader for a
complete update MAR file when the update has finished due to a failure
before the application has exited and started. This value can be used with
the value of update.session.downloads.bits_complete_bytes to estimate the
bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
operating_systems:
- "windows"
internal_partial_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded using the internal
application downloader for a partial update MAR file when the update has
finished due to a failure before the application has exited and started.
This value can be different than the size of the update MAR file because
the value is only monitored during the initial download while the
application is running and not if the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_partial_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the internal application
downloader for a partial update MAR file when the update has finished due
to a failure before the application has exited and started. This value can
be used with the value of update.session.downloads.internal_partial_bytes
to estimate the bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_complete_bytes:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of bytes downloaded by the internal
application downloader for a complete update MAR file when an update has
finished due to a failure before the application has exited and started.
This value can be different than the size of the update MAR file because
the value is only monitored during the initial download while the
application is running and not if the download is resumed.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
internal_complete_seconds:
bug_numbers:
- 1539154
- 1578262
description: >
Records the total number of seconds spent downloading during the initial
download without exiting the application using the internal application
downloader for a complete update MAR file when the update has finished due
to a failure before the application has exited and started. This value can
be used with the value of update.session.downloads.internal_complete_bytes
to estimate the bytes per second for the download.
expires: "76"
kind: uint
keyed: false
notification_emails:
- application-update-telemetry-alerts@mozilla.com
- rstrong@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
- 'geckoview'
record_in_processes:
- main
# The following section contains search counters.
browser.search:
with_ads:

View File

@ -252,8 +252,6 @@ var gLogfileWritePromise;
// at once. Computers with many users (ex: a school computer), should not end
// up with dozens of BITS jobs.
var gBITSInUseByAnotherUser = false;
// The start time in milliseconds of the update check.
var gCheckStartMs;
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function aus_gLogEnabled() {
return (
@ -2199,18 +2197,8 @@ UpdateService.prototype = {
// be resumed the next time the application starts. Downloads using
// Windows BITS are not stopped since they don't require Firefox to be
// running to perform the download.
if (this._downloader) {
if (!this._downloader.usingBits) {
this.stopDownload();
} else {
this._downloader.cleanup();
// The BITS downloader isn't stopped on exit so the
// active-update.xml needs to be saved for the values sent to
// telemetry to be saved to disk.
Cc["@mozilla.org/updates/update-manager;1"]
.getService(Ci.nsIUpdateManager)
.saveUpdates();
}
if (this._downloader && !this._downloader.usingBits) {
this.stopDownload();
}
// Prevent leaking the downloader (bug 454964)
this._downloader = null;
@ -2445,14 +2433,6 @@ UpdateService.prototype = {
update.errorCode = parseInt(parts[1]);
}
if (
update.state == STATE_SUCCEEDED ||
update.patchCount == 1 ||
(update.selectedPatch && update.selectedPatch.type == "complete")
) {
AUSTLMY.pingUpdatePhases(update, true);
}
if (status != STATE_SUCCEEDED) {
// Rotate the update logs so the update log isn't removed. By passing
// false the patch directory won't be removed.
@ -3709,9 +3689,6 @@ UpdateManager.prototype = {
return;
}
let patch = update.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
patch.setProperty("stageFinished", Math.ceil(Date.now() / 1000));
var status = readStatusFile(getUpdatesDir());
pingStateAndStatusCodes(update, false, status);
var parts = status.split(":");
@ -3739,20 +3716,6 @@ UpdateManager.prototype = {
writeStatusFile(getUpdatesDir(), (update.state = STATE_APPLIED_SERVICE));
}
if (update.state == STATE_FAILED) {
AUSTLMY.pingUpdatePhases(update, false);
}
if (
update.state == STATE_APPLIED ||
update.state == STATE_APPLIED_SERVICE ||
update.state == STATE_PENDING ||
update.state == STATE_PENDING_SERVICE ||
update.state == STATE_PENDING_ELEVATE
) {
patch.setProperty("applyStart", Math.floor(Date.now() / 1000));
}
// Now that the active update's properties have been updated write the
// active-update.xml to disk. Since there have been no changes to the update
// history the updates.xml will not be written to disk.
@ -3932,7 +3895,6 @@ Checker.prototype = {
throw Cr.NS_ERROR_NULL_POINTER;
}
gCheckStartMs = Date.now();
let UpdateServiceInstance = UpdateServiceFactory.createInstance();
// |force| can override |canCheckForUpdates| since |force| indicates a
// manual update check. But nothing should override enterprise policies.
@ -4245,17 +4207,6 @@ Downloader.prototype = {
*/
_bitsActiveNotifications: false,
/**
* The start time of the first download attempt in milliseconds for telemetry.
*/
_startDownloadMs: null,
/**
* The name of the downloader being used to download the update. This is used
* when setting property names on the update patch for telemetry.
*/
_downloaderName: null,
/**
* Cancels the active download.
*
@ -4533,20 +4484,12 @@ Downloader.prototype = {
AUSTLMY.pingDownloadCode(undefined, AUSTLMY.DWNLD_ERR_NO_UPDATE_PATCH);
return readStatusFile(updateDir);
}
// QI the update and the patch to nsIWritablePropertyBag so it isn't
// necessary later in the download code.
// The update and the patch implement nsIWritablePropertyBag. Expose that
// interface immediately after a patch is assigned so that
// this.(_patch|_update).(get|set)Property can always safely be called.
this._update.QueryInterface(Ci.nsIWritablePropertyBag);
if (gCheckStartMs && !this._update.getProperty("checkInterval")) {
let interval = Math.max(
Math.ceil((Date.now() - gCheckStartMs) / 1000),
1
);
this._update.setProperty("checkInterval", interval);
}
// this._patch implements nsIWritablePropertyBag. Expose that interface
// immediately after a patch is assigned so that this._patch.getProperty
// and this._patch.setProperty can always safely be called.
this._patch.QueryInterface(Ci.nsIWritablePropertyBag);
this.isCompleteUpdate = this._patch.type == "complete";
let canUseBits = false;
@ -4560,14 +4503,6 @@ Downloader.prototype = {
canUseBits = this._canUseBits(this._patch);
}
this._downloaderName = canUseBits ? "bits" : "internal";
if (!this._patch.getProperty(this._downloaderName + "DownloadStart")) {
this._patch.setProperty(
this._downloaderName + "DownloadStart",
Math.floor(Date.now() / 1000)
);
}
if (!canUseBits) {
let patchFile = getUpdatesDir().clone();
patchFile.append(FILE_UPDATE_MAR);
@ -4886,19 +4821,6 @@ Downloader.prototype = {
.saveUpdates();
}
}
// Only record the download bytes per second when there isn't already a
// value for the bytes per second so downloads that are already in progess
// don't have their records overwritten. When the Update Agent is
// implemented this should be reworked so that telemetry receives the bytes
// and seconds it took to complete for the entire update download instead of
// just the sample that is currently recorded. Note: this._patch has already
// been QI'd to nsIWritablePropertyBag.
if (
!this._patch.getProperty("internalBytes") &&
!this._patch.getProperty("bitsBytes")
) {
this._startDownloadMs = Date.now();
}
// Make shallow copy in case listeners remove themselves when called.
let listeners = this._listeners.concat();
@ -4926,11 +4848,6 @@ Downloader.prototype = {
maxProgress
) {
LOG("Downloader:onProgress - progress: " + progress + "/" + maxProgress);
if (this._startDownloadMs) {
let seconds = Math.round((Date.now() - this._startDownloadMs) / 1000);
this._patch.setProperty(this._downloaderName + "Seconds", seconds);
this._patch.setProperty(this._downloaderName + "Bytes", progress);
}
if (progress > this._patch.size) {
LOG(
@ -5087,10 +5004,6 @@ Downloader.prototype = {
"retryTimeout: " +
retryTimeout
);
this._patch.setProperty(
this._downloaderName + "DownloadFinished",
Math.floor(Date.now() / 1000)
);
if (Components.isSuccessCode(status)) {
if (this._verifyDownload()) {
if (shouldUseService()) {
@ -5322,7 +5235,6 @@ Downloader.prototype = {
10
);
AUSTLMY.pingUpdatePhases(this._update, false);
if (downloadAttempts > maxAttempts) {
LOG(
"Downloader:onStopRequest - notifying observers of error. " +
@ -5370,7 +5282,6 @@ Downloader.prototype = {
this._update.name
);
gUpdateFileWriteInfo = { phase: "stage", failure: false };
this._patch.setProperty("stageStart", Math.floor(Date.now() / 1000));
// Stage the update
try {
Cc["@mozilla.org/updates/update-processor;1"]
@ -5386,9 +5297,6 @@ Downloader.prototype = {
shouldShowPrompt = true;
}
}
} else {
this._patch.setProperty("applyStart", Math.floor(Date.now() / 1000));
um.saveUpdates();
}
}

View File

@ -14,14 +14,6 @@ const { BitsError, BitsUnknownError } = ChromeUtils.import(
);
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
// It is possible for the update.session telemetry to be set more than once
// which must be prevented since they are scalars and setting them more than
// once could lead to values set in the first ping not being present in the
// next ping which would make the values incomprehensible in relation to the
// other values. This isn't needed for update.startup since this will only be
// set once during startup.
var gUpdatePhasesSetForSession = false;
var AUSTLMY = {
// Telemetry for the application update background update check occurs when
// the background update timer fires after the update interval which is
@ -458,130 +450,6 @@ var AUSTLMY = {
}
},
/**
* Submit the update phase telemetry. These are scalars and must only be
* submitted once per sesssion. The update.startup is only submitted once
* once per session due to it only being submitted during startup and only the
* first call to pingUpdatePhases for update.session will be submitted.
*
* @param aUpdate
* The update object which contains the values to submit to telemetry.
* @param aIsStartup
* If true the telemetry will be set under update.startup and if false
* the telemetry will be set under update.session. When false
* subsequent calls will return early and not submit telemetry.
*/
pingUpdatePhases: function UT_pingUpdatePhases(aUpdate, aIsStartup) {
if (!aIsStartup && !Cu.isInAutomation) {
if (gUpdatePhasesSetForSession) {
return;
}
gUpdatePhasesSetForSession = true;
}
let basePrefix = aIsStartup ? "update.startup." : "update.session.";
// None of the calls to getProperty should fail.
try {
let update = aUpdate.QueryInterface(Ci.nsIWritablePropertyBag);
let scalarSet = Services.telemetry.scalarSet;
// Though it is possible that the previous app version that was updated
// from could change the record is for the app version that initiated the
// update.
scalarSet(basePrefix + "from_app_version", aUpdate.previousAppVersion);
// The check interval only happens once even if the partial patch fails
// to apply on restart and the complete patch is downloaded.
scalarSet(
basePrefix + "intervals.check",
update.getProperty("checkInterval")
);
for (let i = 0; i < aUpdate.patchCount; ++i) {
let patch = aUpdate
.getPatchAt(i)
.QueryInterface(Ci.nsIWritablePropertyBag);
let type = patch.type;
scalarSet(basePrefix + "mar_" + type + "_size_bytes", patch.size);
let prefix = basePrefix + "intervals.";
let internalDownloadStart = patch.getProperty("internalDownloadStart");
let internalDownloadFinished = patch.getProperty(
"internalDownloadFinished"
);
if (
internalDownloadStart !== null &&
internalDownloadFinished !== null
) {
scalarSet(
prefix + "download_internal_" + type,
Math.max(internalDownloadFinished - internalDownloadStart, 1)
);
}
let bitsDownloadStart = patch.getProperty("bitsDownloadStart");
let bitsDownloadFinished = patch.getProperty("bitsDownloadFinished");
if (bitsDownloadStart !== null && bitsDownloadFinished !== null) {
scalarSet(
prefix + "download_bits_" + type,
Math.max(bitsDownloadFinished - bitsDownloadStart, 1)
);
}
let stageStart = patch.getProperty("stageStart");
let stageFinished = patch.getProperty("stageFinished");
if (stageStart !== null && stageFinished !== null) {
scalarSet(
prefix + "stage_" + type,
Math.max(stageFinished - stageStart, 1)
);
}
// Both the partial and the complete patch are recorded for the apply
// interval because it is possible for a partial patch to fail when it
// is applied during a restart and then to try the complete patch.
let applyStart = patch.getProperty("applyStart");
if (applyStart !== null) {
let applyFinished = Math.ceil(Date.now() / 1000);
scalarSet(
prefix + "apply_" + type,
Math.max(applyFinished - applyStart, 1)
);
}
prefix = basePrefix + "downloads.";
let internalBytes = patch.getProperty("internalBytes");
if (internalBytes !== null) {
scalarSet(
prefix + "internal_" + type + "_bytes",
Math.max(internalBytes, 1)
);
}
let internalSeconds = patch.getProperty("internalSeconds");
if (internalSeconds !== null) {
scalarSet(
prefix + "internal_" + type + "_seconds",
Math.max(internalSeconds, 1)
);
}
let bitsBytes = patch.getProperty("bitsBytes");
if (bitsBytes !== null) {
scalarSet(prefix + "bits_" + type + "_bytes", Math.max(bitsBytes, 1));
}
let bitsSeconds = patch.getProperty("bitsSeconds");
if (bitsSeconds !== null) {
scalarSet(
prefix + "bits_" + type + "_seconds",
Math.max(bitsSeconds, 1)
);
}
}
} catch (e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for a boolean type histogram that indicates if the
* service is installed and a telemetry ping for a boolean type histogram that

View File

@ -69,22 +69,6 @@ prefs =
[browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js]
[browser_doorhanger_bc_downloaded_disableBITS.js]
# Telemetry Application Update Tests
[browser_telemetry_completeBadSize.js]
[browser_telemetry_partialBadSize_completeBadSize.js]
[browser_telemetry_complete_stageFailure.js]
[browser_telemetry_partial_stageFailure_complete_stageFailure.js]
[browser_telemetry_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_stageFailure.js]
[browser_telemetry_partial_applyFailure_complete_applied.js]
[browser_telemetry_partial_applyFailure_complete_staged_applied.js]
[browser_telemetry_partialBadSize_complete_staged_applied.js]
[browser_telemetry_complete_applied.js]
[browser_telemetry_partial_applied.js]
[browser_telemetry_partial_staged_applied.js]
[browser_telemetry_complete_staged_applied.js]
# Telemetry Update Ping Tests
[browser_telemetry_updatePing_downloaded_ready.js]
[browser_telemetry_updatePing_staged_ready.js]

View File

@ -87,23 +87,6 @@ reason = test must be able to prevent file deletion.
[browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js]
[browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js]
# Telemetry Application Update Tests
[browser_telemetry_completeBadSize.js]
[browser_telemetry_partialBadSize_completeBadSize.js]
[browser_telemetry_complete_stageFailure.js]
[browser_telemetry_partial_stageFailure_complete_stageFailure.js]
[browser_telemetry_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_stageFailure.js]
[browser_telemetry_partial_applyFailure_complete_applied.js]
[browser_telemetry_partial_applyFailure_complete_staged_applied.js]
[browser_telemetry_partialBadSize_complete_staged_applied.js]
[browser_telemetry_complete_applied.js]
[browser_telemetry_partial_applied.js]
[browser_telemetry_partial_staged_applied.js]
[browser_telemetry_complete_staged_applied.js]
# Elevation Dialog Tests
[browser_elevationDialog.js]

View File

@ -67,19 +67,3 @@ prefs =
[browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js]
[browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js]
[browser_doorhanger_bc_downloaded_disableBITS.js]
# Telemetry Application Update Tests
[browser_telemetry_completeBadSize.js]
[browser_telemetry_partialBadSize_completeBadSize.js]
[browser_telemetry_complete_stageFailure.js]
[browser_telemetry_partial_stageFailure_complete_stageFailure.js]
[browser_telemetry_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_stageFailure.js]
[browser_telemetry_partial_applyFailure_complete_applied.js]
[browser_telemetry_partial_applyFailure_complete_staged_applied.js]
[browser_telemetry_partialBadSize_complete_staged_applied.js]
[browser_telemetry_complete_applied.js]
[browser_telemetry_partial_applied.js]
[browser_telemetry_partial_staged_applied.js]
[browser_telemetry_complete_staged_applied.js]

View File

@ -86,22 +86,5 @@ reason = test must be able to prevent file deletion.
[browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js]
[browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js]
# Telemetry Application Update Tests
[browser_telemetry_completeBadSize.js]
[browser_telemetry_partialBadSize_completeBadSize.js]
[browser_telemetry_complete_stageFailure.js]
[browser_telemetry_partial_stageFailure_complete_stageFailure.js]
[browser_telemetry_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_applyFailure.js]
[browser_telemetry_partial_applyFailure_complete_stageFailure.js]
[browser_telemetry_partial_applyFailure_complete_applied.js]
[browser_telemetry_partial_applyFailure_complete_staged_applied.js]
[browser_telemetry_partialBadSize_complete_staged_applied.js]
[browser_telemetry_complete_applied.js]
[browser_telemetry_partial_applied.js]
[browser_telemetry_partial_staged_applied.js]
[browser_telemetry_complete_staged_applied.js]
# Elevation Dialog Tests
[browser_elevationDialog.js]

View File

@ -1,24 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.session
// Complete patch only
// Complete patch download failure
add_task(async function telemetry_completeBadSize() {
let updateParams = "&completePatchOnly=1&invalidCompleteSize=1";
await runTelemetryUpdateTest(updateParams, "update-error");
let expected = getTelemetryUpdatePhaseValues({
forSession: true,
noPartialPatch: true,
completeBadSize: true,
});
checkTelemetryUpdatePhases(expected);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
});

View File

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Complete patch only
// Complete patch download
// Complete patch applied
add_task(async function telemetry_complete_applied() {
let updateParams = "&completePatchOnly=1";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noPartialPatch: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Complete patch only
// Complete patch download
// Complete patch apply failure
add_task(async function telemetry_complete_applyFailure() {
let updateParams = "&completePatchOnly=1";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noPartialPatch: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,29 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.session
// Complete patch only
// Complete patch download
// Complete patch stage failure
add_task(async function telemetry_complete_stageFailure() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let updateParams = "&completePatchOnly=1";
await runTelemetryUpdateTest(updateParams, "update-staged", true);
let expected = getTelemetryUpdatePhaseValues({
forSession: true,
noPartialPatch: true,
noApplyComplete: true,
});
checkTelemetryUpdatePhases(expected);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
});

View File

@ -1,30 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Complete patch only
// Complete patch download
// Complete patch staged
// Complete patch applied
add_task(async function telemetry_complete_staged_applied() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let updateParams = "&completePatchOnly=1";
await runTelemetryUpdateTest(updateParams, "update-staged");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noPartialPatch: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.session
// Partial and complete patches
// Partial patch download failure
// Complete patch download failure
add_task(async function telemetry_partialBadSize_completeBadSize() {
let updateParams = "&invalidPartialSize=1&invalidCompleteSize=1";
await runTelemetryUpdateTest(updateParams, "update-error");
let expected = getTelemetryUpdatePhaseValues({
forSession: true,
partialBadSize: true,
completeBadSize: true,
});
checkTelemetryUpdatePhases(expected);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
});

View File

@ -1,31 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download failure
// Complete patch download
// Complete patch staged
// Complete patch applied
add_task(async function telemetry_partialBadSize_complete_staged_applied() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let updateParams = "&invalidPartialSize=1";
await runTelemetryUpdateTest(updateParams, "update-staged");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
partialBadSize: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,26 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download
// Partial patch applied
add_task(async function telemetry_partial_applied() {
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noInternalComplete: true,
noBitsComplete: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,32 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download
// Partial patch apply failure
// Complete patch download
// Complete patch applied
add_task(async function telemetry_sp_partialBadSize_complete_staged_applied() {
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
// The download of the complete patch will happen automatically.
await waitForEvent("update-downloaded");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,32 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download
// Partial patch apply failure
// Complete patch download
// Complete patch apply failure
add_task(async function telemetry_partial_applyFailure_complete_applyFailure() {
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
// The download of the complete patch will happen automatically.
await waitForEvent("update-downloaded");
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1,43 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.session
// Partial and complete patches
// Partial patch download
// Partial patch apply failure
// Complete patch download
// Complete patch stage failure
add_task(async function telemetry_partial_applyFailure_complete_stageFailure() {
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
// Now that staging is enabled setup the test updater.
await setupTestUpdater();
// Remove the update-settings.ini file so staging fails.
removeUpdateSettingsIni();
// Fail applying the partial.
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
// Verify that update phase startup telemetry wasn't set.
checkTelemetryUpdatePhaseEmpty(true);
// The download and staging of the complete patch will happen automatically.
await waitForEvent("update-staged");
let expected = getTelemetryUpdatePhaseValues({
forSession: true,
noStagePartial: true,
noApplyComplete: true,
});
checkTelemetryUpdatePhases(expected);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
});

View File

@ -1,44 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download
// Partial patch apply failure
// Complete patch download
// Complete patch staged
// Complete patch applied
add_task(
async function telemetry_partial_applyFailure_complete_staged_applied() {
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-downloaded");
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
// Now that staging is enabled setup the test updater.
await setupTestUpdater();
// Fail applying the partial.
writeStatusFile(STATE_FAILED_CRC_ERROR);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
// The download and staging of the complete will happen automatically.
await waitForEvent("update-staged");
// Succeed applying the complete patch.
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noStagePartial: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
}
);

View File

@ -1,33 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.session
// Partial and complete patches
// Partial patch download
// Partial patch stage failure
// Complete patch download
// Complete patch stage failure
add_task(async function telemetry_partial_stageFailure_complete_stageFailure() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-staged", true);
await waitForEvent("update-staged");
let expected = getTelemetryUpdatePhaseValues({
forSession: true,
noApplyPartial: true,
noApplyComplete: true,
});
checkTelemetryUpdatePhases(expected);
testPostUpdateProcessing();
// Verify that update phase startup telemetry is empty.
checkTelemetryUpdatePhaseEmpty(true);
});

View File

@ -1,31 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Telemetry test for Application Update phases.
// Telemetry update.startup
// Partial and complete patches
// Partial patch download
// Partial patch staged
// Partial patch applied
add_task(async function telemetry_partial_staged_applied() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_APP_UPDATE_STAGING_ENABLED, true]],
});
let updateParams = "";
await runTelemetryUpdateTest(updateParams, "update-staged");
writeStatusFile(STATE_SUCCEEDED);
testPostUpdateProcessing();
let expected = getTelemetryUpdatePhaseValues({
noBitsComplete: true,
noInternalComplete: true,
});
checkTelemetryUpdatePhases(expected);
// Verify that update phase session telemetry is empty.
checkTelemetryUpdatePhaseEmpty(false);
});

View File

@ -1125,303 +1125,3 @@ function runTelemetryUpdateTest(updateParams, event, stageFailure = false) {
await waitForEvent(event);
})();
}
/**
* Gets an object with the expected update phase values that can be passed to
* checkTelemetryUpdatePhases for update phase telemetry tests.
*
* @param overrides
* Params which can override the default values.
* @return An object that can be passed to checkTelemetryUpdatePhases for update
* phase telemetry tests.
*/
/* This function is intentionally complex so tests don't have to be */
/* eslint-disable-next-line complexity */
function getTelemetryUpdatePhaseValues(overrides) {
let bitsEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_BITS_ENABLED);
// Set values that could never be recorded due to values that would prevent
// them from occurring. This makes it so callers only have to specify a couple
// of values.
if (overrides.noPartialPatch) {
if (!overrides.noInternalPartial) {
overrides.noInternalPartial = true;
}
if (!overrides.noBitsPartial) {
overrides.noBitsPartial = true;
}
}
if (overrides.noCompletePatch) {
if (!overrides.noInternalComplete) {
overrides.noInternalComplete = true;
}
if (!overrides.noBitsComplete) {
overrides.noBitsComplete = true;
}
}
if (
overrides.noPartialPatch ||
overrides.partialBadSize ||
overrides.noInternalPartial ||
overrides.noBitsPartial
) {
if (!overrides.noStagePartial) {
overrides.noStagePartial = true;
}
if (!overrides.noApplyPartial) {
overrides.noApplyPartial = true;
}
}
if (
overrides.noCompletePatch ||
overrides.completeBadSize ||
overrides.noInternalComplete ||
overrides.noBitsComplete
) {
if (!overrides.noStageComplete) {
overrides.noStageComplete = true;
}
if (!overrides.noApplyComplete) {
overrides.noApplyComplete = true;
}
}
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_STAGING_ENABLED)) {
if (!overrides.noStagePartial) {
overrides.noStagePartial = true;
}
if (!overrides.noStageComplete) {
overrides.noStageComplete = true;
}
}
let marSize = parseInt(SIZE_SIMPLE_MAR);
let partialSize = overrides.partialBadSize
? parseInt(SIZE_SIMPLE_MAR + "1")
: marSize;
let completeSize = overrides.completeBadSize
? parseInt(SIZE_SIMPLE_MAR + "1")
: marSize;
let partialDownloadBytes = overrides.partialBadSize ? 1 : marSize;
let completeDownloadBytes = overrides.completeBadSize ? 1 : marSize;
let obj = {};
obj.basePrefix = overrides.forSession ? "update.session." : "update.startup.";
obj.from_app_version = Services.appinfo.version;
obj.mars = {};
obj.mars.mar_partial_size_bytes = overrides.noPartialPatch
? null
: partialSize;
obj.mars.mar_complete_size_bytes = overrides.noCompletePatch
? null
: completeSize;
obj.intervals = {};
obj.intervals.check = 1;
if (bitsEnabled) {
obj.intervals.download_bits_partial = overrides.noBitsPartial ? null : 1;
obj.intervals.download_bits_complete = overrides.noBitsComplete ? null : 1;
if (overrides.partialBadSize) {
obj.intervals.download_internal_partial = overrides.noInternalPartial
? null
: 1;
} else {
obj.intervals.download_internal_partial = null;
}
if (overrides.completeBadSize) {
obj.intervals.download_internal_complete = overrides.noInternalComplete
? null
: 1;
} else {
obj.intervals.download_internal_complete = null;
}
} else {
obj.intervals.download_bits_partial = null;
obj.intervals.download_bits_complete = null;
obj.intervals.download_internal_partial = overrides.noInternalPartial
? null
: 1;
obj.intervals.download_internal_complete = overrides.noInternalComplete
? null
: 1;
}
obj.intervals.stage_partial = overrides.noStagePartial ? null : 1;
obj.intervals.stage_complete = overrides.noStageComplete ? null : 1;
obj.intervals.apply_partial = overrides.noApplyPartial ? null : 1;
obj.intervals.apply_complete = overrides.noApplyComplete ? null : 1;
obj.downloads = {};
obj.downloads.bits_partial_ = {};
obj.downloads.bits_complete_ = {};
obj.downloads.internal_partial_ = {};
obj.downloads.internal_complete_ = {};
if (bitsEnabled) {
obj.downloads.bits_partial_.bytes = overrides.noBitsPartial
? null
: partialDownloadBytes;
obj.downloads.bits_partial_.seconds = overrides.noBitsPartial ? null : 1;
obj.downloads.bits_complete_.bytes = overrides.noBitsComplete
? null
: completeDownloadBytes;
obj.downloads.bits_complete_.seconds = overrides.noBitsComplete ? null : 1;
if (overrides.partialBadSize) {
obj.downloads.internal_partial_.seconds = overrides.noInternalPartial
? null
: 1;
obj.downloads.internal_partial_.bytes = overrides.noInternalPartial
? null
: partialDownloadBytes;
} else {
obj.downloads.internal_partial_.bytes = null;
obj.downloads.internal_partial_.seconds = null;
}
if (overrides.completeBadSize) {
obj.downloads.internal_complete_.seconds = overrides.noInternalComplete
? null
: 1;
obj.downloads.internal_complete_.bytes = overrides.noInternalComplete
? null
: completeDownloadBytes;
} else {
obj.downloads.internal_complete_.bytes = null;
obj.downloads.internal_complete_.seconds = null;
}
} else {
obj.downloads.bits_partial_.bytes = null;
obj.downloads.bits_partial_.seconds = null;
obj.downloads.bits_complete_.bytes = null;
obj.downloads.bits_complete_.seconds = null;
obj.downloads.internal_partial_.bytes = overrides.noInternalPartial
? null
: partialDownloadBytes;
obj.downloads.internal_partial_.seconds = overrides.noInternalPartial
? null
: 1;
obj.downloads.internal_complete_.bytes = overrides.noInternalComplete
? null
: completeDownloadBytes;
obj.downloads.internal_complete_.seconds = overrides.noInternalComplete
? null
: 1;
}
return obj;
}
/**
* Checks the telemetry values for app update phases under either update.startup
* or update.session based on the object passed to this function.
*
* @param expected
* An object containing the expected results to compare against the
* actual results.
*/
function checkTelemetryUpdatePhases(expected) {
let scalars = TelemetryTestUtils.getProcessScalars("parent");
let basePrefix = expected.basePrefix;
let namePrefix = basePrefix;
{
let name = namePrefix + "from_app_version";
if (expected.from_app_version) {
Assert.ok(!!scalars[name], "The " + name + " value should exist.");
Assert.equal(
scalars[name],
expected.from_app_version,
"The " + name + " value should equal the expected value."
);
} else {
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}
}
for (let [nameSuffix, value] of Object.entries(expected.mars)) {
let name = namePrefix + nameSuffix;
if (value) {
Assert.ok(!!scalars[name], "The " + name + " value should exist.");
Assert.equal(
scalars[name],
value,
"The " + name + " value should equal the expected value."
);
} else {
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}
}
namePrefix = basePrefix + "intervals.";
for (let [suffix, value] of Object.entries(expected.intervals)) {
let name = namePrefix + suffix;
if (value) {
Assert.ok(!!scalars[name], "The " + name + " value should exist.");
Assert.greaterOrEqual(
scalars[name],
value,
"The " +
name +
" value should be equal to or " +
"greater than " +
value +
"."
);
} else {
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}
}
namePrefix = basePrefix + "downloads.";
for (let [nameMid, values] of Object.entries(expected.downloads)) {
let name = namePrefix + nameMid + "bytes";
if (values.bytes) {
Assert.ok(!!scalars[name], "The " + name + " value should exist.");
Assert.greaterOrEqual(
scalars[name],
values.bytes,
"The " +
name +
" value should be equal to or " +
"greater than " +
values.bytes +
"."
);
} else {
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}
name = namePrefix + nameMid + "seconds";
if (values.seconds) {
Assert.ok(!!scalars[name], "The " + name + " value should exist.");
Assert.greaterOrEqual(
scalars[name],
values.seconds,
"The " +
name +
" value should be equal to or " +
"greater than " +
values.seconds +
"."
);
} else {
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}
}
}
/**
* Checks whether telemetry for update.startup or update.session is set by
* checking if there is a value for the from_app_version scalar.
*
* @param isStartup
* When true update.startup.from_app_version will be checked and when
* false update.session.from_app_version will be checked.
*/
function checkTelemetryUpdatePhaseEmpty(isStartup) {
let scalars = TelemetryTestUtils.getProcessScalars("parent");
let name =
"update." + (isStartup ? "startup" : "session") + ".from_app_version";
Assert.ok(!scalars[name], "The " + name + " value should not exist.");
}

View File

@ -14,9 +14,6 @@ const { FileUtils } = ChromeUtils.import(
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,