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

Side by Side Diff: components/domain_reliability/context.cc

Issue 1785143003: [Domain Reliability: Monitor] Report beacon if the go away is detected, regardless of request statu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set sample rate to 1.0 if beacon is sent for receives goway for port migration Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/domain_reliability/context.h" 5 #include "components/domain_reliability/context.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 last_network_change_time_(last_network_change_time), 63 last_network_change_time_(last_network_change_time),
64 weak_factory_(this) {} 64 weak_factory_(this) {}
65 65
66 DomainReliabilityContext::~DomainReliabilityContext() { 66 DomainReliabilityContext::~DomainReliabilityContext() {
67 ClearBeacons(); 67 ClearBeacons();
68 } 68 }
69 69
70 void DomainReliabilityContext::OnBeacon( 70 void DomainReliabilityContext::OnBeacon(
71 scoped_ptr<DomainReliabilityBeacon> beacon) { 71 scoped_ptr<DomainReliabilityBeacon> beacon) {
72 bool success = (beacon->status == "ok"); 72 bool success = (beacon->status == "ok");
73 double sample_rate = config().GetSampleRate(success); 73 double sample_rate = beacon->details.quic_port_migration_detected
Deprecated (see juliatuttle) 2016/03/14 13:19:20 nit: I'd prefer you do this with should_report, no
Zhongyi Shi 2016/03/14 17:12:42 I think the idea here is that 1. we want to report
Deprecated (see juliatuttle) 2016/03/14 17:18:35 Oh, you're right, I forgot we were recording sampl
74 ? 1.0
75 : config().GetSampleRate(success);
74 bool should_report = base::RandDouble() < sample_rate; 76 bool should_report = base::RandDouble() < sample_rate;
75 UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", should_report); 77 UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", should_report);
76 if (!should_report) { 78 if (!should_report) {
77 // If the beacon isn't queued to be reported, it definitely cannot evict 79 // If the beacon isn't queued to be reported, it definitely cannot evict
78 // an older beacon. (This histogram is also logged below based on whether 80 // an older beacon. (This histogram is also logged below based on whether
79 // an older beacon was actually evicted.) 81 // an older beacon was actually evicted.)
80 LogOnBeaconDidEvictHistogram(false); 82 LogOnBeaconDidEvictHistogram(false);
81 return; 83 return;
82 } 84 }
83 beacon->sample_rate = sample_rate; 85 beacon->sample_rate = sample_rate;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 delete beacons_.front(); 250 delete beacons_.front();
249 beacons_.pop_front(); 251 beacons_.pop_front();
250 252
251 // If that just removed a beacon counted in uploading_beacons_size_, decrement 253 // If that just removed a beacon counted in uploading_beacons_size_, decrement
252 // that. 254 // that.
253 if (uploading_beacons_size_ > 0) 255 if (uploading_beacons_size_ > 0)
254 --uploading_beacons_size_; 256 --uploading_beacons_size_;
255 } 257 }
256 258
257 } // namespace domain_reliability 259 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/beacon.cc ('k') | components/domain_reliability/context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698