summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorbrg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 02:17:06 +0000
committerbrg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 02:17:06 +0000
commit1f97a11d47048f09134e36265661c1082d1f82d3 (patch)
tree30e8c919ec8f50a77b61dc1347d3d0ff6cac26a6 /chrome/browser
parent4e6719f89e1323405252edb5ea78084cb7867562 (diff)
downloadchromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.zip
chromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.tar.gz
chromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.tar.bz2
Add UMA histograms for chrome-sync.We add the following histograms:Sync.MergeAndSyncNeededCountNumber of times merge and sync is needed to run.Sync.AuthorizationTimeTime taken during initial authorization.Sync.UserPerceivedAuthorizationTimeTime the user spends looking at the authorization dialog.Sync.BookmarkAssociationTimeTime taken during bookmark association.Sync.ReauthorizationTimeTime taken from startup for the user to reauthorize.
Sync.Events This is an enumeration of distinct events of the following types: Number of times sync was started from the ad in NTP.Number of times sync was started from the Wrench menu.Number of times sync was started from Wrench->Options.Number of times sync was stopped from Wrench->Options.Number of times sync was stopped during the sign-on process.Number of times sync was stopped after successfully authorized.Number of times sync was cancelled when the merge dialog was surfaces. BUG=None. Test=None. Review URL: http://codereview.chromium.org/165111 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc3
-rw-r--r--chrome/browser/sync/personalization.cc1
-rw-r--r--chrome/browser/sync/profile_sync_service.cc36
-rw-r--r--chrome/browser/sync/profile_sync_service.h29
-rw-r--r--chrome/browser/views/options/content_page_view.cc2
-rw-r--r--chrome/browser/views/sync/sync_setup_flow.cc27
-rw-r--r--chrome/browser/views/sync/sync_setup_flow.h14
7 files changed, 105 insertions, 7 deletions
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index 3a30e03a..b2220fa 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -83,7 +83,7 @@ DOMMessageHandler* NewTabPageSyncHandler::Attach(DOMUI* dom_ui) {
return DOMMessageHandler::Attach(dom_ui);
}
-void NewTabPageSyncHandler::RegisterMessages() {
+void NewTabPageSyncHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback("GetSyncMessage",
NewCallback(this, &NewTabPageSyncHandler::HandleGetSyncMessage));
dom_ui_->RegisterMessageCallback("SyncLinkClicked",
@@ -150,6 +150,7 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) {
sync_service_->ShowLoginDialog();
} else {
// User clicked "Start now" link to begin syncing.
+ ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
sync_service_->EnableForUser();
}
}
diff --git a/chrome/browser/sync/personalization.cc b/chrome/browser/sync/personalization.cc
index 8bd3c0d..8e8b6a6b 100644
--- a/chrome/browser/sync/personalization.cc
+++ b/chrome/browser/sync/personalization.cc
@@ -160,6 +160,7 @@ void HandleMenuItemClick(Profile* p) {
ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, p);
} else {
service->EnableForUser();
+ ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH);
}
}
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index a832870..910563a 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -13,6 +13,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/gfx/png_encoder.h"
+#include "base/histogram.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/time.h"
@@ -551,6 +552,10 @@ void ProfileSyncService::OnAuthError() {
expecting_first_run_auth_needed_event_ = false;
}
+ if (!wizard_.IsVisible()) {
+ auth_error_time_ == base::TimeTicks::Now();
+ }
+
is_auth_in_progress_ = false;
// Fan the notification out to interested UI-thread components.
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
@@ -559,6 +564,13 @@ void ProfileSyncService::OnAuthError() {
void ProfileSyncService::ShowLoginDialog() {
if (wizard_.IsVisible())
return;
+
+ if (!auth_error_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime",
+ base::TimeTicks::Now() - auth_error_time_);
+ auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null.
+ }
+
if (last_auth_error_ != AUTH_ERROR_NONE)
wizard_.Step(SyncSetupWizard::GAIA_LOGIN);
}
@@ -806,7 +818,7 @@ std::wstring ProfileSyncService::GetLastSyncedTimeString() const {
return TimeFormat::TimeElapsed(last_synced);
}
-string16 ProfileSyncService::GetAuthenticatedUsername() const {
+string16 ProfileSyncService::GetAuthenticatedUsername() const {
return backend_->GetAuthenticatedUsername();
}
@@ -815,11 +827,19 @@ void ProfileSyncService::OnUserSubmittedAuth(
last_attempted_user_email_ = username;
is_auth_in_progress_ = true;
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
+
+ base::TimeTicks start_time = base::TimeTicks::Now();
backend_->Authenticate(username, password);
+ UMA_HISTOGRAM_TIMES("Sync.AuthorizationTime",
+ base::TimeTicks::Now() - start_time);
}
void ProfileSyncService::OnUserAcceptedMergeAndSync() {
+ base::TimeTicks start_time = base::TimeTicks::Now();
bool merge_success = model_associator_->AssociateModels();
+ UMA_HISTOGRAM_TIMES("Sync.BookmarkAssociationWithUITime",
+ base::TimeTicks::Now() - start_time);
+
wizard_.Step(SyncSetupWizard::DONE); // TODO(timsteele): error state?
if (!merge_success) {
LOG(ERROR) << "Model assocation failed.";
@@ -837,6 +857,7 @@ void ProfileSyncService::OnUserCancelledDialog() {
// Rollback.
DisableForUser();
}
+
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
}
@@ -854,12 +875,17 @@ void ProfileSyncService::StartProcessingChangesIfReady() {
// Show the sync merge warning dialog if needed.
if (MergeAndSyncAcceptanceNeeded()) {
+ ProfileSyncService::SyncEvent(MERGE_AND_SYNC_NEEDED);
wizard_.Step(SyncSetupWizard::MERGE_AND_SYNC);
return;
}
// We're ready to merge the models.
+ base::TimeTicks start_time = base::TimeTicks::Now();
bool merge_success = model_associator_->AssociateModels();
+ UMA_HISTOGRAM_TIMES("Sync.BookmarkAssociationTime",
+ base::TimeTicks::Now() - start_time);
+
wizard_.Step(SyncSetupWizard::DONE); // TODO(timsteele): error state?
if (!merge_success) {
LOG(ERROR) << "Model assocation failed.";
@@ -879,6 +905,14 @@ void ProfileSyncService::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
+void ProfileSyncService::SyncEvent(SyncEventCodes code) {
+ static LinearHistogram histogram("Sync.EventCodes", MIN_SYNC_EVENT_CODE,
+ MAX_SYNC_EVENT_CODE - 1,
+ MAX_SYNC_EVENT_CODE);
+ histogram.SetFlags(kUmaTargetedHistogramFlag);
+ histogram.Add(code);
+}
+
bool ProfileSyncService::ShouldPushChanges() {
return ready_to_process_changes_ && // Wait for model load and merge.
!unrecoverable_error_detected_; // Halt after any terrible events.
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index d91edbe..0301647 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -53,6 +53,29 @@ class ProfileSyncService : public BookmarkModelObserver,
typedef ProfileSyncServiceObserver Observer;
typedef browser_sync::SyncBackendHost::Status Status;
+ enum SyncEventCodes {
+ MIN_SYNC_EVENT_CODE = 0,
+
+ // Events starting the sync service.
+ START_FROM_NTP = 1, // Sync was started from the ad in NTP
+ START_FROM_WRENCH = 2, // Sync was started from the Wrench menu.
+ START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options.
+
+ // Events regarding cancelation of the signon process of sync.
+ CANCEL_FROM_SIGNON_WIHTOUT_AUTH = 10, // Cancelled before submitting
+ // username and password.
+ CANCEL_DURING_SIGNON = 11, // Cancelled after auth.
+ CANCEL_DURING_SIGNON_AFTER_MERGE = 12, // Cancelled during merge.
+
+ // Events resulting in the stoppage of sync service.
+ STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options.
+
+ // Miscellaneous events caused by sync service.
+ MERGE_AND_SYNC_NEEDED = 30,
+
+ MAX_SYNC_EVENT_CODE
+ };
+
explicit ProfileSyncService(Profile* profile);
virtual ~ProfileSyncService();
@@ -169,6 +192,9 @@ class ProfileSyncService : public BookmarkModelObserver,
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
+ // Record stats on various events.
+ static void SyncEvent(SyncEventCodes code);
+
protected:
// Call this after any of the subsystems being synced (the bookmark
// model and the sync backend) finishes its initialization. When everything
@@ -308,6 +334,9 @@ class ProfileSyncService : public BookmarkModelObserver,
// Sets the last synced time to the current time.
void UpdateLastSyncedTime();
+ // Time at which error UI is presented for the NTP.
+ base::TimeTicks auth_error_time_;
+
// The profile whose data we are synchronizing.
Profile* profile_;
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index b838e7b..af2a4df 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -137,8 +137,10 @@ void ContentPageView::ButtonPressed(views::Button* sender) {
DCHECK(sync_service_);
if (sync_service_->IsSyncEnabledByUser()) {
sync_service_->DisableForUser();
+ ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
} else {
sync_service_->EnableForUser();
+ ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS);
}
#endif
}
diff --git a/chrome/browser/views/sync/sync_setup_flow.cc b/chrome/browser/views/sync/sync_setup_flow.cc
index 7cb010c..c0386a3 100644
--- a/chrome/browser/views/sync/sync_setup_flow.cc
+++ b/chrome/browser/views/sync/sync_setup_flow.cc
@@ -4,6 +4,7 @@
#ifdef CHROME_PERSONALIZATION
+#include "base/histogram.h"
#include "base/json_reader.h"
#include "base/json_writer.h"
#include "base/string_util.h"
@@ -26,7 +27,7 @@ static const wchar_t* kMergeIFrameXPath = L"//iframe[@id='merge']";
// Helper function to read the JSON string from the Value parameter.
static std::string GetJsonResponse(const Value* content) {
- if (!content || !content->IsType(Value::TYPE_LIST)) {
+ if (!content || !content->IsType(Value::TYPE_LIST)) {
NOTREACHED();
return std::string();
}
@@ -142,6 +143,29 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) {
prefs->SetBoolean(prefs::kSyncHasSetupCompleted, true);
prefs->ScheduleSavePersistentPrefs();
}
+
+ // Record the state at which the user cancelled the signon dialog.
+ switch (current_state_) {
+ case SyncSetupWizard::GAIA_LOGIN:
+ ProfileSyncService::SyncEvent(
+ ProfileSyncService::CANCEL_FROM_SIGNON_WIHTOUT_AUTH);
+ break;
+ case SyncSetupWizard::GAIA_SUCCESS:
+ ProfileSyncService::SyncEvent(
+ ProfileSyncService::CANCEL_DURING_SIGNON);
+ break;
+ case SyncSetupWizard::MERGE_AND_SYNC:
+ ProfileSyncService::SyncEvent(
+ ProfileSyncService::CANCEL_DURING_SIGNON_AFTER_MERGE);
+ break;
+ case SyncSetupWizard::DONE:
+ UMA_HISTOGRAM_MEDIUM_TIMES("Sync.UserPerceivedAuthorizationTime",
+ base::TimeTicks::Now() - login_start_time_);
+ break;
+ default:
+ break;
+ }
+
service_->OnUserCancelledDialog();
delete this;
}
@@ -213,7 +237,6 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) {
current_state_ = advance_state;
}
-
// static
SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service,
SyncSetupFlowContainer* container,
diff --git a/chrome/browser/views/sync/sync_setup_flow.h b/chrome/browser/views/sync/sync_setup_flow.h
index ff86f7b..6412a74 100644
--- a/chrome/browser/views/sync/sync_setup_flow.h
+++ b/chrome/browser/views/sync/sync_setup_flow.h
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/time.h"
#include "chrome/browser/dom_ui/html_dialog_ui.h"
#include "chrome/browser/sync/personalization_strings.h"
#include "chrome/browser/views/sync/sync_setup_wizard.h"
@@ -96,9 +97,13 @@ class SyncSetupFlow : public HtmlDialogUIDelegate {
SyncSetupWizard::State end_state,
const std::string& args, SyncSetupFlowContainer* container,
FlowHandler* handler, ProfileSyncService* service)
- : container_(container), dialog_start_args_(args),
- current_state_(start_state), end_state_(end_state),
- flow_handler_(handler), service_(service) {
+ : container_(container),
+ dialog_start_args_(args),
+ current_state_(start_state),
+ end_state_(end_state),
+ login_start_time_(base::TimeTicks::Now()),
+ flow_handler_(handler),
+ service_(service) {
}
// Returns true if |this| should transition its state machine to |state|
@@ -112,6 +117,9 @@ class SyncSetupFlow : public HtmlDialogUIDelegate {
SyncSetupWizard::State current_state_;
SyncSetupWizard::State end_state_; // The goal.
+ // Time that the GAIA_LOGIN step was received.
+ base::TimeTicks login_start_time_;
+
// The handler needed for the entire flow. We don't own this.
FlowHandler* flow_handler_;