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

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

Issue 1167753002: Add more UMAs for Instance ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more feedback Created 5 years, 6 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
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/instance_id_get_token_request_handler.h" 5 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h"
6 6
7 #include "base/metrics/histogram.h"
7 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
8 #include "google_apis/gcm/base/gcm_util.h" 9 #include "google_apis/gcm/base/gcm_util.h"
9 #include "net/url_request/url_request_context_getter.h" 10 #include "net/url_request/url_request_context_getter.h"
10 11
11 namespace gcm { 12 namespace gcm {
12 13
13 namespace { 14 namespace {
14 15
15 // Request constants. 16 // Request constants.
16 const char kAuthorizedEntityKey[] = "sender"; 17 const char kAuthorizedEntityKey[] = "sender";
(...skipping 29 matching lines...) Expand all
46 for (auto iter = options_.begin(); iter != options_.end(); ++iter) 47 for (auto iter = options_.begin(); iter != options_.end(); ++iter)
47 BuildFormEncoding(kOptionKeyPrefix + iter->first, iter->second, body); 48 BuildFormEncoding(kOptionKeyPrefix + iter->first, iter->second, body);
48 BuildFormEncoding(kGMSVersionKey, base::IntToString(gcm_version_), body); 49 BuildFormEncoding(kGMSVersionKey, base::IntToString(gcm_version_), body);
49 BuildFormEncoding(kInstanceIDKey, instance_id_, body); 50 BuildFormEncoding(kInstanceIDKey, instance_id_, body);
50 BuildFormEncoding(kAuthorizedEntityKey, authorized_entity_, body); 51 BuildFormEncoding(kAuthorizedEntityKey, authorized_entity_, body);
51 // TODO(jianli): To work around server bug. To be removed when the server fix 52 // TODO(jianli): To work around server bug. To be removed when the server fix
52 // is deployed. 53 // is deployed.
53 BuildFormEncoding(kSubtypeKey, authorized_entity_, body); 54 BuildFormEncoding(kSubtypeKey, authorized_entity_, body);
54 } 55 }
55 56
57 void InstanceIDGetTokenRequestHandler::ReportUMAs(
58 RegistrationRequest::Status status,
59 int retry_count,
60 base::TimeDelta complete_time) {
61 UMA_HISTOGRAM_ENUMERATION("InstanceID.GetToken.RequestStatus",
62 status,
63 RegistrationRequest::STATUS_COUNT);
64
65 // Other UMAs are only reported when the request succeeds.
66 if (status != RegistrationRequest::SUCCESS)
67 return;
68
69 UMA_HISTOGRAM_COUNTS("InstanceID.GetToken.RetryCount", retry_count);
70 UMA_HISTOGRAM_TIMES("InstanceID.GetToken.CompleteTime", complete_time);
71 }
72
56 } // namespace gcm 73 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/instance_id_get_token_request_handler.h ('k') | google_apis/gcm/engine/registration_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698