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

Unified Diff: components/metrics/metrics_reporting_scheduler.cc

Issue 979363003: UMA: use a more frequent upload interval for Chromecast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adds upload interval to client Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/metrics/metrics_reporting_scheduler.cc
diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc
index fb5461bd92e38717caaffc01a902118fa4f58de5..2101df607275a78d1c84ce984426ffe1514afe3c 100644
--- a/components/metrics/metrics_reporting_scheduler.cc
+++ b/components/metrics/metrics_reporting_scheduler.cc
@@ -5,7 +5,6 @@
#include "components/metrics/metrics_reporting_scheduler.h"
#include "base/compiler_specific.h"
-#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "components/variations/variations_associated_data.h"
@@ -35,14 +34,6 @@ const int kUnsentLogsIntervalSeconds = 3;
const int kUnsentLogsIntervalSeconds = 15;
#endif
-// Standard interval between log uploads, in seconds.
-#if defined(OS_ANDROID) || defined(OS_IOS)
-const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes.
-const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes.
-#else
-const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes.
-#endif
-
// When uploading metrics to the server fails, we progressively wait longer and
// longer before sending the next log. This backoff process helps reduce load
// on a server that is having issues.
@@ -71,41 +62,18 @@ void LogActualUploadInterval(TimeDelta interval) {
50);
}
-// Returns upload interval specified for the current experiment running.
-// TODO(gayane): Only for experimenting with upload interval for Android
-// (bug: 17391128). Should be removed once the experiments are done.
-base::TimeDelta GetUploadIntervalFromExperiment() {
- std::string interval_str = variations::GetVariationParamValue(
- "UMALogUploadInterval", "interval");
- int interval;
- if (interval_str.empty() || !base::StringToInt(interval_str, &interval))
- return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
-
- return TimeDelta::FromMinutes(interval);
-}
-
-#if defined(OS_ANDROID) || defined(OS_IOS)
-// Returns true if the user is assigned to the experiment group for enabled
-// cellular uploads.
-bool IsCellularEnabledByExperiment() {
- const std::string group_name =
- base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload");
- return group_name == "Enabled";
-}
-#endif
-
} // anonymous namespace
MetricsReportingScheduler::MetricsReportingScheduler(
const base::Closure& upload_callback,
- const base::Callback<void(bool*)>& cellular_callback)
+ const base::Callback<base::TimeDelta(void)>& upload_interval_callback)
: upload_callback_(upload_callback),
upload_interval_(TimeDelta::FromSeconds(kInitialUploadIntervalSeconds)),
running_(false),
callback_pending_(false),
init_task_complete_(false),
waiting_for_init_task_complete_(false),
- cellular_callback_(cellular_callback) {
+ upload_interval_callback_(upload_interval_callback) {
}
MetricsReportingScheduler::~MetricsReportingScheduler() {}
@@ -206,15 +174,17 @@ void MetricsReportingScheduler::BackOffUploadInterval() {
}
base::TimeDelta MetricsReportingScheduler::GetStandardUploadInterval() {
-#if defined(OS_ANDROID) || defined(OS_IOS)
- bool is_cellular = false;
- if (!cellular_callback_.is_null())
- cellular_callback_.Run(&is_cellular);
+ return upload_interval_callback_.Run();
+}
- if (is_cellular && IsCellularEnabledByExperiment())
- return TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds);
-#endif
- return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
+base::TimeDelta MetricsReportingScheduler::GetUploadIntervalFromExperiment() {
Alexei Svitkine (slow) 2015/03/09 17:26:17 Hmm, I don't think we need this here anymore. Look
gayane -on leave until 09-2017 2015/03/09 18:18:36 Right, we don't need that anymore. The experiment
Alexei Svitkine (slow) 2015/03/09 18:20:42 Got it - I think given that this CL is already cha
gunsch 2015/03/13 00:48:25 Done.
+ std::string interval_str = variations::GetVariationParamValue(
+ "UMALogUploadInterval", "interval");
+ int interval;
+ if (interval_str.empty() || !base::StringToInt(interval_str, &interval))
+ return GetStandardUploadInterval();
+
+ return TimeDelta::FromMinutes(interval);
}
} // namespace metrics

Powered by Google App Engine
This is Rietveld 408576698