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

Unified Diff: google_apis/gcm/engine/gcm_store_impl.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 side-by-side diff with in-line comments
Download patch
Index: google_apis/gcm/engine/gcm_store_impl.cc
diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc
index 3436ba9d35f6d6c0d5b57e58f0a0e52f82fd74b4..b90630a0594a85ee85b54fae61ef238fbe5a2a7c 100644
--- a/google_apis/gcm/engine/gcm_store_impl.cc
+++ b/google_apis/gcm/engine/gcm_store_impl.cc
@@ -17,6 +17,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_tokenizer.h"
+#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/tracked_objects.h"
@@ -336,6 +337,17 @@ void GCMStoreImpl::Backend::Load(const LoadCallback& callback) {
return;
}
+ // |result->registrations| contains both GCM registrations and InstanceID
+ // tokens. Count them separately.
+ int gcm_registration_count = 0;
+ int instance_id_token_count = 0;
+ for (const auto& registration : result->registrations) {
+ if (StartsWithASCII(registration.first, "iid-", true))
+ instance_id_token_count++;
+ else
+ gcm_registration_count++;
+ }
+
// Only record histograms if GCM had already been set up for this device.
if (result->device_android_id != 0 && result->device_security_token != 0) {
int64 file_size = 0;
@@ -343,20 +355,27 @@ void GCMStoreImpl::Backend::Load(const LoadCallback& callback) {
UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB",
static_cast<int>(file_size / 1024));
}
- UMA_HISTOGRAM_COUNTS("GCM.RestoredRegistrations",
- result->registrations.size());
+
+ UMA_HISTOGRAM_COUNTS("GCM.RestoredRegistrations", gcm_registration_count);
UMA_HISTOGRAM_COUNTS("GCM.RestoredOutgoingMessages",
result->outgoing_messages.size());
UMA_HISTOGRAM_COUNTS("GCM.RestoredIncomingMessages",
result->incoming_messages.size());
+
+ UMA_HISTOGRAM_COUNTS("InstanceID.RestoredTokenCount",
+ instance_id_token_count);
+ UMA_HISTOGRAM_COUNTS("InstanceID.RestoredIDCount",
+ result->instance_id_data.size());
}
- DVLOG(1) << "Succeeded in loading " << result->registrations.size()
- << " registrations, "
+ DVLOG(1) << "Succeeded in loading "
+ << gcm_registration_count << " GCM registrations, "
<< result->incoming_messages.size()
- << " unacknowledged incoming messages and "
+ << " unacknowledged incoming messages "
<< result->outgoing_messages.size()
- << " unacknowledged outgoing messages.";
+ << " unacknowledged outgoing messages, "
+ << result->instance_id_data.size() << " Instance IDs, "
+ << instance_id_token_count << " InstanceID tokens.";
result->success = true;
foreground_task_runner_->PostTask(FROM_HERE,
base::Bind(callback,

Powered by Google App Engine
This is Rietveld 408576698