Chromium Code Reviews| Index: components/rappor/rappor_service.cc |
| diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc |
| index 67bc4aa0b29651f34e83878446994c088f8f0c31..7d6b52fbd674e63dadc44f6ba265e3fb1c03acda 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:" |
|
Alexei Svitkine (slow)
2014/07/25 14:46:39
Nit: Add a space before the end ".
Steven Holte
2014/07/25 19:16:47
Done.
|
| + << 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, |
| @@ -110,6 +117,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. |
| + DVLOG(2) << "Selected a new Rappor cohort."; |
|
Alexei Svitkine (slow)
2014/07/25 14:46:39
Nit: Might as well log the cohort_.
Steven Holte
2014/07/25 19:16:47
Done.
|
| cohort_ = base::RandGenerator(RapporParameters::kMaxCohorts); |
| 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; |
|
Alexei Svitkine (slow)
2014/07/25 14:46:39
Nit: Space after :
Steven Holte
2014/07/25 19:16:47
Done.
|
| RecordSampleInternal(metric_name, kRapporParametersForType[type], sample); |
| } |