diff options
author | maxbogue <maxbogue@chromium.org> | 2015-12-01 10:30:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 18:31:05 +0000 |
commit | 33a3aacf8ac95bb6c9961067ea8a4b2b0c0f9878 (patch) | |
tree | 303720c9f29c89f2d02378025a9982acc4a85c8c | |
parent | 2bd1f02649d6fe8b0a5616932e40b67478c58174 (diff) | |
download | chromium_src-33a3aacf8ac95bb6c9961067ea8a4b2b0c0f9878.zip chromium_src-33a3aacf8ac95bb6c9961067ea8a4b2b0c0f9878.tar.gz chromium_src-33a3aacf8ac95bb6c9961067ea8a4b2b0c0f9878.tar.bz2 |
[Sync] Add Sync.InitialState UMA metric.
We don't know for sure whether sync will succeed at starting up at
initialization time, but we can inspect and report on the state of
various flags.
BUG=555113
Review URL: https://codereview.chromium.org/1463583008
Cr-Commit-Position: refs/heads/master@{#362455}
-rw-r--r-- | components/browser_sync/browser/profile_sync_service.cc | 17 | ||||
-rw-r--r-- | components/browser_sync/browser/profile_sync_service.h | 17 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 21 |
3 files changed, 55 insertions, 0 deletions
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc index 04cb904..3b8bf73 100644 --- a/components/browser_sync/browser/profile_sync_service.cc +++ b/components/browser_sync/browser/profile_sync_service.cc @@ -297,6 +297,23 @@ void ProfileSyncService::Initialize() { sync_prefs_.AddSyncPrefObserver(this); + SyncInitialState sync_state = CAN_START; + if (!IsSignedIn()) { + sync_state = NOT_SIGNED_IN; + } else if (IsManaged()) { + sync_state = IS_MANAGED; + } else if (!IsSyncRequested()) { + if (HasSyncSetupCompleted()) { + sync_state = NOT_REQUESTED; + } else { + sync_state = NOT_REQUESTED_NOT_SETUP; + } + } else if (!HasSyncSetupCompleted()) { + sync_state = NEEDS_CONFIRMATION; + } + UMA_HISTOGRAM_ENUMERATION("Sync.InitialState", sync_state, + SYNC_INITIAL_STATE_LIMIT); + // If sync isn't allowed, the only thing to do is to turn it off. if (!IsSyncAllowed()) { RequestStop(CLEAR_DATA); diff --git a/components/browser_sync/browser/profile_sync_service.h b/components/browser_sync/browser/profile_sync_service.h index 6f6a9345..e2203f2 100644 --- a/components/browser_sync/browser/profile_sync_service.h +++ b/components/browser_sync/browser/profile_sync_service.h @@ -640,6 +640,23 @@ class ProfileSyncService : public sync_driver::SyncService, AUTH_ERROR_LIMIT }; + // The initial state of sync, for the Sync.InitialState histogram. Even if + // this value is CAN_START, sync startup might fail for reasons that we may + // want to consider logging in the future, such as sync being disabled via + // Google Dashboard (birthday error), a passphrase needed for decryption, or + // the version of Chrome being too old. This enum is used to back a UMA + // histogram, and should therefore be treated as append-only. + enum SyncInitialState { + CAN_START, // Sync can attempt to start up. + NOT_SIGNED_IN, // There is no signed in user. + NOT_REQUESTED, // The user turned off sync. + NOT_REQUESTED_NOT_SETUP, // The user turned off sync and setup completed + // is false. Might indicate a stop-and-clear. + NEEDS_CONFIRMATION, // The user must confirm sync settings. + IS_MANAGED, // Sync is disallowed by enterprise policy. + SYNC_INITIAL_STATE_LIMIT + }; + friend class ProfileSyncServicePasswordTest; friend class SyncTest; friend class TestProfileSyncService; diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b9a0d3b..f5ff69f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -47690,6 +47690,18 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </summary> </histogram> +<histogram name="Sync.InitialState" enum="SyncInitialState"> + <owner>maxbogue@chromium.org</owner> + <summary> + An approximate state of sync at startup. Logs a few reasons sync definitely + wouldn't be able to start, or that it probably can start. The user having + turned off sync on mobile will be logged as "turned off by user". + A dashboard stop and clear will fall under "turned off and setup not + completed". See the SyncInitialState enum in profile_sync_service.h for + more information. + </summary> +</histogram> + <histogram name="Sync.InvalidationSessionsAndroid" enum="BooleanHit"> <owner>pkotwicz@chromium.org</owner> <summary> @@ -76856,6 +76868,15 @@ To add a new entry, add it with any value and run test to compute valid value. <int value="3" label="Disabled"/> </enum> +<enum name="SyncInitialState" type="int"> + <int value="0" label="Can attempt to start"/> + <int value="1" label="No signed in user"/> + <int value="2" label="Turned off by user"/> + <int value="3" label="Turned off and setup not completed"/> + <int value="4" label="Must confirm sync settings"/> + <int value="5" label="Disallowed by enterprise policy"/> +</enum> + <enum name="SyncKeystoreDecryptionFailure" type="int"> <int value="0" label="No keystore key"/> <int value="1" label="Unknown reason"/> |