| Index: net/reporting/reporting_report.cc
|
| diff --git a/net/reporting/reporting_report.cc b/net/reporting/reporting_report.cc
|
| index b039bc1cd415e21387b2f07add7395643f75ab77..37c4a22bd3decfa37d2af0a5f93502426407a7cd 100644
|
| --- a/net/reporting/reporting_report.cc
|
| +++ b/net/reporting/reporting_report.cc
|
| @@ -8,12 +8,22 @@
|
| #include <string>
|
| #include <utility>
|
|
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/time/time.h"
|
| #include "base/values.h"
|
| #include "url/gurl.h"
|
|
|
| namespace net {
|
|
|
| +namespace {
|
| +
|
| +void RecordReportOutcome(ReportingReport::Outcome outcome) {
|
| + UMA_HISTOGRAM_ENUMERATION("Reporting.ReportOutcome", outcome,
|
| + ReportingReport::Outcome::MAX);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| ReportingReport::ReportingReport(const GURL& url,
|
| const std::string& group,
|
| const std::string& type,
|
| @@ -25,8 +35,36 @@ ReportingReport::ReportingReport(const GURL& url,
|
| type(type),
|
| body(std::move(body)),
|
| queued(queued),
|
| - attempts(attempts) {}
|
| + attempts(attempts),
|
| + outcome(Outcome::UNKNOWN),
|
| + recorded_outcome(false) {}
|
| +
|
| +ReportingReport::~ReportingReport() {
|
| + DCHECK(recorded_outcome);
|
| +}
|
| +
|
| +// static
|
| +void ReportingReport::RecordReportDiscardedForNoURLRequestContext() {
|
| + RecordReportOutcome(Outcome::DISCARDED_NO_URL_REQUEST_CONTEXT);
|
| +}
|
| +
|
| +// static
|
| +void ReportingReport::RecordReportDiscardedForNoReportingService() {
|
| + RecordReportOutcome(Outcome::DISCARDED_NO_REPORTING_SERVICE);
|
| +}
|
| +
|
| +void ReportingReport::RecordOutcome(base::TimeTicks now) {
|
| + DCHECK(!recorded_outcome);
|
| +
|
| + RecordReportOutcome(outcome);
|
| +
|
| + if (outcome == Outcome::DELIVERED) {
|
| + UMA_HISTOGRAM_LONG_TIMES_100("Reporting.ReportDeliveredLatency",
|
| + now - queued);
|
| + UMA_HISTOGRAM_COUNTS_100("Reporting.ReportDeliveredAttempts", attempts);
|
| + }
|
|
|
| -ReportingReport::~ReportingReport() {}
|
| + recorded_outcome = true;
|
| +}
|
|
|
| } // namespace net
|
|
|