Bug 1024672 - Part 4: Add workaround to continue providing submission data using DailyCrashesMeasurement. r=gps

This commit is contained in:
Birunthan Mohanathas 2014-08-21 15:43:54 -07:00
parent b809847eaf
commit 404b11dccf
2 changed files with 46 additions and 0 deletions

View File

@ -1145,6 +1145,32 @@ CrashesProvider.prototype = Object.freeze({
this._log.info("Grabbing crash counts from crash manager.");
let crashCounts = yield this._manager.getCrashCountsByDay();
// TODO: CrashManager no longer stores submissions as crashes, but we still
// want to send the submission data to FHR. As a temporary workaround, we
// populate |crashCounts| with the submission data to match past behaviour.
// See bug 1056160.
let crashes = yield this._manager.getCrashes();
for (let crash of crashes) {
for (let [submissionID, submission] of crash.submissions) {
if (!submission.responseDate) {
continue;
}
let day = Metrics.dateToDays(submission.responseDate);
if (!crashCounts.has(day)) {
crashCounts.set(day, new Map());
}
let succeeded =
submission.result == this._manager.SUBMISSION_RESULT_OK;
let type = crash.type + "-submission-" + (succeeded ? "succeeded" :
"failed");
let count = (crashCounts.get(day).get(type) || 0) + 1;
crashCounts.get(day).set(type, count);
}
}
let m = this.getMeasurement("crashes", 5);
let fields = DailyCrashesMeasurement5.prototype.fields;

View File

@ -60,6 +60,19 @@ add_task(function* test_collect() {
manager.CRASH_TYPE_CRASH,
"pc", day1);
yield manager.addSubmissionAttempt("mc1", "sub1", day1);
yield manager.addSubmissionResult("mc1", "sub1", day1,
manager.SUBMISSION_RESULT_OK);
yield manager.addSubmissionAttempt("ch", "sub1", day1);
yield manager.addSubmissionResult("ch", "sub1", day1,
manager.SUBMISSION_RESULT_FAILED);
yield manager.addSubmissionAttempt("ch", "sub2", day1);
yield manager.addSubmissionResult("ch", "sub2", day1,
manager.SUBMISSION_RESULT_FAILED);
yield manager.addSubmissionAttempt("ch", "sub3", day1);
yield manager.addSubmissionResult("ch", "sub3", day1,
manager.SUBMISSION_RESULT_OK);
yield manager.addCrash(manager.PROCESS_TYPE_MAIN,
manager.CRASH_TYPE_HANG,
"mh", day2);
@ -89,6 +102,13 @@ add_task(function* test_collect() {
do_check_true(value.has("plugin-crash"));
do_check_eq(value.get("plugin-crash"), 1);
do_check_true(value.has("main-crash-submission-succeeded"));
do_check_eq(value.get("main-crash-submission-succeeded"), 1);
do_check_true(value.has("content-hang-submission-failed"));
do_check_eq(value.get("content-hang-submission-failed"), 2);
do_check_true(value.has("content-hang-submission-succeeded"));
do_check_eq(value.get("content-hang-submission-succeeded"), 1);
value = values.days.getDay(day2);
do_check_true(value.has("main-hang"));
do_check_eq(value.get("main-hang"), 1);