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

Side by Side Diff: google_apis/gcm/engine/registration_request.cc

Issue 270783002: [GCM] Add more UMA to GCM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix trybots Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_apis/gcm/engine/registration_request.h" 5 #include "google_apis/gcm/engine/registration_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 RegistrationRequest::RequestInfo::RequestInfo( 86 RegistrationRequest::RequestInfo::RequestInfo(
87 uint64 android_id, 87 uint64 android_id,
88 uint64 security_token, 88 uint64 security_token,
89 const std::string& app_id, 89 const std::string& app_id,
90 const std::vector<std::string>& sender_ids) 90 const std::vector<std::string>& sender_ids)
91 : android_id(android_id), 91 : android_id(android_id),
92 security_token(security_token), 92 security_token(security_token),
93 app_id(app_id), 93 app_id(app_id),
94 sender_ids(sender_ids) { 94 sender_ids(sender_ids) {
95 UMA_HISTOGRAM_COUNTS("GCM.RegistrationSenderNumber", sender_ids.size());
fgorski 2014/05/08 18:08:36 nit: wouldn't that be more suitable in start?
jianli 2014/05/08 18:40:07 Done.
95 } 96 }
96 97
97 RegistrationRequest::RequestInfo::~RequestInfo() {} 98 RegistrationRequest::RequestInfo::~RequestInfo() {}
98 99
99 RegistrationRequest::RegistrationRequest( 100 RegistrationRequest::RegistrationRequest(
100 const GURL& registration_url, 101 const GURL& registration_url,
101 const RequestInfo& request_info, 102 const RequestInfo& request_info,
102 const net::BackoffEntry::Policy& backoff_policy, 103 const net::BackoffEntry::Policy& backoff_policy,
103 const RegistrationCallback& callback, 104 const RegistrationCallback& callback,
104 int max_retry_count, 105 int max_retry_count,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (!senders.empty()) 150 if (!senders.empty())
150 senders.append(","); 151 senders.append(",");
151 senders.append(*iter); 152 senders.append(*iter);
152 } 153 }
153 BuildFormEncoding(kSenderKey, senders, &body); 154 BuildFormEncoding(kSenderKey, senders, &body);
154 155
155 DVLOG(1) << "Performing registration for: " << request_info_.app_id; 156 DVLOG(1) << "Performing registration for: " << request_info_.app_id;
156 DVLOG(1) << "Registration request: " << body; 157 DVLOG(1) << "Registration request: " << body;
157 url_fetcher_->SetUploadData(kRegistrationRequestContentType, body); 158 url_fetcher_->SetUploadData(kRegistrationRequestContentType, body);
158 recorder_->RecordRegistrationSent(request_info_.app_id, senders); 159 recorder_->RecordRegistrationSent(request_info_.app_id, senders);
160 request_start_time_ = base::TimeTicks::Now();
159 url_fetcher_->Start(); 161 url_fetcher_->Start();
160 } 162 }
161 163
162 void RegistrationRequest::RetryWithBackoff(bool update_backoff) { 164 void RegistrationRequest::RetryWithBackoff(bool update_backoff) {
163 if (update_backoff) { 165 if (update_backoff) {
164 DCHECK_GT(retries_left_, 0); 166 DCHECK_GT(retries_left_, 0);
165 --retries_left_; 167 --retries_left_;
166 url_fetcher_.reset(); 168 url_fetcher_.reset();
167 backoff_entry_.InformOfRequest(false); 169 backoff_entry_.InformOfRequest(false);
168 } 170 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 247 }
246 248
247 status = REACHED_MAX_RETRIES; 249 status = REACHED_MAX_RETRIES;
248 recorder_->RecordRegistrationResponse( 250 recorder_->RecordRegistrationResponse(
249 request_info_.app_id, 251 request_info_.app_id,
250 request_info_.sender_ids, 252 request_info_.sender_ids,
251 status); 253 status);
252 RecordRegistrationStatusToUMA(status); 254 RecordRegistrationStatusToUMA(status);
253 } 255 }
254 256
257 if (status == SUCCESS) {
258 UMA_HISTOGRAM_COUNTS("GCM.RegistrationRetryNumber",
fgorski 2014/05/08 18:08:36 Do we not care about the retry number if we don't
jianli 2014/05/08 18:40:07 Yes. See my comment above.
259 backoff_entry_.failure_count() + 1);
fgorski 2014/05/08 18:08:36 nit: Technically number of retries is = failure co
jianli 2014/05/08 18:40:07 Original I mean the UMA was for total number of re
260 UMA_HISTOGRAM_TIMES("GCM.RegistrationCompleteTime",
261 base::TimeTicks::Now() - request_start_time_);
262 }
255 callback_.Run(status, token); 263 callback_.Run(status, token);
256 } 264 }
257 265
258 } // namespace gcm 266 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698