Closed
Bug 1423715
Opened 7 years ago
Closed 7 years ago
Add CrashType keys to Crash Manager Histogram Definitions
Categories
(Toolkit :: Crash Reporting, enhancement)
Toolkit
Crash Reporting
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: frank, Assigned: gsvelto)
References
Details
Attachments
(1 file)
No description provided.
Reporter | ||
Updated•7 years ago
|
Summary: Add CrashType keys to Crash Manager Histograms → Add CrashType keys to Crash Manager Histogram Definitions
Comment 1•7 years ago
|
||
David, do you know who could fill these out?
Component: Telemetry → Crash Reporting
Flags: needinfo?(ddurst)
Comment 2•7 years ago
|
||
I don't, but I assume that gsvelto can speak to this?
Flags: needinfo?(ddurst) → needinfo?(gsvelto)
Assignee | ||
Comment 3•7 years ago
|
||
I'd be happy to help if you point me to what needs fixing. I'm not super-familiar with telemetry so I'm not sure where to find these definitions. Leaving the NI? for now.
Updated•7 years ago
|
Flags: needinfo?(fbertsch)
Reporter | ||
Comment 4•7 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #3)
> I'd be happy to help if you point me to what needs fixing. I'm not
> super-familiar with telemetry so I'm not sure where to find these
> definitions. Leaving the NI? for now.
What needs updating is just the probe definitions [0]. That links to `PROCESS_CRASH_SUBMIT_ATTEMPT`, but we need any probes that are keyed on CrashManager's Crash.Type. They need to add a `keys` element, with a list of allowed keys [1]. Make sense?
[0] https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/Histograms.json#11169
[1] https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/Histograms.json#7444
Flags: needinfo?(fbertsch)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Assignee | ||
Comment 7•7 years ago
|
||
Patch attached, I've added a test to ensure we can't accidentally add a new type to the crash manager w/o updating the list in Histograms.json and since I was at it I fixed the related test, it was a simple type that caused a check to always evaluate as true. I've also had to update the regular expression used to match the keys because it didn't allow for dashes in the names (and the crash manager uses them).
Reporter | ||
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8959485 [details]
Bug 1423715 - Add crash type keys to the crash manager histogram definitions;
https://reviewboard.mozilla.org/r/228276/#review234156
::: toolkit/components/crashes/tests/xpcshell/test_crash_manager.js:629
(Diff revision 1)
> + let processTypes = [];
> + let crashTypes = [];
> +
> + // Gather all process and crash types
> + for (let field in m) {
> + if (field.startsWith("PROCESS_TYPE_")) {
Are this and `"CRASH_TYPE_"` available as constants?
::: toolkit/components/crashes/tests/xpcshell/test_crash_manager.js:647
(Diff revision 1)
> + }
> + }
> +
> + // Check that we have the expected keys.
> + let snap = h.snapshot();
> + Assert.equal(Object.keys(snap).length, keysCount,
Should this actually test that the values in the arrays are the same, not just the lengths?
::: toolkit/components/telemetry/Histograms.json:11208
(Diff revision 1)
> "record_in_processes": ["main", "content"],
> "expires_in_version": "never",
> "kind": "boolean",
> "keyed": true,
> "releaseChannelCollection": "opt-out",
> "description": "The submission status when main/plugin/content crashes are submitted. 1 is success, 0 is failure. Keyed on the CrashManager Crash.type."
We want to also add the keys to every other probe that is keyed on `CrashManager Crash.Type`, including this one. Are there any others?
::: toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js:1022
(Diff revision 1)
> h.add("thirdKey", false);
> h.add("not-allowed", true);
>
> // 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.");
This should be `3` now, right? Since `not-allowed` is now an allowed key? I recommend adding a disallowed char to `"not-allowed"`.
Attachment #8959485 -
Flags: review?(fbertsch) → review-
Assignee | ||
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8959485 [details]
Bug 1423715 - Add crash type keys to the crash manager histogram definitions;
https://reviewboard.mozilla.org/r/228276/#review234170
::: toolkit/components/crashes/tests/xpcshell/test_crash_manager.js:629
(Diff revision 1)
> + let processTypes = [];
> + let crashTypes = [];
> +
> + // Gather all process and crash types
> + for (let field in m) {
> + if (field.startsWith("PROCESS_TYPE_")) {
No, they're declared as fields in the CrashManager object: https://searchfox.org/mozilla-central/rev/6e96a3f1e44e286ddae5fdafab737709741d237a/toolkit/components/crashes/CrashManager.jsm#181
I want to make sure that the test will break if somebody adds a new type w/o also adding it to Histograms.json.
::: toolkit/components/crashes/tests/xpcshell/test_crash_manager.js:647
(Diff revision 1)
> + }
> + }
> +
> + // Check that we have the expected keys.
> + let snap = h.snapshot();
> + Assert.equal(Object.keys(snap).length, keysCount,
Good point, I'll add those checks.
::: toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js:1022
(Diff revision 1)
> h.add("thirdKey", false);
> h.add("not-allowed", true);
>
> // 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.");
`"not-allowed"` is rejected because it's not part of the listed keys not because it has a dash in the name, the call fails here:
https://searchfox.org/mozilla-central/rev/6e96a3f1e44e286ddae5fdafab737709741d237a/toolkit/components/telemetry/TelemetryHistogram.cpp#479
The change to allow the dash in the pattern is required only at build time when parse_histograms.py is run. That being said your comment made me have a second look at that file and I found this comment:
https://searchfox.org/mozilla-central/rev/6e96a3f1e44e286ddae5fdafab737709741d237a/toolkit/components/telemetry/parse_histograms.py#290
So in hindsight adding a dash there is not a good idea.... Shall I change the way the crash manager assembles those keys to using an underscore instead of a dash?
Assignee | ||
Comment 10•7 years ago
|
||
Back from parental leave and ready to give this another go. Quick question before I proceed though, what should I do about the regexp in CPP_IDENTIFIER_PATTERN? That's supposed to keep the data in a format that makes it easy to turn it into C++ identifiers, however the existing code will not conform to it since it uses dashes in between the process type and crash type. Shall I change [1] to use an underscore instead? Or should I relax the regexp like I did in the patch?
[1] https://searchfox.org/mozilla-central/rev/f5fb323246bf22a3a3b4185882a1c5d8a2c02996/toolkit/components/crashes/CrashManager.jsm#1349
Flags: needinfo?(fbertsch)
Reporter | ||
Comment 11•7 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #10)
> Back from parental leave and ready to give this another go. Quick question
> before I proceed though, what should I do about the regexp in
> CPP_IDENTIFIER_PATTERN? That's supposed to keep the data in a format that
> makes it easy to turn it into C++ identifiers, however the existing code
> will not conform to it since it uses dashes in between the process type and
> crash type. Shall I change [1] to use an underscore instead? Or should I
> relax the regexp like I did in the patch?
Okay great! And congratulations :)
We don't actually generate CPP Identifiers on histogram keys, so we can remove that check. We should replace it with a similar check (for e.g. length and less constraining special chars), but can definitely include dashes and underscores both.
Flags: needinfo?(fbertsch)
Assignee | ||
Comment 12•7 years ago
|
||
Thanks! Should I remove that check in this patch or file another bug for that?
Reporter | ||
Comment 13•7 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #12)
> Thanks! Should I remove that check in this patch or file another bug for
> that?
I think it makes sense to file another bug with that patch, have one of the client engineers review it, and once that is merged we can then add these keys to the definition. Sound good?
Assignee | ||
Comment 14•7 years ago
|
||
Alright, will do.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 16•7 years ago
|
||
Updated patch with comments addressed. Sorry for the garbage in the interdiff but I had to rebase to pick up the changes in bug 1451288.
Reporter | ||
Comment 17•7 years ago
|
||
mozreview-review |
Comment on attachment 8959485 [details]
Bug 1423715 - Add crash type keys to the crash manager histogram definitions;
https://reviewboard.mozilla.org/r/228276/#review234180
::: toolkit/components/crashes/tests/xpcshell/test_crash_manager.js:629
(Diff revision 1)
> + let processTypes = [];
> + let crashTypes = [];
> +
> + // Gather all process and crash types
> + for (let field in m) {
> + if (field.startsWith("PROCESS_TYPE_")) {
Got it, that makes a sense to me.
::: toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js:1022
(Diff revision 1)
> h.add("thirdKey", false);
> h.add("not-allowed", true);
>
> // 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.");
Okay, let's do this: Remove the dash from `CPP_INDENTIFER_PATTERN`, but also remove the check using that pattern on histogram keys (since CPP identifiers are not generated from histogram keys).
Attachment #8959485 -
Flags: review?(fbertsch) → review+
Reporter | ||
Comment 18•7 years ago
|
||
Whoops, that was an old comment -- you can ignore it.
Assignee | ||
Comment 19•7 years ago
|
||
Thanks! Landing this.
Comment 20•7 years ago
|
||
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c783649db622
Add crash type keys to the crash manager histogram definitions; r=frank
Comment 21•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in
before you can comment on or make changes to this bug.
Description
•