Index: components/domain_reliability/context.cc |
diff --git a/components/domain_reliability/context.cc b/components/domain_reliability/context.cc |
index f0ce6c54c624cb15f1273495d72d5b9c84cc1a83..bcd0d7fc8907845f2c0d99f98b4b811ba39505df 100644 |
--- a/components/domain_reliability/context.cc |
+++ b/components/domain_reliability/context.cc |
@@ -11,6 +11,7 @@ |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
#include "base/metrics/sparse_histogram.h" |
+#include "base/rand_util.h" |
#include "base/values.h" |
#include "components/domain_reliability/dispatcher.h" |
#include "components/domain_reliability/uploader.h" |
@@ -69,16 +70,17 @@ DomainReliabilityContext::~DomainReliabilityContext() { |
void DomainReliabilityContext::OnBeacon( |
scoped_ptr<DomainReliabilityBeacon> beacon) { |
bool success = (beacon->status == "ok"); |
- |
- bool reported = config().DecideIfShouldReportRequest(success); |
- UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", reported); |
- if (!reported) { |
+ double sample_rate = config().GetSampleRate(success); |
+ bool report = base::RandDouble() < sample_rate; |
jkarlin
2015/12/09 11:46:22
nit: s/report/should_report/
report sounds like a
Deprecated (see juliatuttle)
2015/12/10 17:04:23
Done, and same for evicted => should_evict.
|
+ UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", report); |
+ if (!report) { |
// If the beacon isn't queued to be reported, it definitely cannot evict |
// an older beacon. (This histogram is also logged below based on whether |
// an older beacon was actually evicted.) |
LogOnBeaconDidEvictHistogram(false); |
return; |
} |
+ beacon->sample_rate = sample_rate; |
UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.ReportedBeaconError", |
-beacon->chrome_error); |