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

Unified Diff: components/domain_reliability/context.cc

Issue 1497803004: Domain Reliability: Add sample_rate field to Beacon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/domain_reliability/context.cc
diff --git a/components/domain_reliability/context.cc b/components/domain_reliability/context.cc
index f0ce6c54c624cb15f1273495d72d5b9c84cc1a83..1852296df617598043e25426a982415b37481f1e 100644
--- a/components/domain_reliability/context.cc
+++ b/components/domain_reliability/context.cc
@@ -70,7 +70,8 @@ void DomainReliabilityContext::OnBeacon(
scoped_ptr<DomainReliabilityBeacon> beacon) {
bool success = (beacon->status == "ok");
- bool reported = config().DecideIfShouldReportRequest(success);
+ double sample_rate;
+ bool reported = config().DecideIfShouldReportRequest(success, &sample_rate);
jkarlin 2015/12/07 14:57:27 DecideIfShouldReportRequest needs to be renamed. I
Deprecated (see juliatuttle) 2015/12/07 20:17:57 Acknowledged.
UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", reported);
if (!reported) {
// If the beacon isn't queued to be reported, it definitely cannot evict
@@ -79,6 +80,7 @@ void DomainReliabilityContext::OnBeacon(
LogOnBeaconDidEvictHistogram(false);
return;
}
+ beacon->weight = 1.0 / sample_rate;
jkarlin 2015/12/07 14:57:27 Division by 0 is possible here. config.cc's IsVali
jkarlin 2015/12/07 18:06:53 I realized you can't actually get here if it's 0.0
Deprecated (see juliatuttle) 2015/12/07 20:17:57 Acknowledged.
Deprecated (see juliatuttle) 2015/12/07 20:17:57 Yes, it's potentially wrong in the case of evicted
UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.ReportedBeaconError",
-beacon->chrome_error);

Powered by Google App Engine
This is Rietveld 408576698