зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1423715 - Add crash type keys to the crash manager histogram definitions; r=frank
This patch the list of process and crash types that can be recorded in a keyed histogram by the crash manager; the relevant pattern was updated to match these kesy. A test was also added to ensure that no new crash types can be added without also updating Histograms.json. This also fixes a related existing test. MozReview-Commit-ID: FKUZHd17a3V --HG-- extra : rebase_source : 4e5003701d7c3119eecbc678aa50ce03b4edb2a0
This commit is contained in:
Родитель
fe83515dd8
Коммит
6b558f197c
|
@ -5,6 +5,7 @@
|
|||
|
||||
var {CrashStore, CrashManager} = ChromeUtils.import("resource://gre/modules/CrashManager.jsm", {});
|
||||
ChromeUtils.import("resource://gre/modules/osfile.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryEnvironment.jsm", this);
|
||||
|
||||
ChromeUtils.import("resource://testing-common/CrashManagerTest.jsm", this);
|
||||
|
@ -612,3 +613,44 @@ add_task(async function test_setRemoteCrashID() {
|
|||
await m.setRemoteCrashID("main-crash", "bp-1");
|
||||
Assert.equal((await m.getCrashes())[0].remoteID, "bp-1");
|
||||
});
|
||||
|
||||
add_task(async function test_telemetryHistogram() {
|
||||
let Telemetry = Services.telemetry;
|
||||
let h = Telemetry.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_ATTEMPT");
|
||||
h.clear();
|
||||
Telemetry.clearScalars();
|
||||
|
||||
let m = await getManager();
|
||||
let processTypes = [];
|
||||
let crashTypes = [];
|
||||
|
||||
// Gather all process and crash types
|
||||
for (let field in m) {
|
||||
if (field.startsWith("PROCESS_TYPE_")) {
|
||||
processTypes.push(m[field]);
|
||||
} else if (field.startsWith("CRASH_TYPE_")) {
|
||||
crashTypes.push(m[field]);
|
||||
}
|
||||
}
|
||||
|
||||
let keysCount = 0;
|
||||
let keys = [];
|
||||
|
||||
for (let processType of processTypes) {
|
||||
for (let crashType of crashTypes) {
|
||||
let key = processType + "-" + crashType;
|
||||
|
||||
keys.push(key);
|
||||
h.add(key, 1);
|
||||
keysCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we have the expected keys.
|
||||
let snap = h.snapshot();
|
||||
Assert.equal(Object.keys(snap).length, keysCount,
|
||||
"Some crash types have not been recorded, see the list in Histograms.json");
|
||||
Assert.deepEqual(Object.keys(snap).sort(), keys.sort(),
|
||||
"Some crash types do not match");
|
||||
});
|
||||
|
||||
|
|
|
@ -11101,6 +11101,18 @@
|
|||
"expires_in_version": "never",
|
||||
"kind": "count",
|
||||
"keyed": true,
|
||||
"keys": [
|
||||
"main-crash",
|
||||
"main-hang",
|
||||
"content-crash",
|
||||
"content-hang",
|
||||
"plugin-crash",
|
||||
"plugin-hang",
|
||||
"gmplugin-crash",
|
||||
"gmplugin-hang",
|
||||
"gpu-crash",
|
||||
"gpu-hang"
|
||||
],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "An attempt to submit a crash. Keyed on the CrashManager Crash.type."
|
||||
},
|
||||
|
|
|
@ -1019,7 +1019,7 @@ add_task(async function test_keyed_keys() {
|
|||
|
||||
// Check that we have the expected keys.
|
||||
let snap = h.snapshot();
|
||||
Assert.ok(Object.keys(snap).length, 2, "Only 2 keys must be recorded.");
|
||||
Assert.equal(Object.keys(snap).length, 2, "Only 2 keys must be recorded.");
|
||||
Assert.ok("testkey" in snap, "'testkey' must be recorded.");
|
||||
Assert.ok("thirdKey" in snap, "'thirdKey' must be recorded.");
|
||||
Assert.deepEqual(snap.testkey.counts, [0, 1, 0],
|
||||
|
|
Загрузка…
Ссылка в новой задаче