зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1379125
- Track dicarded for size pending ping with TelemetryHealthPing. r=gfritzsche
--HG-- extra : rebase_source : 0c888483fac948cbf70da1834e9c0fbbd022a2bb
This commit is contained in:
Родитель
e372b0a90f
Коммит
3cfadb8e23
|
@ -48,6 +48,8 @@ XPCOMUtils.defineLazyGetter(this, "gDeletionPingFilePath", function() {
|
|||
});
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
|
||||
"resource://services-common/utils.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryHealthPing",
|
||||
"resource://gre/modules/TelemetryHealthPing.jsm");
|
||||
// Maxmimum time, in milliseconds, archive pings should be retained.
|
||||
const MAX_ARCHIVED_PINGS_RETENTION_MS = 60 * 24 * 60 * 60 * 1000; // 60 days
|
||||
|
||||
|
@ -1365,6 +1367,10 @@ var TelemetryStorageImpl = {
|
|||
.add(Math.floor(fileSize / 1024 / 1024));
|
||||
Telemetry.getHistogramById("TELEMETRY_PING_SIZE_EXCEEDED_PENDING").add();
|
||||
TelemetryStopwatch.cancel("TELEMETRY_PENDING_LOAD_MS");
|
||||
|
||||
// Currently we don't have the ping type available without loading the ping from disk.
|
||||
// Bug 1384903 will fix that.
|
||||
TelemetryHealthPing.recordDiscardedPing("<unknown>");
|
||||
throw new Error("loadPendingPing - exceeded the maximum ping size: " + fileSize);
|
||||
}
|
||||
|
||||
|
@ -1598,6 +1604,10 @@ var TelemetryStorageImpl = {
|
|||
Telemetry.getHistogramById("TELEMETRY_DISCARDED_PENDING_PINGS_SIZE_MB")
|
||||
.add(Math.floor(info.size / 1024 / 1024));
|
||||
Telemetry.getHistogramById("TELEMETRY_PING_SIZE_EXCEEDED_PENDING").add();
|
||||
|
||||
// Currently we don't have the ping type available without loading the ping from disk.
|
||||
// Bug 1384903 will fix that.
|
||||
TelemetryHealthPing.recordDiscardedPing("<unknown>");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ pingDiscardedForSize
|
|||
The ``pingDiscardedForSize`` field contains the information about top ten pings, whose size exceeded the
|
||||
ping size limit (1 mb). This field lists the number of discarded pings per ping type.
|
||||
|
||||
The ping type "<unknown>" is used to indicate that a pending pings size exceeded the limit. This is because we don't have the pending pings type available cheaply at the moment.
|
||||
|
||||
This field is optional.
|
||||
|
||||
sendFailure
|
||||
|
|
|
@ -240,6 +240,53 @@ add_task(async function test_sendOnlyTopTenDiscardedPings() {
|
|||
});
|
||||
});
|
||||
|
||||
add_task(async function test_discardedForSizePending() {
|
||||
TelemetryHealthPing.testReset();
|
||||
PingServer.clearRequests();
|
||||
|
||||
const PING_TYPE = "discarded-for-size-pending";
|
||||
|
||||
const OVERSIZED_PING_ID = "9b21ec8f-f762-4d28-a2c1-44e1c4694f24";
|
||||
// Create a pending oversized ping.
|
||||
let overSizedPayload = generateRandomString(2 * 1024 * 1024);
|
||||
const OVERSIZED_PING = {
|
||||
id: OVERSIZED_PING_ID,
|
||||
type: PING_TYPE,
|
||||
creationDate: (new Date()).toISOString(),
|
||||
// Generate a 2MB string to use as the ping payload.
|
||||
payload: overSizedPayload,
|
||||
};
|
||||
|
||||
// Test loadPendingPing.
|
||||
await TelemetryStorage.savePendingPing(OVERSIZED_PING);
|
||||
// Try to manually load the oversized ping.
|
||||
await Assert.rejects(TelemetryStorage.loadPendingPing(OVERSIZED_PING_ID),
|
||||
"The oversized ping should have been pruned.");
|
||||
|
||||
let ping = await PingServer.promiseNextPing();
|
||||
checkHealthPingStructure(ping, {
|
||||
[TelemetryHealthPing.FailureType.DISCARDED_FOR_SIZE]: {
|
||||
"<unknown>": 1
|
||||
},
|
||||
"os": TelemetryHealthPing.OsInfo,
|
||||
"reason": TelemetryHealthPing.Reason.IMMEDIATE
|
||||
});
|
||||
|
||||
// Test _scanPendingPings.
|
||||
TelemetryHealthPing.testReset();
|
||||
await TelemetryStorage.savePendingPing(OVERSIZED_PING);
|
||||
await TelemetryStorage.loadPendingPingList();
|
||||
|
||||
ping = await PingServer.promiseNextPing();
|
||||
checkHealthPingStructure(ping, {
|
||||
[TelemetryHealthPing.FailureType.DISCARDED_FOR_SIZE]: {
|
||||
"<unknown>": 1
|
||||
},
|
||||
"os": TelemetryHealthPing.OsInfo,
|
||||
"reason": TelemetryHealthPing.Reason.IMMEDIATE
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_usePingSenderOnShutdown() {
|
||||
if (gIsAndroid ||
|
||||
(AppConstants.platform == "linux" && OS.Constants.Sys.bits == 32)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче