Skip to content

Commit

Permalink
Removing deprecated Neutrino logging
Browse files Browse the repository at this point in the history
Bug: b/282056014
Change-Id: I8338ac0431e1ce4164bc8003ae0455b6d2d1c2f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4558964
Reviewed-by: Jong Ahn <jongahn@chromium.org>
Commit-Queue: Andrew Bregger <andrewbregger@google.com>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1209635}
  • Loading branch information
Andrew Bregger authored and Chromium LUCI CQ committed Oct 13, 2023
1 parent 001bd65 commit 2039b8d
Show file tree
Hide file tree
Showing 21 changed files with 1 addition and 572 deletions.
2 changes: 0 additions & 2 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5399,8 +5399,6 @@ static_library("browser") {
"//components/digital_goods/mojom",
"//components/drive",
"//components/metrics/structured",
"//components/metrics/structured:neutrino_logging",
"//components/metrics/structured:neutrino_logging_util",
"//components/quirks",
"//components/services/app_service/public/cpp:instance_update",
"//components/services/font:lib",
Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4118,8 +4118,6 @@ source_set("ash") {
"//components/live_caption:utils",
"//components/manta",
"//components/metrics:serialization",
"//components/metrics/structured:neutrino_logging",
"//components/metrics/structured:neutrino_logging_util",
"//components/omnibox/browser:location_bar",
"//components/password_manager/core/browser",
"//components/password_manager/core/browser:hash_password_manager",
Expand Down
13 changes: 0 additions & 13 deletions chrome/browser/ash/login/ui/login_display_host_webui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
#include "components/account_id/account_id.h"
#include "components/language/core/browser/pref_names.h"
#include "components/language/core/common/locale_util.h"
#include "components/metrics/structured/neutrino_logging.h"
#include "components/metrics/structured/neutrino_logging_util.h"
#include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h"
#include "components/session_manager/session_manager_types.h"
Expand Down Expand Up @@ -450,22 +448,11 @@ LoginDisplayHostWebUI::LoginDisplayHostWebUI()
manager->Initialize(static_cast<int>(Sound::kStartup),
bundle.GetRawDataResource(IDR_SOUND_STARTUP_WAV),
media::AudioCodec::kPCM);

metrics::structured::NeutrinoDevicesLogWithLocalState(
GetLocalState(),
metrics::structured::NeutrinoDevicesLocation::kLoginDisplayHostWebUI);
}

LoginDisplayHostWebUI::~LoginDisplayHostWebUI() {
VLOG(4) << __func__;

policy::BrowserPolicyConnectorAsh* connector =
g_browser_process->platform_part()->browser_policy_connector_ash();
metrics::structured::NeutrinoDevicesLogEnrollmentWithLocalState(
GetLocalState(), connector->IsDeviceEnterpriseManaged(),
metrics::structured::NeutrinoDevicesLocation::
kLoginDisplayHostWebUIDestructor);

SessionManagerClient::Get()->RemoveObserver(this);
CrasAudioHandler::Get()->RemoveAudioObserver(this);

Expand Down
9 changes: 0 additions & 9 deletions chrome/browser/ash/settings/stats_reporting_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "base/logging.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chromeos/ash/components/settings/cros_settings_names.h"
#include "components/metrics/structured/neutrino_logging.h"
#include "components/metrics/structured/neutrino_logging_util.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"

Expand Down Expand Up @@ -61,8 +59,6 @@ void StatsReportingController::SetEnabled(Profile* profile, bool enabled) {

bool StatsReportingController::IsEnabled() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
metrics::structured::NeutrinoDevicesLogWithLocalState(
local_state_, metrics::structured::NeutrinoDevicesLocation::kIsEnabled);
absl::optional<base::Value> value = GetValue();
return value.has_value() && value->is_bool() && value->GetBool();
}
Expand All @@ -75,11 +71,6 @@ StatsReportingController::StatsReportingController(PrefService* local_state)
kStatsReportingPref,
base::BindRepeating(&StatsReportingController::NotifyObservers,
this->as_weak_ptr()));
// AddObserver to log NeutrinoDevicesLogWithLocalState every time when
// observers are notified.
neutrino_logging_subscription_ = AddObserver(base::BindRepeating(
&metrics::structured::NeutrinoDevicesLogWithLocalState, local_state_,
metrics::structured::NeutrinoDevicesLocation::kNotifyObservers));
}

StatsReportingController::~StatsReportingController() {
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/metrics/chrome_metrics_service_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "chrome/browser/metrics/per_user_state_manager_chromeos.h"
// nogncheck needed for Lacros builds since header checker does not understand
// preprocessor.
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#endif

namespace {
Expand Down Expand Up @@ -59,11 +56,6 @@ bool ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(
// false.
if (!local_state) {
DLOG(WARNING) << "Local state has not been set and pref cannot be read";
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLog(
metrics::structured::NeutrinoDevicesLocation::
kIsMetricsAndCrashReportingEnabled);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
return false;
}

Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/metrics/chrome_metrics_services_manager_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/settings/stats_reporting_controller.h"
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#include "components/metrics/structured/neutrino_logging_util.h" // nogncheck
#include "components/metrics/structured/recorder.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

Expand Down Expand Up @@ -279,11 +277,6 @@ ChromeMetricsServicesManagerClient::GetEnabledStateProviderForTesting() {
std::unique_ptr<variations::VariationsService>
ChromeMetricsServicesManagerClient::CreateVariationsService() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithLocalState(
local_state_,
metrics::structured::NeutrinoDevicesLocation::kCreateVariationsService);
#endif
return variations::VariationsService::Create(
std::make_unique<ChromeVariationsServiceClient>(), local_state_,
GetMetricsStateManager(), switches::kDisableBackgroundNetworking,
Expand All @@ -294,11 +287,6 @@ ChromeMetricsServicesManagerClient::CreateVariationsService() {
std::unique_ptr<metrics::MetricsServiceClient>
ChromeMetricsServicesManagerClient::CreateMetricsServiceClient() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithLocalState(
local_state_, metrics::structured::NeutrinoDevicesLocation::
kCreateMetricsServiceClient);
#endif
return ChromeMetricsServiceClient::Create(GetMetricsStateManager());
}

Expand Down
31 changes: 1 addition & 30 deletions chrome/browser/metrics/metrics_reporting_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_ANDROID)
Expand Down Expand Up @@ -76,12 +75,6 @@ void SetMetricsReporting(bool to_update_pref,
g_browser_process->local_state()->SetBoolean(
metrics::prefs::kMetricsReportingEnabled, updated_pref);

#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithClientId(
g_browser_process->local_state()->GetString(
metrics::prefs::kMetricsClientID),
metrics::structured::NeutrinoDevicesLocation::kSetMetricsReporting);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
UpdateMetricsPrefsOnPermissionChange(updated_pref, called_from);

// Uses the current state of whether reporting is enabled to enable services.
Expand Down Expand Up @@ -132,13 +125,6 @@ void ChangeMetricsReportingStateWithReply(
return;
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithClientId(
g_browser_process->local_state()->GetString(
metrics::prefs::kMetricsClientID),
metrics::structured::NeutrinoDevicesLocation::
kChangeMetricsReportingStateWithReply);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
GoogleUpdateSettings::CollectStatsConsentTaskRunner()
->PostTaskAndReplyWithResult(
FROM_HERE, base::BindOnce(&SetGoogleUpdateSettings, enabled),
Expand Down Expand Up @@ -193,12 +179,6 @@ void UpdateMetricsPrefsOnPermissionChange(
UMA_HISTOGRAM_BOOLEAN("UMA.ClientIdCleared", true);

PrefService* local_state = g_browser_process->local_state();
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogClientIdCleared(
local_state->GetString(metrics::prefs::kMetricsClientID),
local_state->GetInt64(metrics::prefs::kInstallDate),
local_state->GetInt64(metrics::prefs::kMetricsReportingEnabledTimestamp));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

local_state->ClearPref(metrics::prefs::kMetricsClientID);
local_state->ClearPref(metrics::prefs::kMetricsProvisionalClientID);
Expand Down Expand Up @@ -227,16 +207,7 @@ bool IsMetricsReportingPolicyManaged() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
policy::BrowserPolicyConnectorAsh* policy_connector =
g_browser_process->platform_part()->browser_policy_connector_ash();
const bool is_managed = policy_connector->IsDeviceEnterpriseManaged();

metrics::structured::NeutrinoDevicesLogPolicy(
g_browser_process->local_state()->GetString(
metrics::prefs::kMetricsClientID),
is_managed,
metrics::structured::NeutrinoDevicesLocation::
kIsMetricsReportingPolicyManaged);

return is_managed;
return policy_connector->IsDeviceEnterpriseManaged();
#else
const PrefService* pref_service = g_browser_process->local_state();
const PrefService::Preference* pref =
Expand Down
5 changes: 0 additions & 5 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6144,11 +6144,6 @@ static_library("ui") {
"views/apps/app_dialog/shortcut_removal_dialog_view.cc",
"views/apps/app_dialog/shortcut_removal_dialog_view.h",
]

deps += [
"//components/metrics/structured:neutrino_logging",
"//components/metrics/structured:neutrino_logging_util",
]
}

if (enable_screen_ai_service) {
Expand Down
7 changes: 0 additions & 7 deletions chrome/browser/ui/views/session_crashed_bubble_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/browser_process.h"
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#include "components/metrics/structured/neutrino_logging_util.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

namespace {
Expand Down Expand Up @@ -156,11 +154,6 @@ class SessionCrashedBubbleDelegate : public ui::DialogModelDelegate {
if (dialog_model()
->GetCheckboxByUniqueId(kUmaConsentCheckboxId)
->is_checked()) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithLocalState(
g_browser_process->local_state(),
metrics::structured::NeutrinoDevicesLocation::kMaybeEnableUma);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
ChangeMetricsReportingState(true);
RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN);
}
Expand Down
7 changes: 0 additions & 7 deletions components/metrics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,6 @@ if (!is_cronet_build || is_ios) {
"//url",
]

if (is_chromeos_ash) {
deps += [
":serialization",
"//components/metrics/structured:neutrino_logging",
]
}

if (is_android) {
sources += [
"android_metrics_provider.cc",
Expand Down
11 changes: 0 additions & 11 deletions components/metrics/metrics_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@
#include "components/variations/synthetic_trial_registry.h"
#include "components/variations/synthetic_trials.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

#if !BUILDFLAG(IS_ANDROID)
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
Expand Down Expand Up @@ -511,13 +507,6 @@ void MetricsService::EnableRecording() {
}

delegating_provider_.OnRecordingEnabled();
#if BUILDFLAG(IS_CHROMEOS_ASH)
// This must be after OnRecordingEnabled() to ensure that the structured
// logging has been enabled.
metrics::structured::NeutrinoDevicesLogWithClientId(
state_manager_->client_id(),
metrics::structured::NeutrinoDevicesLocation::kEnableRecording);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Fill in the system profile in the log and persist it (to prefs, .pma
// and crashpad). This includes running the providers so that information
Expand Down
40 changes: 0 additions & 40 deletions components/metrics/metrics_state_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ class MetricsStateMetricsProvider : public MetricsProvider {
// of the previous session. This allows better attribution of crashes
// to earlier behavior. If the previous client id is unknown, leave
// the current client id.
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithClientId(
previous_client_id_, metrics::structured::NeutrinoDevicesLocation::
kProvidePreviousSessionData);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
uma_proto->set_client_id(MetricsLog::Hash(previous_client_id_));
}
}
Expand Down Expand Up @@ -278,11 +273,6 @@ MetricsStateManager::MetricsStateManager(
}

if (enabled_state_provider_->IsConsentGiven()) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
metrics::structured::NeutrinoDevicesLogWithClientId(
client_id_,
metrics::structured::NeutrinoDevicesLocation::kMetricsStateManager);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
ForceClientIdCreation();
} else {
#if BUILDFLAG(IS_ANDROID)
Expand Down Expand Up @@ -447,11 +437,6 @@ void MetricsStateManager::ForceClientIdCreation() {
if (!client_id_.empty()) {
base::UmaHistogramEnumeration("UMA.ClientIdSource",
ClientIdSource::kClientIdFromLocalState);
#if BUILDFLAG(IS_CHROMEOS_ASH)
LogClientIdChanged(
metrics::structured::NeutrinoDevicesLocation::kClientIdFromLocalState,
previous_client_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
return;
}

Expand Down Expand Up @@ -484,11 +469,6 @@ void MetricsStateManager::ForceClientIdCreation() {
ClientIdSource::kClientIdBackupRecovered);
base::UmaHistogramCounts10000("UMA.ClientIdBackupRecoveredWithAge",
recovered_installation_age.InHours());
#if BUILDFLAG(IS_CHROMEOS_ASH)
LogClientIdChanged(
metrics::structured::NeutrinoDevicesLocation::kClientIdBackupRecovered,
previous_client_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Flush the backup back to persistent storage in case we re-generated
// missing data above.
Expand All @@ -506,21 +486,11 @@ void MetricsStateManager::ForceClientIdCreation() {
client_id_ = base::Uuid::GenerateRandomV4().AsLowercaseString();
base::UmaHistogramEnumeration("UMA.ClientIdSource",
ClientIdSource::kClientIdNew);
#if BUILDFLAG(IS_CHROMEOS_ASH)
LogClientIdChanged(
metrics::structured::NeutrinoDevicesLocation::kClientIdNew,
previous_client_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
} else {
client_id_ = provisional_client_id;
local_state_->ClearPref(prefs::kMetricsProvisionalClientID);
base::UmaHistogramEnumeration("UMA.ClientIdSource",
ClientIdSource::kClientIdFromProvisionalId);
#if BUILDFLAG(IS_CHROMEOS_ASH)
LogClientIdChanged(metrics::structured::NeutrinoDevicesLocation::
kClientIdFromProvisionalId,
previous_client_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
local_state_->SetString(prefs::kMetricsClientID, client_id_);

Expand Down Expand Up @@ -728,14 +698,4 @@ bool MetricsStateManager::ShouldGenerateProvisionalClientId(bool is_first_run) {
#endif // BUILDFLAG(IS_WIN)
}

#if BUILDFLAG(IS_CHROMEOS_ASH)
void MetricsStateManager::LogClientIdChanged(
metrics::structured::NeutrinoDevicesLocation location,
std::string previous_client_id) {
metrics::structured::NeutrinoDevicesLogClientIdChanged(
client_id_, previous_client_id, ReadInstallDate(local_state_),
ReadEnabledDate(local_state_), location);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

} // namespace metrics
10 changes: 0 additions & 10 deletions components/metrics/metrics_state_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include "components/metrics/entropy_state.h"
#include "components/variations/entropy_provider.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/metrics/structured/neutrino_logging.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

class PrefService;
class PrefRegistrySimple;

Expand Down Expand Up @@ -325,12 +321,6 @@ class MetricsStateManager final {

bool ShouldGenerateProvisionalClientId(bool is_first_run);

#if BUILDFLAG(IS_CHROMEOS_ASH)
// Log to structured metrics when the client id is changed.
void LogClientIdChanged(metrics::structured::NeutrinoDevicesLocation location,
std::string previous_client_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Whether an instance of this class exists. Used to enforce that there aren't
// multiple instances of this class at a given time.
static bool instance_exists_;
Expand Down

0 comments on commit 2039b8d

Please sign in to comment.