Index: components/rappor/rappor_service.cc |
diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc |
index 67bc4aa0b29651f34e83878446994c088f8f0c31..72a3a5aae5c3bfe5c21720257b9db2f9997f3784 100644 |
--- a/components/rappor/rappor_service.cc |
+++ b/components/rappor/rappor_service.cc |
@@ -63,8 +63,12 @@ RapporService::~RapporService() { |
void RapporService::Start(PrefService* pref_service, |
net::URLRequestContextGetter* request_context) { |
const GURL server_url = GetServerUrl(); |
- if (!server_url.is_valid()) |
+ if (!server_url.is_valid()) { |
+ DVLOG(1) << "RapporService not started: " |
+ << server_url.spec() << " is invalid."; |
return; |
+ } |
+ DVLOG(1) << "RapporService started. Reporting to " << server_url.spec(); |
DCHECK(!uploader_); |
LoadSecret(pref_service); |
LoadCohort(pref_service); |
@@ -78,11 +82,14 @@ void RapporService::Start(PrefService* pref_service, |
void RapporService::OnLogInterval() { |
DCHECK(uploader_); |
+ DVLOG(2) << "RapporService::OnLogInterval"; |
RapporReports reports; |
if (ExportMetrics(&reports)) { |
std::string log_text; |
bool success = reports.SerializeToString(&log_text); |
DCHECK(success); |
+ DVLOG(1) << "RapporService sending a report of " |
+ << reports.report_size() << " value(s)."; |
uploader_->QueueLog(log_text); |
} |
log_rotation_timer_.Start(FROM_HERE, |
@@ -111,6 +118,7 @@ void RapporService::LoadCohort(PrefService* pref_service) { |
// This is the first time the client has started the service (or their |
// preferences were corrupted). Randomly assign them to a cohort. |
cohort_ = base::RandGenerator(RapporParameters::kMaxCohorts); |
+ DVLOG(2) << "Selected a new Rappor cohort: " << cohort_; |
pref_service->SetInteger(prefs::kRapporCohortSeed, cohort_); |
} |
@@ -126,6 +134,7 @@ void RapporService::LoadSecret(PrefService* pref_service) { |
// one. |
} |
+ DVLOG(2) << "Generated a new Rappor secret."; |
secret_ = HmacByteVectorGenerator::GenerateEntropyInput(); |
base::Base64Encode(secret_, &secret_base64); |
pref_service->SetString(prefs::kRapporSecret, secret_base64); |
@@ -163,6 +172,9 @@ void RapporService::RecordSample(const std::string& metric_name, |
if (!IsInitialized()) |
return; |
DCHECK_LT(type, NUM_RAPPOR_TYPES); |
+ DVLOG(2) << "Recording sample \"" << sample |
+ << "\" for metric \"" << metric_name |
+ << "\" of type: " << type; |
RecordSampleInternal(metric_name, kRapporParametersForType[type], sample); |
} |