Commit 90704678 authored by mlerman@chromium.org's avatar mlerman@chromium.org

UMA metrics - number of accounts per profile and account reconciler.

Creation of a new signin_metrics class to track components/signin UMA.

BUG=357693
TEST=New histograms are called Profile.NumberOfAccountsPerProfile,
Signin.ReconcilerAddedToChrome and Signin.ReconcilerAddedToCookieJar.
There is also a UserCount called
AccountReconcilerDifferentPrimaryAccounts. These can be viewed in
chrome://histograms and chrome://user-actions respectively.
The Profile one can be viewed any time a profile is opened. The others
are best tested the first time you Sign In to Chrome, assuming you
already were signed in to google in the content area with 1 or more
accounts.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269789 0039d316-1c4b-4281-b951-d872f2087c98
parent 43c14046
......@@ -60,6 +60,8 @@
'signin/core/browser/signin_manager.h',
'signin/core/browser/signin_manager_cookie_helper.cc',
'signin/core/browser/signin_manager_cookie_helper.h',
'signin/core/browser/signin_metrics.cc',
'signin/core/browser/signin_metrics.h',
'signin/core/browser/signin_oauth_helper.cc',
'signin/core/browser/signin_oauth_helper.h',
'signin/core/browser/signin_tracker.cc',
......
......@@ -15,6 +15,7 @@
#include "base/time/time.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_client.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/browser/signin_oauth_helper.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "google_apis/gaia/gaia_auth_util.h"
......@@ -198,6 +199,7 @@ AccountReconcilor::AccountReconcilor(ProfileOAuth2TokenService* token_service,
this),
registered_with_token_service_(false),
is_reconcile_started_(false),
first_execution_(true),
are_gaia_accounts_set_(false),
requests_(NULL) {
VLOG(1) << "AccountReconcilor::AccountReconcilor";
......@@ -612,6 +614,7 @@ void AccountReconcilor::FinishReconcile() {
// completed otherwise. Make a copy of |add_to_cookie_| since calls to
// SignalComplete() will change the array.
std::vector<std::string> add_to_cookie_copy = add_to_cookie_;
int added_to_cookie = 0;
for (size_t i = 0; i < add_to_cookie_copy.size(); ++i) {
if (gaia_accounts_.end() !=
std::find_if(gaia_accounts_.begin(),
......@@ -624,6 +627,7 @@ void AccountReconcilor::FinishReconcile() {
GoogleServiceAuthError::AuthErrorNone());
} else {
PerformMergeAction(add_to_cookie_copy[i]);
added_to_cookie++;
}
}
......@@ -636,6 +640,12 @@ void AccountReconcilor::FinishReconcile() {
PerformAddToChromeAction(i->first, i->second);
}
signin_metrics::LogSigninAccountReconciliation(valid_chrome_accounts_.size(),
added_to_cookie,
add_to_chrome_.size(),
are_primaries_equal,
first_execution_);
first_execution_ = false;
CalculateIfReconcileIsDone();
ScheduleStartReconcileIfChromeAccountsChanged();
}
......
......@@ -213,6 +213,9 @@ class AccountReconcilor : public KeyedService,
// this profile.
bool is_reconcile_started_;
// True iff this is the first time the reconcilor is executing.
bool first_execution_;
// Used during reconcile action.
// These members are used used to validate the gaia cookie. |gaia_accounts_|
// holds the state of google accounts in the gaia cookie. Each element is
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/core/browser/signin_metrics.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/user_metrics.h"
namespace signin_metrics {
void LogSigninAccountReconciliation(int total_number_accounts,
int count_added_to_cookie_jar,
int count_added_to_token,
bool primary_accounts_same,
bool is_first_reconcile) {
UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile",
total_number_accounts);
// We want to include zeroes in the counts of added accounts to easily
// capture _relatively_ how often we merge accounts.
if (is_first_reconcile) {
UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun",
count_added_to_cookie_jar);
UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun",
count_added_to_token);
UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.DifferentPrimaryAccounts.FirstRun",
!primary_accounts_same);
} else {
UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun",
count_added_to_cookie_jar);
UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun",
count_added_to_token);
UMA_HISTOGRAM_BOOLEAN(
"Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun",
!primary_accounts_same);
}
}
} // namespace signin_metrics
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
#define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
namespace signin_metrics {
// Log to UMA histograms and UserCounts stats about a single execution of the
// AccountReconciler.
// |total_number_accounts| - How many accounts are in the browser for this
// profile.
// |count_added_to_cookie_jar| - How many accounts were in the browser but not
// the cookie jar.
// |count_added_to_token| - How may accounts were in the cookie jar but not in
// the browser.
// |primary_accounts_same| - False if the primary account for the cookie jar
// and the token service were different; else true.
// |is_first_reconcile| - True if these stats are from the first execution of
// the AccountReconcilor.
void LogSigninAccountReconciliation(int total_number_accounts,
int count_added_to_cookie_jar,
int count_added_to_token,
bool primary_accounts_same,
bool is_first_reconcile);
} // namespace signin_metrics
#endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
......@@ -529,6 +529,9 @@ def AddLiteralActions(actions):
WalkDirectory(chrome_root, actions, EXTENSIONS, GrepForActions)
content_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'content'))
WalkDirectory(content_root, actions, EXTENSIONS, GrepForActions)
components_root = os.path.normpath(os.path.join(REPOSITORY_ROOT,
'components'))
WalkDirectory(components_root, actions, EXTENSIONS, GrepForActions)
net_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'net'))
WalkDirectory(net_root, actions, EXTENSIONS, GrepForActions)
webkit_root = os.path.normpath(os.path.join(REPOSITORY_ROOT, 'webkit'))
......
......@@ -26,7 +26,7 @@ three sections:
works.
Each histogram_suffixes tag lists the histograms that it affects. The complete
list of histograms is computed by appending (or prepending - see blow) the
list of histograms is computed by appending (or prepending - see below) the
histogram_suffixes suffix names to each of the affected histograms. For example,
define the following:
......@@ -20649,6 +20649,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="Profile.NumberOfAccountsPerProfile">
<owner>mlerman@chromium.org</owner>
<summary>
Counts the number of Google-managed accounts linked to a profile. This may
be counted multiple times per profile. Please review with the &quot;Show
user counts&quot; option enabled on the dashboard.
</summary>
</histogram>
<histogram name="Profile.NumberOfManagedProfiles">
<owner>pam@chromium.org</owner>
<summary>
......@@ -23518,6 +23527,30 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="Signin.Reconciler.AddedToChrome">
<owner>mlerman@chromium.org</owner>
<summary>
After the first execution of the account reconciler, how many accounts were
added to the browser's token service because they were in the cookie jar.
</summary>
</histogram>
<histogram name="Signin.Reconciler.AddedToCookieJar">
<owner>mlerman@chromium.org</owner>
<summary>
After the first execution of the account reconciler, how many accounts were
added to the cookie jar because they were in the browser's token service.
</summary>
</histogram>
<histogram name="Signin.Reconciler.DifferentPrimaryAccounts">
<owner>mlerman@chromium.org</owner>
<summary>
After the first execution of the account reconciler, true if the token
service and cookie jar contained different primary accounts.
</summary>
</histogram>
<histogram name="SimpleCache.App.CheckCRCResult" enum="CheckCRCResult">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>
......@@ -45772,6 +45805,18 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<affected-histogram name="Extensions.UpdateSource"/>
</histogram_suffixes>
<histogram_suffixes name="Signin.Reconciler">
<suffix name="FirstRun"
label="First execution of the reconciler after the profile was loaded
or the new_profile_management flag was toggled."/>
<suffix name="SubsequentRun"
label="Execution of the reconciler triggered by some other change of
state."/>
<affected-histogram name="Signin.Reconciler.AddedToChrome"/>
<affected-histogram name="Signin.Reconciler.AddedToCookieJar"/>
<affected-histogram name="Signin.Reconciler.DifferentPrimaryAccounts"/>
</histogram_suffixes>
<histogram_suffixes name="SocketType">
<suffix name="HTTPProxy" label="HTTP proxy socket"/>
<suffix name="SOCK" label="SOCKS socket"/>
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