Commit d8124d5e authored by holte@chromium.org's avatar holte@chromium.org

Add DVLOGs of interesting RapporService events.

BUG=

Review URL: https://codereview.chromium.org/419143002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285680 0039d316-1c4b-4281-b951-d872f2087c98
parent d3efff03
...@@ -70,8 +70,12 @@ RapporService::~RapporService() { ...@@ -70,8 +70,12 @@ RapporService::~RapporService() {
void RapporService::Start(PrefService* pref_service, void RapporService::Start(PrefService* pref_service,
net::URLRequestContextGetter* request_context) { net::URLRequestContextGetter* request_context) {
const GURL server_url = GetServerUrl(); 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; return;
}
DVLOG(1) << "RapporService started. Reporting to " << server_url.spec();
DCHECK(!uploader_); DCHECK(!uploader_);
LoadSecret(pref_service); LoadSecret(pref_service);
LoadCohort(pref_service); LoadCohort(pref_service);
...@@ -85,11 +89,14 @@ void RapporService::Start(PrefService* pref_service, ...@@ -85,11 +89,14 @@ void RapporService::Start(PrefService* pref_service,
void RapporService::OnLogInterval() { void RapporService::OnLogInterval() {
DCHECK(uploader_); DCHECK(uploader_);
DVLOG(2) << "RapporService::OnLogInterval";
RapporReports reports; RapporReports reports;
if (ExportMetrics(&reports)) { if (ExportMetrics(&reports)) {
std::string log_text; std::string log_text;
bool success = reports.SerializeToString(&log_text); bool success = reports.SerializeToString(&log_text);
DCHECK(success); DCHECK(success);
DVLOG(1) << "RapporService sending a report of "
<< reports.report_size() << " value(s).";
uploader_->QueueLog(log_text); uploader_->QueueLog(log_text);
} }
log_rotation_timer_.Start(FROM_HERE, log_rotation_timer_.Start(FROM_HERE,
...@@ -118,6 +125,7 @@ void RapporService::LoadCohort(PrefService* pref_service) { ...@@ -118,6 +125,7 @@ void RapporService::LoadCohort(PrefService* pref_service) {
// This is the first time the client has started the service (or their // This is the first time the client has started the service (or their
// preferences were corrupted). Randomly assign them to a cohort. // preferences were corrupted). Randomly assign them to a cohort.
cohort_ = base::RandGenerator(RapporParameters::kMaxCohorts); cohort_ = base::RandGenerator(RapporParameters::kMaxCohorts);
DVLOG(2) << "Selected a new Rappor cohort: " << cohort_;
pref_service->SetInteger(prefs::kRapporCohortSeed, cohort_); pref_service->SetInteger(prefs::kRapporCohortSeed, cohort_);
} }
...@@ -133,6 +141,7 @@ void RapporService::LoadSecret(PrefService* pref_service) { ...@@ -133,6 +141,7 @@ void RapporService::LoadSecret(PrefService* pref_service) {
// one. // one.
} }
DVLOG(2) << "Generated a new Rappor secret.";
secret_ = HmacByteVectorGenerator::GenerateEntropyInput(); secret_ = HmacByteVectorGenerator::GenerateEntropyInput();
base::Base64Encode(secret_, &secret_base64); base::Base64Encode(secret_, &secret_base64);
pref_service->SetString(prefs::kRapporSecret, secret_base64); pref_service->SetString(prefs::kRapporSecret, secret_base64);
...@@ -170,6 +179,9 @@ void RapporService::RecordSample(const std::string& metric_name, ...@@ -170,6 +179,9 @@ void RapporService::RecordSample(const std::string& metric_name,
if (!IsInitialized()) if (!IsInitialized())
return; return;
DCHECK_LT(type, NUM_RAPPOR_TYPES); DCHECK_LT(type, NUM_RAPPOR_TYPES);
DVLOG(2) << "Recording sample \"" << sample
<< "\" for metric \"" << metric_name
<< "\" of type: " << type;
RecordSampleInternal(metric_name, kRapporParametersForType[type], sample); RecordSampleInternal(metric_name, kRapporParametersForType[type], sample);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment