summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorjianli <jianli@chromium.org>2015-06-26 15:29:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-26 22:29:40 +0000
commitfc047f31086a4ae806ef317fabdf189b205003e2 (patch)
tree3e15b97996a841eb8f37c3f8fa480d7f111a95e1 /google_apis
parent7979601b897f7790a47249b0d342682411053a55 (diff)
downloadchromium_src-fc047f31086a4ae806ef317fabdf189b205003e2.zip
chromium_src-fc047f31086a4ae806ef317fabdf189b205003e2.tar.gz
chromium_src-fc047f31086a4ae806ef317fabdf189b205003e2.tar.bz2
Improve registration log in gcm-internals page for Instance ID
Changes: 1) The column name "Sender Ids" is renamed to "Source". 2) For deleting an InstanceID token, the source will be passed. 3) Registration retry will now also show delay time, similar to what we did for unregistration retry. BUG=477084 TBR=arv@chromium.org Review URL: https://codereview.chromium.org/1205163003 Cr-Commit-Position: refs/heads/master@{#336466}
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gcm/engine/registration_request.cc9
-rw-r--r--google_apis/gcm/engine/unregistration_request.cc13
-rw-r--r--google_apis/gcm/engine/unregistration_request.h4
-rw-r--r--google_apis/gcm/engine/unregistration_request_unittest.cc6
-rw-r--r--google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc13
-rw-r--r--google_apis/gcm/monitoring/fake_gcm_stats_recorder.h15
-rw-r--r--google_apis/gcm/monitoring/gcm_stats_recorder.h18
7 files changed, 50 insertions, 28 deletions
diff --git a/google_apis/gcm/engine/registration_request.cc b/google_apis/gcm/engine/registration_request.cc
index 6537389..a593e2b 100644
--- a/google_apis/gcm/engine/registration_request.cc
+++ b/google_apis/gcm/engine/registration_request.cc
@@ -167,6 +167,11 @@ void RegistrationRequest::RetryWithBackoff(bool update_backoff) {
<< request_info_.app_id << ", for "
<< backoff_entry_.GetTimeUntilRelease().InMilliseconds()
<< " milliseconds.";
+ recorder_->RecordRegistrationRetryDelayed(
+ request_info_.app_id,
+ source_to_record_,
+ backoff_entry_.GetTimeUntilRelease().InMilliseconds(),
+ retries_left_ + 1);
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&RegistrationRequest::RetryWithBackoff,
@@ -236,10 +241,6 @@ void RegistrationRequest::OnURLFetchComplete(const net::URLFetcher* source) {
if (ShouldRetryWithStatus(status)) {
if (retries_left_ > 0) {
- recorder_->RecordRegistrationRetryRequested(
- request_info_.app_id,
- source_to_record_,
- retries_left_);
RetryWithBackoff(true);
return;
}
diff --git a/google_apis/gcm/engine/unregistration_request.cc b/google_apis/gcm/engine/unregistration_request.cc
index f128c1a..e9fab18 100644
--- a/google_apis/gcm/engine/unregistration_request.cc
+++ b/google_apis/gcm/engine/unregistration_request.cc
@@ -59,7 +59,8 @@ UnregistrationRequest::UnregistrationRequest(
const UnregistrationCallback& callback,
int max_retry_count,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
- GCMStatsRecorder* recorder)
+ GCMStatsRecorder* recorder,
+ const std::string& source_to_record)
: callback_(callback),
request_info_(request_info),
custom_request_handler_(custom_request_handler.Pass()),
@@ -68,6 +69,7 @@ UnregistrationRequest::UnregistrationRequest(
request_context_getter_(request_context_getter),
retries_left_(max_retry_count),
recorder_(recorder),
+ source_to_record_(source_to_record),
weak_ptr_factory_(this) {
DCHECK_GE(max_retry_count, 0);
}
@@ -95,7 +97,7 @@ void UnregistrationRequest::Start() {
url_fetcher_->SetUploadData(kRequestContentType, body);
DVLOG(1) << "Performing unregistration for: " << request_info_.app_id;
- recorder_->RecordUnregistrationSent(request_info_.app_id);
+ recorder_->RecordUnregistrationSent(request_info_.app_id, source_to_record_);
request_start_time_ = base::TimeTicks::Now();
url_fetcher_->Start();
}
@@ -159,6 +161,7 @@ void UnregistrationRequest::RetryWithBackoff(bool update_backoff) {
<< " milliseconds.";
recorder_->RecordUnregistrationRetryDelayed(
request_info_.app_id,
+ source_to_record_,
backoff_entry_.GetTimeUntilRelease().InMilliseconds(),
retries_left_ + 1);
base::MessageLoop::current()->PostDelayedTask(
@@ -184,7 +187,8 @@ void UnregistrationRequest::OnURLFetchComplete(const net::URLFetcher* source) {
backoff_entry_.failure_count(),
base::TimeTicks::Now() - request_start_time_);
- recorder_->RecordUnregistrationResponse(request_info_.app_id, status);
+ recorder_->RecordUnregistrationResponse(
+ request_info_.app_id, source_to_record_, status);
if (status == URL_FETCHING_FAILED ||
status == HTTP_NOT_OK ||
@@ -199,7 +203,8 @@ void UnregistrationRequest::OnURLFetchComplete(const net::URLFetcher* source) {
}
status = REACHED_MAX_RETRIES;
- recorder_->RecordUnregistrationResponse(request_info_.app_id, status);
+ recorder_->RecordUnregistrationResponse(
+ request_info_.app_id, source_to_record_, status);
// Only REACHED_MAX_RETRIES is reported because the function will skip
// reporting count and time when status is not SUCCESS.
diff --git a/google_apis/gcm/engine/unregistration_request.h b/google_apis/gcm/engine/unregistration_request.h
index 501a943..5685425 100644
--- a/google_apis/gcm/engine/unregistration_request.h
+++ b/google_apis/gcm/engine/unregistration_request.h
@@ -105,7 +105,8 @@ class GCM_EXPORT UnregistrationRequest : public net::URLFetcherDelegate {
const UnregistrationCallback& callback,
int max_retry_count,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
- GCMStatsRecorder* recorder);
+ GCMStatsRecorder* recorder,
+ const std::string& source_to_record);
~UnregistrationRequest() override;
// Starts an unregistration request.
@@ -136,6 +137,7 @@ class GCM_EXPORT UnregistrationRequest : public net::URLFetcherDelegate {
// Recorder that records GCM activities for debugging purpose. Not owned.
GCMStatsRecorder* recorder_;
+ std::string source_to_record_;
base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_;
diff --git a/google_apis/gcm/engine/unregistration_request_unittest.cc b/google_apis/gcm/engine/unregistration_request_unittest.cc
index eb555e5..8d1bb33 100644
--- a/google_apis/gcm/engine/unregistration_request_unittest.cc
+++ b/google_apis/gcm/engine/unregistration_request_unittest.cc
@@ -149,7 +149,8 @@ void GCMUnregistrationRequestTest::CreateRequest() {
base::Unretained(this)),
max_retry_count_,
url_request_context_getter_.get(),
- &recorder_));
+ &recorder_,
+ std::string()));
}
TEST_F(GCMUnregistrationRequestTest, RequestDataPassedToFetcher) {
@@ -401,7 +402,8 @@ void InstaceIDDeleteTokenRequestTest::CreateRequest(
base::Unretained(this)),
max_retry_count(),
url_request_context_getter_.get(),
- &recorder_));
+ &recorder_,
+ std::string()));
}
TEST_F(InstaceIDDeleteTokenRequestTest, RequestDataPassedToFetcher) {
diff --git a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc
index d4c781e..f2934d4 100644
--- a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc
+++ b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc
@@ -44,32 +44,35 @@ void FakeGCMStatsRecorder::RecordConnectionResetSignaled(
void FakeGCMStatsRecorder::RecordRegistrationSent(
const std::string& app_id,
- const std::string& senders) {
+ const std::string& source) {
}
void FakeGCMStatsRecorder::RecordRegistrationResponse(
const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
RegistrationRequest::Status status) {
}
-void FakeGCMStatsRecorder::RecordRegistrationRetryRequested(
+void FakeGCMStatsRecorder::RecordRegistrationRetryDelayed(
const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
+ int64 delay_msec,
int retries_left) {
}
void FakeGCMStatsRecorder::RecordUnregistrationSent(
- const std::string& app_id) {
+ const std::string& app_id, const std::string& source) {
}
void FakeGCMStatsRecorder::RecordUnregistrationResponse(
const std::string& app_id,
+ const std::string& source,
UnregistrationRequest::Status status) {
}
void FakeGCMStatsRecorder::RecordUnregistrationRetryDelayed(
const std::string& app_id,
+ const std::string& source,
int64 delay_msec,
int retries_left) {
}
diff --git a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h
index a48146c..ba8acfd 100644
--- a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h
+++ b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h
@@ -26,19 +26,24 @@ class FakeGCMStatsRecorder : public GCMStatsRecorder {
void RecordConnectionResetSignaled(
ConnectionFactory::ConnectionResetReason reason) override;
void RecordRegistrationSent(const std::string& app_id,
- const std::string& senders) override;
+ const std::string& source) override;
void RecordRegistrationResponse(const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
RegistrationRequest::Status status) override;
- void RecordRegistrationRetryRequested(
+ void RecordRegistrationRetryDelayed(
const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
+ int64 delay_msec,
int retries_left) override;
- void RecordUnregistrationSent(const std::string& app_id) override;
+ void RecordUnregistrationSent(
+ const std::string& app_id,
+ const std::string& source) override;
void RecordUnregistrationResponse(
const std::string& app_id,
+ const std::string& source,
UnregistrationRequest::Status status) override;
void RecordUnregistrationRetryDelayed(const std::string& app_id,
+ const std::string& source,
int64 delay_msec,
int retries_left) override;
void RecordDataMessageReceived(const std::string& app_id,
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.h b/google_apis/gcm/monitoring/gcm_stats_recorder.h
index 5b493f8..8a093eb 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder.h
+++ b/google_apis/gcm/monitoring/gcm_stats_recorder.h
@@ -73,33 +73,37 @@ class GCM_EXPORT GCMStatsRecorder {
// Records that a registration request has been sent. This could be initiated
// directly from API, or from retry logic.
virtual void RecordRegistrationSent(const std::string& app_id,
- const std::string& senders) = 0;
+ const std::string& source) = 0;
// Records that a registration response has been received from server.
virtual void RecordRegistrationResponse(
const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
RegistrationRequest::Status status) = 0;
- // Records that a registration retry has been requested. The actual retry
- // action may not occur until some time later according to backoff logic.
- virtual void RecordRegistrationRetryRequested(
+ // Records that a registration retry has been requested and delayed due to
+ // backoff logic.
+ virtual void RecordRegistrationRetryDelayed(
const std::string& app_id,
- const std::string& senders,
+ const std::string& source,
+ int64 delay_msec,
int retries_left) = 0;
// Records that an unregistration request has been sent. This could be
// initiated directly from API, or from retry logic.
- virtual void RecordUnregistrationSent(const std::string& app_id) = 0;
+ virtual void RecordUnregistrationSent(const std::string& app_id,
+ const std::string& source) = 0;
// Records that an unregistration response has been received from server.
virtual void RecordUnregistrationResponse(
const std::string& app_id,
+ const std::string& source,
UnregistrationRequest::Status status) = 0;
// Records that an unregistration retry has been requested and delayed due to
// backoff logic.
virtual void RecordUnregistrationRetryDelayed(const std::string& app_id,
+ const std::string& source,
int64 delay_msec,
int retries_left) = 0;