Bug 1956726 - Migrate histograms to use Glean APIs in toolkit/components/crashes/CrashManager.in.sys.mjs, r=chutten,gsvelto.
Differential Revision: https://phabricator.services.mozilla.com/D242911
This commit is contained in:
@@ -281,7 +281,8 @@ Crash reporting
|
||||
write, but you might want to respect ordering in that file and put your new
|
||||
code at the appropriate place.
|
||||
- Add entry in `PROCESS_CRASH_SUBMIT_ATTEMPT
|
||||
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/telemetry/Histograms.json#13403-13422>`_
|
||||
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/telemetry/Histograms.json#13403-13422>`_ and
|
||||
`submit_attempt` in `toolkit/components/crashes/metrics.yaml`.
|
||||
|
||||
Memory reporting
|
||||
################
|
||||
|
||||
@@ -175,9 +175,6 @@ function quotaManagerShutdownTimeoutLegacyToGlean(value) {
|
||||
* storeDir (string)
|
||||
* Directory we will use for our data store. This instance will write
|
||||
* data files into the directory specified.
|
||||
*
|
||||
* telemetryStoreSizeKey (string)
|
||||
* Telemetry histogram to report store size under.
|
||||
*/
|
||||
export var CrashManager = function (options) {
|
||||
for (let k in options) {
|
||||
@@ -193,9 +190,6 @@ export var CrashManager = function (options) {
|
||||
Object.defineProperty(this, key, { value });
|
||||
break;
|
||||
}
|
||||
case "telemetryStoreSizeKey":
|
||||
this._telemetryStoreSizeKey = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error("Unknown property in options: " + k);
|
||||
@@ -1145,10 +1139,7 @@ CrashManager.prototype = Object.freeze({
|
||||
permissions: 0o700,
|
||||
});
|
||||
|
||||
let store = new CrashStore(
|
||||
this._storeDir,
|
||||
this._telemetryStoreSizeKey
|
||||
);
|
||||
let store = new CrashStore(this._storeDir);
|
||||
await store.load();
|
||||
|
||||
this._store = store;
|
||||
@@ -1240,13 +1231,9 @@ var gCrashManager;
|
||||
*
|
||||
* @param storeDir (string)
|
||||
* Directory the store should be located in.
|
||||
* @param telemetrySizeKey (string)
|
||||
* The telemetry histogram that should be used to store the size
|
||||
* of the data file.
|
||||
*/
|
||||
export function CrashStore(storeDir, telemetrySizeKey) {
|
||||
export function CrashStore(storeDir) {
|
||||
this._storeDir = storeDir;
|
||||
this._telemetrySizeKey = telemetrySizeKey;
|
||||
|
||||
this._storePath = PathUtils.join(storeDir, "store.json.mozlz4");
|
||||
|
||||
@@ -1440,9 +1427,7 @@ CrashStore.prototype = Object.freeze({
|
||||
tmpPath: this._storePath + ".tmp",
|
||||
compress: true,
|
||||
});
|
||||
if (this._telemetrySizeKey) {
|
||||
Services.telemetry.getHistogramById(this._telemetrySizeKey).add(size);
|
||||
}
|
||||
Glean.crash.compressedStoreSize.accumulate(size);
|
||||
} catch (ex) {
|
||||
// This operation might fail during shutdown, tough luck.
|
||||
console.error(ex);
|
||||
@@ -1722,9 +1707,7 @@ CrashStore.prototype = Object.freeze({
|
||||
}
|
||||
|
||||
submission.requestDate = date;
|
||||
Services.telemetry
|
||||
.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_ATTEMPT")
|
||||
.add(crash.type, 1);
|
||||
Glean.crash.submitAttempt[crash.type].add(1);
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -1743,6 +1726,8 @@ CrashStore.prototype = Object.freeze({
|
||||
|
||||
submission.responseDate = date;
|
||||
submission.result = result;
|
||||
// Needs bug 1657470 (New Metric Type: "Keyed Categorical") before
|
||||
// this can be migrated to Glean.
|
||||
Services.telemetry
|
||||
.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_SUCCESS")
|
||||
.add(crash.type, result == "ok");
|
||||
@@ -1843,9 +1828,7 @@ ChromeUtils.defineLazyGetter(CrashManager, "Singleton", function () {
|
||||
return gCrashManager;
|
||||
}
|
||||
|
||||
gCrashManager = new CrashManager({
|
||||
telemetryStoreSizeKey: "CRASH_STORE_COMPRESSED_BYTES",
|
||||
});
|
||||
gCrashManager = new CrashManager({});
|
||||
|
||||
// Automatically aggregate event files shortly after startup. This
|
||||
// ensures it happens with some frequency.
|
||||
|
||||
@@ -177,7 +177,6 @@ export var getManager = function () {
|
||||
submittedDumpsDir: submittedD,
|
||||
eventsDirs: [eventsD1, eventsD2],
|
||||
storeDir: storeD,
|
||||
telemetryStoreSizeKey: "CRASH_STORE_COMPRESSED_BYTES",
|
||||
});
|
||||
|
||||
return m;
|
||||
|
||||
@@ -482,6 +482,63 @@ crash:
|
||||
send_in_pings:
|
||||
- crash
|
||||
|
||||
compressed_store_size:
|
||||
type: memory_distribution
|
||||
description: >
|
||||
Size (in bytes) of the compressed crash store JSON file.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
exponential histogram CRASH_STORE_COMPRESSED_BYTES.
|
||||
memory_unit: byte
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1950710
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1950710
|
||||
notification_emails:
|
||||
- crash-reporting-wg@mozilla.org
|
||||
- stability@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: CRASH_STORE_COMPRESSED_BYTES
|
||||
|
||||
submit_attempt:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
An attempt to submit a crash. Keyed on the CrashManager Crash.type.
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry count
|
||||
histogram PROCESS_CRASH_SUBMIT_ATTEMPT.
|
||||
labels:
|
||||
- main-crash
|
||||
- main-hang
|
||||
- content-crash
|
||||
- content-hang
|
||||
- plugin-crash
|
||||
- plugin-hang
|
||||
- gmplugin-crash
|
||||
- gmplugin-hang
|
||||
- gpu-crash
|
||||
- gpu-hang
|
||||
- vr-crash
|
||||
- vr-hang
|
||||
- rdd-crash
|
||||
- rdd-hang
|
||||
- socket-crash
|
||||
- socket-hang
|
||||
- utility-crash
|
||||
- utility-hang
|
||||
- sandboxbroker-crash
|
||||
- sandboxbroker-hang
|
||||
- forkserver-crash
|
||||
- forkserver-hang
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1950710
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1950710
|
||||
notification_emails:
|
||||
- crash-reporting-wg@mozilla.org
|
||||
- stability@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: h#PROCESS_CRASH_SUBMIT_ATTEMPT
|
||||
|
||||
crash.windows:
|
||||
error_reporting:
|
||||
|
||||
Reference in New Issue
Block a user