Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: components/certificate_reporting/error_reporter.cc

Issue 2120683002: Fix up certificate error reporting histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/certificate_reporting/error_reporter.cc
diff --git a/components/certificate_reporting/error_reporter.cc b/components/certificate_reporting/error_reporter.cc
index a4beff826a7383d2b476cb2840baaa1e833afb61..faf427ccd73c32367ebf960104bac16e542f02a9 100644
--- a/components/certificate_reporting/error_reporter.cc
+++ b/components/certificate_reporting/error_reporter.cc
@@ -11,6 +11,8 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/metrics/sparse_histogram.h"
#include "components/certificate_reporting/encrypted_cert_logger.pb.h"
#include "crypto/aead.h"
#include "crypto/curve25519.h"
@@ -98,18 +100,25 @@ bool EncryptSerializedReport(const uint8_t* server_public_key,
return true;
}
+// Records an UMA histogram of the net errors when certificate reports
+// fail to send.
+void RecordUMAOnFailure(const GURL& report_uri, int net_error) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.CertificateErrorReportFailure", -net_error);
+}
+
} // namespace
ErrorReporter::ErrorReporter(
net::URLRequestContext* request_context,
const GURL& upload_url,
net::ReportSender::CookiesPreference cookies_preference)
- : ErrorReporter(
- upload_url,
- kServerPublicKey,
- kServerPublicKeyVersion,
- base::WrapUnique(
- new net::ReportSender(request_context, cookies_preference))) {}
+ : ErrorReporter(upload_url,
+ kServerPublicKey,
+ kServerPublicKeyVersion,
+ base::WrapUnique(new net::ReportSender(
+ request_context,
+ cookies_preference,
+ base::Bind(RecordUMAOnFailure)))) {}
ErrorReporter::ErrorReporter(
const GURL& upload_url,

Powered by Google App Engine
This is Rietveld 408576698