Bug 1907625 - Measure final backup archive size r=backup-reviewers,mconley
Measure final backup archive size to nearest mebibyte in order to understand how much disk space we are using on users' computers in order to back up their data Differential Revision: https://phabricator.services.mozilla.com/D216708
This commit is contained in:
@@ -92,6 +92,10 @@ async function testCreateBackupHelper(sandbox, taskFn) {
|
||||
let totalBackupSizeHistogram = TelemetryTestUtils.getAndClearHistogram(
|
||||
"BROWSER_BACKUP_TOTAL_BACKUP_SIZE"
|
||||
);
|
||||
// Handle for the metric for total byte size of single-file archive
|
||||
let compressedArchiveSizeHistogram = TelemetryTestUtils.getAndClearHistogram(
|
||||
"BROWSER_BACKUP_COMPRESSED_ARCHIVE_SIZE"
|
||||
);
|
||||
// Handle for the metric for total time taking by profile backup
|
||||
let backupTimerHistogram = TelemetryTestUtils.getAndClearHistogram(
|
||||
"BROWSER_BACKUP_TOTAL_BACKUP_TIME_MS"
|
||||
@@ -196,11 +200,12 @@ async function testCreateBackupHelper(sandbox, taskFn) {
|
||||
"Snapshots directory should have had all staging folders cleaned up"
|
||||
);
|
||||
|
||||
// 1 mebibyte minimum recorded value if staging folder is under 1 mebibyte
|
||||
// 1 mebibyte minimum recorded value if total data size is under 1 mebibyte
|
||||
// This assumes that these BackupService tests do not create sizable fake files
|
||||
const SMALLEST_BACKUP_SIZE_BYTES = 1048576;
|
||||
const SMALLEST_BACKUP_SIZE_MEBIBYTES = 1;
|
||||
|
||||
// Validate total (uncompressed profile data) size
|
||||
let totalBackupSize = Glean.browserBackup.totalBackupSize.testGetValue();
|
||||
Assert.equal(
|
||||
totalBackupSize.count,
|
||||
@@ -218,6 +223,25 @@ async function testCreateBackupHelper(sandbox, taskFn) {
|
||||
1
|
||||
);
|
||||
|
||||
// Validate final archive (compressed/encrypted profile data + HTML) size
|
||||
let compressedArchiveSize =
|
||||
Glean.browserBackup.compressedArchiveSize.testGetValue();
|
||||
Assert.equal(
|
||||
compressedArchiveSize.count,
|
||||
1,
|
||||
"Should have collected a single measurement for the backup compressed archive size"
|
||||
);
|
||||
Assert.equal(
|
||||
compressedArchiveSize.sum,
|
||||
SMALLEST_BACKUP_SIZE_BYTES,
|
||||
"Should have collected the right value for the backup compressed archive size"
|
||||
);
|
||||
TelemetryTestUtils.assertHistogram(
|
||||
compressedArchiveSizeHistogram,
|
||||
SMALLEST_BACKUP_SIZE_MEBIBYTES,
|
||||
1
|
||||
);
|
||||
|
||||
// Check that resources were called from highest to lowest backup priority.
|
||||
sinon.assert.callOrder(
|
||||
FakeBackupResource3.prototype.backup,
|
||||
|
||||
Reference in New Issue
Block a user