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

Unified Diff: components/domain_reliability/context_manager.cc

Issue 2466093002: Domain Reliability: Add more upload-related histograms. (Closed)
Patch Set: A couple of tweaks. Created 4 years, 1 month 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
« no previous file with comments | « components/domain_reliability/context_manager.h ('k') | components/domain_reliability/uploader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/domain_reliability/context_manager.cc
diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc
index bcdb530de64d7b639438cf5a11e4fec6af57598c..81811c940c8edce21988bb2801e79904dbf33b29 100644
--- a/components/domain_reliability/context_manager.cc
+++ b/components/domain_reliability/context_manager.cc
@@ -6,6 +6,8 @@
#include <utility>
+#include "base/metrics/histogram_macros.h"
+
namespace domain_reliability {
DomainReliabilityContextManager::DomainReliabilityContextManager(
@@ -24,7 +26,16 @@ void DomainReliabilityContextManager::RouteBeacon(
if (!context)
return;
- context->OnBeacon(std::move(beacon));
+ bool queued = context->OnBeacon(std::move(beacon));
+ if (!queued)
+ return;
+
+ base::TimeTicks now = base::TimeTicks::Now();
+ if (!last_routed_beacon_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("DomainReliability.BeaconIntervalGlobal",
+ now - last_routed_beacon_time_);
+ }
+ last_routed_beacon_time_ = now;
}
void DomainReliabilityContextManager::SetConfig(
@@ -45,7 +56,10 @@ void DomainReliabilityContextManager::SetConfig(
// pending beacons and collector backoff state. Therefore, don't do so
// needlessly; make sure the config has actually changed before recreating
// the context.
- if (contexts_[key]->config().Equals(*config)) {
+ bool config_same = contexts_[key]->config().Equals(*config);
+ UMA_HISTOGRAM_BOOLEAN("DomainReliability.SetConfigRecreatedContext",
+ !config_same);
+ if (!config_same) {
DVLOG(1) << "Ignoring unchanged NEL header for existing origin "
<< origin.spec() << ".";
return;
« no previous file with comments | « components/domain_reliability/context_manager.h ('k') | components/domain_reliability/uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698