Commit a21137ae authored by harkness's avatar harkness Committed by Commit bot

Add PendingEvents UMA to ConnectionEventTracker shutdown.

Currently, the ConnectionEventTracker keeps a buffer in memory of events
which still need to be sent to GCM. If there is a shutdown, those events
are discarded without reaching GCM. This CL adds a metric to track the
event count at shutdown to give an estimate of how many events are being
lost and whether a persistence layer needs to be added.

BUG=662983

Review-Url: https://codereview.chromium.org/2594373002
Cr-Commit-Position: refs/heads/master@{#443208}
parent 05fd6942
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "google_apis/gcm/engine/connection_event_tracker.h" #include "google_apis/gcm/engine/connection_event_tracker.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "net/base/network_change_notifier.h" #include "net/base/network_change_notifier.h"
...@@ -19,7 +20,10 @@ namespace gcm { ...@@ -19,7 +20,10 @@ namespace gcm {
ConnectionEventTracker::ConnectionEventTracker() = default; ConnectionEventTracker::ConnectionEventTracker() = default;
ConnectionEventTracker::~ConnectionEventTracker() = default; ConnectionEventTracker::~ConnectionEventTracker() {
UMA_HISTOGRAM_ENUMERATION("GCM.PendingConnectionEventsAtShutdown",
completed_events_.size(), kMaxClientEvents + 1);
}
void ConnectionEventTracker::StartConnectionAttempt() { void ConnectionEventTracker::StartConnectionAttempt() {
// TODO(harkness): Can we dcheck here that there is not an in progress // TODO(harkness): Can we dcheck here that there is not an in progress
......
...@@ -19458,6 +19458,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -19458,6 +19458,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="GCM.PendingConnectionEventsAtShutdown" units="events">
<owner>harkness@chromium.org</owner>
<summary>
Number of connection events which have not been sent to GCM. This is
recorded only at the time of shutdown to capture the events which are being
lost due to shutdown. Because this is recorded at shutdown, this is not
guaranteed to be complete and should be treated as a best effort record.
</summary>
</histogram>
<histogram name="GCM.ReceivedDataMessageBurstSize" units="messages"> <histogram name="GCM.ReceivedDataMessageBurstSize" units="messages">
<owner>juyik@chromium.org</owner> <owner>juyik@chromium.org</owner>
<summary>Number of messages in a received GCM data message burst.</summary> <summary>Number of messages in a received GCM data message burst.</summary>
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