Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 0fed985

Browse files
GregThoCommit bot
authored and
Commit bot
committed
Record histograms for on-demand update check results.
And stop mis-using user metrics action. BUG=424689 Review URL: https://codereview.chromium.org/659333003 Cr-Commit-Position: refs/heads/master@{#300217}
1 parent 4eaeff2 commit 0fed985

File tree

5 files changed

+81
-30
lines changed

5 files changed

+81
-30
lines changed

chrome/browser/google/google_update_win.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "base/bind.h"
1111
#include "base/files/file_path.h"
1212
#include "base/message_loop/message_loop.h"
13+
#include "base/metrics/histogram.h"
14+
#include "base/metrics/sparse_histogram.h"
1315
#include "base/path_service.h"
1416
#include "base/strings/string_util.h"
1517
#include "base/strings/stringprintf.h"
@@ -391,6 +393,12 @@ void GoogleUpdate::ReportResults(GoogleUpdateUpgradeResult results,
391393
// If there is an error, then error code must not be blank, and vice versa.
392394
DCHECK(results == UPGRADE_ERROR ? error_code != GOOGLE_UPDATE_NO_ERROR :
393395
error_code == GOOGLE_UPDATE_NO_ERROR);
396+
UMA_HISTOGRAM_ENUMERATION(
397+
"GoogleUpdate.UpgradeResult", results, NUM_UPGRADE_RESULTS);
398+
if (results == UPGRADE_ERROR) {
399+
UMA_HISTOGRAM_ENUMERATION(
400+
"GoogleUpdate.UpdateErrorCode", error_code, NUM_ERROR_CODES);
401+
}
394402
if (listener_) {
395403
listener_->OnReportResults(
396404
results, error_code, error_message, version_available_);
@@ -404,6 +412,7 @@ bool GoogleUpdate::ReportFailure(HRESULT hr,
404412
DLOG(ERROR) << "Communication with Google Update failed: " << hr
405413
<< " error: " << error_code
406414
<< ", message: " << error_message.c_str();
415+
UMA_HISTOGRAM_SPARSE_SLOWLY("GoogleUpdate.ErrorHresult", hr);
407416
main_loop->PostTask(
408417
FROM_HERE,
409418
base::Bind(&GoogleUpdate::ReportResults, this,

chrome/browser/google/google_update_win.h

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,52 @@ class Widget;
2020

2121
// The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are
2222
// internal states and will not be reported as results to the listener.
23+
// These values are used for a histogram. Do not reorder.
2324
enum GoogleUpdateUpgradeResult {
2425
// The upgrade has started.
2526
UPGRADE_STARTED = 0,
2627
// A check for upgrade has been initiated.
27-
UPGRADE_CHECK_STARTED,
28+
UPGRADE_CHECK_STARTED = 1,
2829
// An update is available.
29-
UPGRADE_IS_AVAILABLE,
30+
UPGRADE_IS_AVAILABLE = 2,
3031
// The upgrade happened successfully.
31-
UPGRADE_SUCCESSFUL,
32+
UPGRADE_SUCCESSFUL = 3,
3233
// No need to upgrade, Chrome is up to date.
33-
UPGRADE_ALREADY_UP_TO_DATE,
34+
UPGRADE_ALREADY_UP_TO_DATE = 4,
3435
// An error occurred.
35-
UPGRADE_ERROR,
36+
UPGRADE_ERROR = 5,
37+
NUM_UPGRADE_RESULTS
3638
};
3739

40+
// These values are used for a histogram. Do not reorder.
3841
enum GoogleUpdateErrorCode {
3942
// The upgrade completed successfully (or hasn't been started yet).
4043
GOOGLE_UPDATE_NO_ERROR = 0,
4144
// Google Update only supports upgrading if Chrome is installed in the default
4245
// location. This error will appear for developer builds and with
4346
// installations unzipped to random locations.
44-
CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY,
47+
CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY = 1,
4548
// Failed to create Google Update JobServer COM class.
46-
GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED,
49+
GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED = 2,
4750
// Failed to create Google Update OnDemand COM class.
48-
GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND,
51+
GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND = 3,
4952
// Google Update OnDemand COM class reported an error during a check for
5053
// update (or while upgrading).
51-
GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR,
54+
GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR = 4,
5255
// A call to GetResults failed.
53-
GOOGLE_UPDATE_GET_RESULT_CALL_FAILED,
56+
GOOGLE_UPDATE_GET_RESULT_CALL_FAILED = 5,
5457
// A call to GetVersionInfo failed.
55-
GOOGLE_UPDATE_GET_VERSION_INFO_FAILED,
58+
GOOGLE_UPDATE_GET_VERSION_INFO_FAILED = 6,
5659
// An error occurred while upgrading (or while checking for update).
5760
// Check the Google Update log in %TEMP% for more details.
58-
GOOGLE_UPDATE_ERROR_UPDATING,
61+
GOOGLE_UPDATE_ERROR_UPDATING = 7,
5962
// Updates can not be downloaded because the administrator has disabled all
6063
// types of updating.
61-
GOOGLE_UPDATE_DISABLED_BY_POLICY,
64+
GOOGLE_UPDATE_DISABLED_BY_POLICY = 8,
6265
// Updates can not be downloaded because the administrator has disabled
6366
// manual (on-demand) updates. Automatic background updates are allowed.
64-
GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY,
67+
GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9,
68+
NUM_ERROR_CODES
6569
};
6670

6771
// The GoogleUpdateStatusListener interface is used by components to receive

chrome/browser/ui/webui/help/version_updater_win.cc

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
#include "chrome/installer/util/browser_distribution.h"
2020
#include "chrome/installer/util/install_util.h"
2121
#include "content/public/browser/browser_thread.h"
22-
#include "content/public/browser/user_metrics.h"
2322
#include "ui/base/l10n/l10n_util.h"
2423
#include "ui/views/widget/widget.h"
2524

26-
using base::UserMetricsAction;
2725
using content::BrowserThread;
2826

2927
namespace {
@@ -178,18 +176,14 @@ void VersionUpdaterWin::UpdateStatus(GoogleUpdateUpgradeResult result,
178176

179177
switch (result) {
180178
case UPGRADE_CHECK_STARTED: {
181-
content::RecordAction(UserMetricsAction("UpgradeCheck_Started"));
182179
status = CHECKING;
183180
break;
184181
}
185182
case UPGRADE_STARTED: {
186-
content::RecordAction(UserMetricsAction("Upgrade_Started"));
187183
status = UPDATING;
188184
break;
189185
}
190186
case UPGRADE_IS_AVAILABLE: {
191-
content::RecordAction(
192-
UserMetricsAction("UpgradeCheck_UpgradeIsAvailable"));
193187
DCHECK(!google_updater_); // Should have been nulled out already.
194188
CreateGoogleUpdater();
195189
UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR, base::string16());
@@ -208,12 +202,10 @@ void VersionUpdaterWin::UpdateStatus(GoogleUpdateUpgradeResult result,
208202
return;
209203
}
210204
case UPGRADE_SUCCESSFUL: {
211-
content::RecordAction(UserMetricsAction("UpgradeCheck_Upgraded"));
212205
status = NEARLY_UPDATED;
213206
break;
214207
}
215208
case UPGRADE_ERROR: {
216-
content::RecordAction(UserMetricsAction("UpgradeCheck_Error"));
217209
status = FAILED;
218210
if (error_code == GOOGLE_UPDATE_DISABLED_BY_POLICY) {
219211
message =
@@ -253,14 +245,11 @@ void VersionUpdaterWin::GotInstalledVersion(const Version& version) {
253245
// out of date.
254246
chrome::VersionInfo version_info;
255247
Version running_version(version_info.Version());
256-
if (!version.IsValid() || version.CompareTo(running_version) <= 0) {
257-
content::RecordAction(
258-
UserMetricsAction("UpgradeCheck_AlreadyUpToDate"));
259-
callback_.Run(UPDATED, 0, base::string16());
260-
} else {
261-
content::RecordAction(UserMetricsAction("UpgradeCheck_AlreadyUpgraded"));
262-
callback_.Run(NEARLY_UPDATED, 0, base::string16());
263-
}
248+
callback_.Run((version.IsValid() && version.CompareTo(running_version) > 0)
249+
? NEARLY_UPDATED
250+
: UPDATED,
251+
0,
252+
base::string16());
264253
}
265254

266255
void VersionUpdaterWin::CreateGoogleUpdater() {

tools/metrics/actions/actions.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11162,46 +11162,58 @@ should be able to be added at any place in this file.
1116211162
<action name="UpgradeCheck_AlreadyUpToDate">
1116311163
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1116411164
<description>Please enter the description of this user action.</description>
11165+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1116511166
</action>
1116611167

1116711168
<action name="UpgradeCheck_AlreadyUpgraded">
1116811169
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1116911170
<description>Please enter the description of this user action.</description>
11171+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1117011172
</action>
1117111173

1117211174
<action name="UpgradeCheck_Done">
1117311175
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1117411176
<description>Please enter the description of this user action.</description>
11177+
<obsolete>Not present in codebase.</obsolete>
1117511178
</action>
1117611179

1117711180
<action name="UpgradeCheck_Error">
1117811181
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1117911182
<description>Please enter the description of this user action.</description>
11183+
<obsolete>
11184+
Removed from codebase; see GoogleUpdate.UpgradeResult,
11185+
GoogleUpdate.UpdateErrorCode, and GoogleUpdate.ErrorHresult.
11186+
</obsolete>
1118011187
</action>
1118111188

1118211189
<action name="UpgradeCheck_Started">
1118311190
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1118411191
<description>Please enter the description of this user action.</description>
11192+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1118511193
</action>
1118611194

1118711195
<action name="UpgradeCheck_TimedOut">
1118811196
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1118911197
<description>Please enter the description of this user action.</description>
11198+
<obsolete>Not present in codebase.</obsolete>
1119011199
</action>
1119111200

1119211201
<action name="UpgradeCheck_UpgradeIsAvailable">
1119311202
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1119411203
<description>Please enter the description of this user action.</description>
11204+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1119511205
</action>
1119611206

1119711207
<action name="UpgradeCheck_Upgraded">
1119811208
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1119911209
<description>Please enter the description of this user action.</description>
11210+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1120011211
</action>
1120111212

1120211213
<action name="Upgrade_Started">
1120311214
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
1120411215
<description>Please enter the description of this user action.</description>
11216+
<obsolete>Removed from codebase; see GoogleUpdate.UpgradeResult.</obsolete>
1120511217
</action>
1120611218

1120711219
<action name="ViewAboutConflicts">

tools/metrics/histograms/histograms.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9638,6 +9638,16 @@ Therefore, the affected-histogram name has to have at least one dot in it.
96389638
</summary>
96399639
</histogram>
96409640

9641+
<histogram name="GoogleUpdate.ErrorHresult">
9642+
<owner>[email protected]</owner>
9643+
<summary>The HRESULT for a failed on-demand update check.</summary>
9644+
</histogram>
9645+
9646+
<histogram name="GoogleUpdate.UpdateErrorCode" enum="GoogleUpdateErrorCode">
9647+
<owner>[email protected]</owner>
9648+
<summary>The error code for a failed on-demand update check.</summary>
9649+
</histogram>
9650+
96419651
<histogram name="GoogleUpdate.UpdatePolicyIsOverridden" enum="Boolean">
96429652
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
96439653
<summary>
@@ -9647,6 +9657,11 @@ Therefore, the affected-histogram name has to have at least one dot in it.
96479657
</summary>
96489658
</histogram>
96499659

9660+
<histogram name="GoogleUpdate.UpgradeResult" enum="GoogleUpdateUpgradeResult">
9661+
<owner>[email protected]</owner>
9662+
<summary>The result of an on-demand update check.</summary>
9663+
</histogram>
9664+
96509665
<histogram name="GPU.AcceleratedSurfaceRefreshRate" units="hz">
96519666
<owner>[email protected]</owner>
96529667
<summary>
@@ -44623,6 +44638,28 @@ Therefore, the affected-histogram name has to have at least one dot in it.
4462344638
<int value="13" label="WEB_LOGIN_REQUIRED"/>
4462444639
</enum>
4462544640

44641+
<enum name="GoogleUpdateErrorCode" type="int">
44642+
<int value="0" label="GOOGLE_UPDATE_NO_ERROR"/>
44643+
<int value="1" label="CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY"/>
44644+
<int value="2" label="GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED"/>
44645+
<int value="3" label="GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND"/>
44646+
<int value="4" label="GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR"/>
44647+
<int value="5" label="GOOGLE_UPDATE_GET_RESULT_CALL_FAILED"/>
44648+
<int value="6" label="GOOGLE_UPDATE_GET_VERSION_INFO_FAILED"/>
44649+
<int value="7" label="GOOGLE_UPDATE_ERROR_UPDATING"/>
44650+
<int value="8" label="GOOGLE_UPDATE_DISABLED_BY_POLICY"/>
44651+
<int value="9" label="GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY"/>
44652+
</enum>
44653+
44654+
<enum name="GoogleUpdateUpgradeResult" type="int">
44655+
<int value="0" label="UPGRADE_STARTED"/>
44656+
<int value="1" label="UPGRADE_CHECK_STARTED"/>
44657+
<int value="2" label="UPGRADE_IS_AVAILABLE"/>
44658+
<int value="3" label="UPGRADE_SUCCESSFUL"/>
44659+
<int value="4" label="UPGRADE_ALREADY_UP_TO_DATE"/>
44660+
<int value="5" label="UPGRADE_ERROR"/>
44661+
</enum>
44662+
4462644663
<enum name="HIDContinueScenarioType" type="int">
4462744664
<summary>Possible detected devices combination on leaving dialog</summary>
4462844665
<int value="0" label="Pointing device only detected."/>

0 commit comments

Comments
 (0)