Commit 698ac976 authored by dzhioev's avatar dzhioev Committed by Commit bot

Added histograms for tracking new user's priority prefs sync time and results.

BUG=392232

Review URL: https://codereview.chromium.org/1130603006

Cr-Commit-Position: refs/heads/master@{#330235}
parent 70c00e24
...@@ -130,6 +130,7 @@ void UserImageScreen::OnDecodeImageFailed() { ...@@ -130,6 +130,7 @@ void UserImageScreen::OnDecodeImageFailed() {
void UserImageScreen::OnInitialSync(bool local_image_updated) { void UserImageScreen::OnInitialSync(bool local_image_updated) {
DCHECK(sync_timer_); DCHECK(sync_timer_);
ReportSyncResult(SyncResult::SUCCEEDED);
if (!local_image_updated) { if (!local_image_updated) {
sync_timer_.reset(); sync_timer_.reset();
GetSyncObserver()->RemoveObserver(this); GetSyncObserver()->RemoveObserver(this);
...@@ -141,6 +142,7 @@ void UserImageScreen::OnInitialSync(bool local_image_updated) { ...@@ -141,6 +142,7 @@ void UserImageScreen::OnInitialSync(bool local_image_updated) {
} }
void UserImageScreen::OnSyncTimeout() { void UserImageScreen::OnSyncTimeout() {
ReportSyncResult(SyncResult::TIMED_OUT);
sync_timer_.reset(); sync_timer_.reset();
GetSyncObserver()->RemoveObserver(this); GetSyncObserver()->RemoveObserver(this);
if (is_screen_ready_) if (is_screen_ready_)
...@@ -266,8 +268,10 @@ void UserImageScreen::Show() { ...@@ -266,8 +268,10 @@ void UserImageScreen::Show() {
if (GetUser()->CanSyncImage()) { if (GetUser()->CanSyncImage()) {
if (UserImageSyncObserver* sync_observer = GetSyncObserver()) { if (UserImageSyncObserver* sync_observer = GetSyncObserver()) {
sync_waiting_start_time_ = base::Time::Now();
// We have synced image already. // We have synced image already.
if (sync_observer->is_synced()) { if (sync_observer->is_synced()) {
ReportSyncResult(SyncResult::SUCCEEDED);
ExitScreen(); ExitScreen();
return; return;
} }
...@@ -347,4 +351,12 @@ void UserImageScreen::ExitScreen() { ...@@ -347,4 +351,12 @@ void UserImageScreen::ExitScreen() {
Finish(BaseScreenDelegate::USER_IMAGE_SELECTED); Finish(BaseScreenDelegate::USER_IMAGE_SELECTED);
} }
void UserImageScreen::ReportSyncResult(SyncResult timed_out) const {
base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_;
UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration);
UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult",
static_cast<int>(timed_out),
static_cast<int>(SyncResult::COUNT));
}
} // namespace chromeos } // namespace chromeos
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/camera_presence_notifier.h" #include "chrome/browser/chromeos/camera_presence_notifier.h"
#include "chrome/browser/chromeos/login/screens/base_screen.h" #include "chrome/browser/chromeos/login/screens/base_screen.h"
#include "chrome/browser/chromeos/login/screens/user_image_model.h" #include "chrome/browser/chromeos/login/screens/user_image_model.h"
...@@ -75,6 +76,15 @@ class UserImageScreen : public UserImageModel, ...@@ -75,6 +76,15 @@ class UserImageScreen : public UserImageModel,
bool user_selected_image() const { return user_has_selected_image_; } bool user_selected_image() const { return user_has_selected_image_; }
private: private:
// Must be kept synced with |NewUserPriorityPrefsSyncResult| enum from
// histograms.xml.
enum class SyncResult {
SUCCEEDED,
TIMED_OUT,
// Keeps a number of different sync results. Should be the last in the list.
COUNT
};
// Called when whaiting for sync timed out. // Called when whaiting for sync timed out.
void OnSyncTimeout(); void OnSyncTimeout();
...@@ -101,6 +111,9 @@ class UserImageScreen : public UserImageModel, ...@@ -101,6 +111,9 @@ class UserImageScreen : public UserImageModel,
// Closes the screen. // Closes the screen.
void ExitScreen(); void ExitScreen();
// Reports sync duration and result to UMA.
void ReportSyncResult(SyncResult timed_out) const;
content::NotificationRegistrar notification_registrar_; content::NotificationRegistrar notification_registrar_;
scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_; scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_;
...@@ -127,6 +140,9 @@ class UserImageScreen : public UserImageModel, ...@@ -127,6 +140,9 @@ class UserImageScreen : public UserImageModel,
// True if user has explicitly selected some image. // True if user has explicitly selected some image.
bool user_has_selected_image_; bool user_has_selected_image_;
// The time when we started wait for user image sync.
base::Time sync_waiting_start_time_;
DISALLOW_COPY_AND_ASSIGN(UserImageScreen); DISALLOW_COPY_AND_ASSIGN(UserImageScreen);
}; };
......
...@@ -4118,14 +4118,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -4118,14 +4118,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram> </histogram>
<histogram name="CrosFirstRun.DialogShown"> <histogram name="CrosFirstRun.DialogShown">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary> <summary>
Records the number of times when first-run dialog was shown. Records the number of times when first-run dialog was shown.
</summary> </summary>
</histogram> </histogram>
<histogram name="CrosFirstRun.FurthestStep"> <histogram name="CrosFirstRun.FurthestStep">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary> <summary>
Index of furthest step that was reached during tutorial. Since order of Index of furthest step that was reached during tutorial. Since order of
steps could change eventially and new steps could apear we use index here steps could change eventially and new steps could apear we use index here
...@@ -4134,23 +4134,23 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -4134,23 +4134,23 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram> </histogram>
<histogram name="CrosFirstRun.TimeSpent" units="ms"> <histogram name="CrosFirstRun.TimeSpent" units="ms">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary>The total time that user spent on first-run tutorial.</summary> <summary>The total time that user spent on first-run tutorial.</summary>
</histogram> </histogram>
<histogram name="CrosFirstRun.TimeSpentOnStep" units="ms"> <histogram name="CrosFirstRun.TimeSpentOnStep" units="ms">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary>The time that user spent on some step of tutorial.</summary> <summary>The time that user spent on some step of tutorial.</summary>
</histogram> </histogram>
<histogram name="CrosFirstRun.TutorialCompletion" <histogram name="CrosFirstRun.TutorialCompletion"
enum="CrosFirstRunTutorialCompletionType"> enum="CrosFirstRunTutorialCompletionType">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary>Tracks the way how user left tutorial.</summary> <summary>Tracks the way how user left tutorial.</summary>
</histogram> </histogram>
<histogram name="CrosFirstRun.TutorialLaunched"> <histogram name="CrosFirstRun.TutorialLaunched">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>dzhioev@chromium.org</owner>
<summary> <summary>
Records the number of times when first-run tutorial has been launched. Records the number of times when first-run tutorial has been launched.
</summary> </summary>
...@@ -14424,6 +14424,20 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -14424,6 +14424,20 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="Login.NewUserPriorityPrefsSyncResult"
enum="NewUserPriorityPrefsSyncResult">
<owner>dzhioev@chromeos.org</owner>
<summary>Records whether a new user's priority prefs sync timed out.</summary>
</histogram>
<histogram name="Login.NewUserPriorityPrefsSyncTime" units="milliseconds">
<owner>dzhioev@chromeos.org</owner>
<summary>
Time spent waiting for priority preferences to sync after new user sign in.
The operation will time out after 10s.
</summary>
</histogram>
<histogram name="Login.PolicyFilesStatePerBoot" enum="LoginPolicyFilesState"> <histogram name="Login.PolicyFilesStatePerBoot" enum="LoginPolicyFilesState">
<owner>cmasone@chromium.org</owner> <owner>cmasone@chromium.org</owner>
<summary>The state of Chrome OS owner key and device policy files.</summary> <summary>The state of Chrome OS owner key and device policy files.</summary>
...@@ -58934,6 +58948,11 @@ To add a new entry, add it with any value and run test to compute valid value. ...@@ -58934,6 +58948,11 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="6" label="URL blocked for supervised user"/> <int value="6" label="URL blocked for supervised user"/>
</enum> </enum>
<enum name="NewUserPriorityPrefsSyncResult" type="int">
<int value="0" label="Succeeded"/>
<int value="1" label="Timed out"/>
</enum>
<enum name="NotificationActionType" type="int"> <enum name="NotificationActionType" type="int">
<int value="0" label="Unknown"/> <int value="0" label="Unknown"/>
<int value="1" label="Notification added"/> <int value="1" label="Notification added"/>
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