0

Revert "updater: CheckUpdaterHealthTask to check/record updater health UMA"

This reverts commit a880d44c8d.

Reason for revert: Suspected in mac-chrome failures. (https://ci.chromium.org/ui/p/chrome/builders/ci/mac-chrome/42993/overview)

Original change's description:
> updater: CheckUpdaterHealthTask to check/record updater health UMA
>
> This CL introduces a `CheckUpdaterHealthTask` which checks and records
> updater health stats using UMA histograms. Specifically, this CL records
> whether the updater is functional, and then for Windows, the scheduled
> task health (presence/enabled/extra tasks).
>
> Bug: 347315427
> Change-Id: I872ffec297709d68995a1dd839288da9cd860ffa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6350873
> Reviewed-by: Joshua Pawlicki <waffles@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Commit-Queue: S Ganesh <ganesh@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1432835}

Bug: 347315427
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I9c9408fc8349463c291c946290d604634c857e55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6357376
Commit-Queue: Slobodan Pejic <slobodan@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Slobodan Pejic <slobodan@google.com>
Cr-Commit-Position: refs/heads/main@{#1432946}
This commit is contained in:
Slobodan Pejic
2025-03-14 12:51:49 -07:00
committed by Chromium LUCI CQ
parent 4e90c44e4b
commit f64099f3cc
8 changed files with 11 additions and 219 deletions

@ -12,15 +12,8 @@ if (is_win || is_mac) {
"browser_updater_client.h",
"browser_updater_client_util.cc",
"browser_updater_client_util.h",
"check_updater_health_task.h",
]
if (enable_updater) {
sources += [ "check_updater_health_task.cc" ]
} else {
sources += [ "check_updater_health_task_no_updater.cc" ]
}
deps = [
"//base",
"//chrome/browser:buildflags",

@ -1,80 +0,0 @@
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/updater/check_updater_health_task.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/sequence_checker.h"
#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/browser/updater/browser_updater_client.h"
#include "chrome/browser/updater/browser_updater_client_util.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util/util.h"
#if BUILDFLAG(IS_WIN)
#include "chrome/updater/util/win_util.h"
#include "chrome/updater/win/task_scheduler.h"
#include "chrome/updater/win/win_constants.h"
#endif
namespace updater {
CheckUpdaterHealthTask::CheckUpdaterHealthTask(UpdaterScope scope)
: scope_(scope) {}
CheckUpdaterHealthTask::~CheckUpdaterHealthTask() = default;
void CheckUpdaterHealthTask::CheckAndRecordUpdaterHealth(
const base::Version& version) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::UmaHistogramBoolean("GoogleUpdate.UpdaterHealth.UpdaterValid",
version.IsValid());
if (!version.IsValid()) {
return;
}
#if BUILDFLAG(IS_WIN)
scoped_refptr<TaskScheduler> task_scheduler =
TaskScheduler::CreateInstance(scope_);
const std::wstring task_name =
task_scheduler->FindFirstTaskName(GetTaskNamePrefix(scope_));
// Count the number of tasks for the product.
size_t number_of_tasks = 0;
task_scheduler->ForEachTaskWithPrefix(
base::UTF8ToWide(PRODUCT_FULLNAME_STRING),
[&](const std::wstring& task_name) { ++number_of_tasks; });
base::UmaHistogramBoolean("GoogleUpdate.UpdaterHealth.ScheduledTaskPresent",
!task_name.empty());
if (!task_name.empty()) {
base::UmaHistogramBoolean("GoogleUpdate.UpdaterHealth.ScheduledTaskEnabled",
task_scheduler->IsTaskEnabled(task_name));
}
base::UmaHistogramCounts100("GoogleUpdate.UpdaterHealth.ScheduledTaskCount",
number_of_tasks);
#endif
}
void CheckUpdaterHealthTask::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
BrowserUpdaterClient::Create(::GetUpdaterScope())
->GetUpdaterVersion(
base::BindOnce(&CheckUpdaterHealthTask::CheckAndRecordUpdaterHealth,
this)
.Then(std::move(callback)));
}
} // namespace updater

@ -1,34 +0,0 @@
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UPDATER_CHECK_UPDATER_HEALTH_TASK_H_
#define CHROME_BROWSER_UPDATER_CHECK_UPDATER_HEALTH_TASK_H_
#include "base/functional/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_checker.h"
#include "base/version.h"
#include "chrome/updater/updater_scope.h"
namespace updater {
class CheckUpdaterHealthTask
: public base::RefCountedThreadSafe<CheckUpdaterHealthTask> {
public:
explicit CheckUpdaterHealthTask(UpdaterScope scope);
void Run(base::OnceClosure callback);
private:
friend class base::RefCountedThreadSafe<CheckUpdaterHealthTask>;
virtual ~CheckUpdaterHealthTask();
void CheckAndRecordUpdaterHealth(const base::Version& version);
SEQUENCE_CHECKER(sequence_checker_);
const UpdaterScope scope_;
};
} // namespace updater
#endif // CHROME_BROWSER_UPDATER_CHECK_UPDATER_HEALTH_TASK_H_

@ -1,33 +0,0 @@
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/version.h"
#include "chrome/browser/updater/check_updater_health_task.h"
#include "chrome/updater/updater_scope.h"
namespace updater {
CheckUpdaterHealthTask::CheckUpdaterHealthTask(UpdaterScope scope)
: scope_(scope) {}
CheckUpdaterHealthTask::~CheckUpdaterHealthTask() = default;
void CheckUpdaterHealthTask::CheckAndRecordUpdaterHealth(
const base::Version& version) {}
void CheckUpdaterHealthTask::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::UmaHistogramBoolean("GoogleUpdate.UpdaterHealth.UpdaterValid", false);
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback)));
}
} // namespace updater

@ -11,7 +11,6 @@
#include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h"
#include "chrome/browser/updater/browser_updater_client.h"
#include "chrome/browser/updater/browser_updater_client_util.h"
#include "chrome/browser/updater/check_updater_health_task.h"
#include "chrome/updater/updater_scope.h"
namespace updater {
@ -27,7 +26,7 @@ void DoPeriodicTasks(base::OnceClosure callback) {
FROM_HERE,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(&::GetUpdaterScope),
base::BindOnce(&GetUpdaterScope),
base::BindOnce(
[](base::OnceClosure callback, UpdaterScope scope) {
BrowserUpdaterClient::Create(scope)->RunPeriodicTasks(
@ -35,10 +34,7 @@ void DoPeriodicTasks(base::OnceClosure callback) {
},
std::move(callback)));
},
base::BindOnce(
&CheckUpdaterHealthTask::Run,
base::MakeRefCounted<CheckUpdaterHealthTask>(::GetUpdaterScope()))
.Then(std::move(callback))));
std::move(callback)));
}
} // namespace updater

@ -4,20 +4,16 @@
#include "chrome/browser/updater/scheduler.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "chrome/browser/updater/browser_updater_client.h"
#include "chrome/browser/updater/browser_updater_client_util.h"
#include "chrome/browser/updater/check_updater_health_task.h"
#include "chrome/updater/updater_scope.h"
namespace updater {
void DoPeriodicTasks(base::OnceClosure callback) {
base::MakeRefCounted<CheckUpdaterHealthTask>(::GetUpdaterScope())
->Run(base::BindOnce(&BrowserUpdaterClient::RunPeriodicTasks,
BrowserUpdaterClient::Create(::GetUpdaterScope()),
std::move(callback)));
BrowserUpdaterClient::Create(::GetUpdaterScope())
->RunPeriodicTasks(std::move(callback));
}
} // namespace updater

@ -339,6 +339,8 @@ if (is_win || is_mac || is_linux) {
"win/setup/uninstall.h",
"win/setup/win_setup.cc",
"win/setup/win_setup.h",
"win/task_scheduler.cc",
"win/task_scheduler.h",
"win/ui/complete_wnd.cc",
"win/ui/complete_wnd.h",
"win/ui/l10n_util.cc",
@ -383,8 +385,12 @@ if (is_win || is_mac || is_linux) {
"//chrome/updater/win:wrl_strict",
]
defines += [ "SECURITY_WIN32" ]
libs = [
"msxml2.lib",
"secur32.lib",
"taskschd.lib",
"wtsapi32.lib",
]
}
@ -600,8 +606,6 @@ if (is_win || is_mac || is_linux) {
"util/win_util.cc",
"util/win_util.h",
"win/scoped_handle.h",
"win/task_scheduler.cc",
"win/task_scheduler.h",
"win/user_info.cc",
"win/user_info.h",
"win/win_constants.cc",
@ -619,13 +623,7 @@ if (is_win || is_mac || is_linux) {
"//chrome/updater/win:wrl_strict",
]
defines = [ "SECURITY_WIN32" ]
libs = [
"secur32.lib",
"taskschd.lib",
"wtsapi32.lib",
]
libs = [ "wtsapi32.lib" ]
}
if (is_linux) {

@ -65,50 +65,6 @@ chromium-metrics-reviews@google.com.
<summary>The error code for a failed on-demand update check.</summary>
</histogram>
<histogram name="GoogleUpdate.UpdaterHealth.ScheduledTaskCount" units="tasks"
expires_after="2026-03-12">
<owner>ganesh@chromium.org</owner>
<owner>omaha-support@google.com</owner>
<summary>
Number of scheduled tasks registered for the updater in the Windows task
scheduler. Recorded when the browser creates the main loop, and subsequently
at 5 hour intervals as long as the browser is running.
</summary>
</histogram>
<histogram name="GoogleUpdate.UpdaterHealth.ScheduledTaskEnabled"
enum="BooleanEnabled" expires_after="2026-03-12">
<owner>ganesh@chromium.org</owner>
<owner>omaha-support@google.com</owner>
<summary>
Records true if the scheduled task is enabled for the active updater in the
Windows task scheduler. Recorded when the browser creates the main loop, and
subsequently at 5 hour intervals as long as the browser is running.
</summary>
</histogram>
<histogram name="GoogleUpdate.UpdaterHealth.ScheduledTaskPresent"
enum="BooleanPresent" expires_after="2026-03-12">
<owner>ganesh@chromium.org</owner>
<owner>omaha-support@google.com</owner>
<summary>
Records true if the scheduled task is present for the active updater in the
Windows task scheduler. Recorded when the browser creates the main loop, and
subsequently at 5 hour intervals as long as the browser is running.
</summary>
</histogram>
<histogram name="GoogleUpdate.UpdaterHealth.UpdaterValid" enum="BooleanValid"
expires_after="2026-03-12">
<owner>ganesh@chromium.org</owner>
<owner>omaha-support@google.com</owner>
<summary>
Records true if there is an active updater present on the system. Recorded
when the browser creates the main loop, and subsequently at 5 hour intervals
as long as the browser is running.
</summary>
</histogram>
<histogram name="GoogleUpdate.UpgradeResult" enum="GoogleUpdateUpgradeStatus"
expires_after="never">
<!-- expires-never: Core metric for monitoring on-demand updates. -->