From c584a1fb190b38c9eba5a28a15c04e673817630a Mon Sep 17 00:00:00 2001 From: Joel Martinez Date: Wed, 19 Jul 2023 10:58:41 -0600 Subject: [PATCH] Add some INFO logging to telemetry (#970) * Add some INFO logging to telemetry Useful for debugging b/280094891 * clang-format fixes b/280094891 --- cobalt/browser/application.cc | 10 +++++++--- .../browser/metrics/cobalt_metrics_services_manager.cc | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cobalt/browser/application.cc b/cobalt/browser/application.cc index 9f81b5f8d46a..e6febfe5c74c 100644 --- a/cobalt/browser/application.cc +++ b/cobalt/browser/application.cc @@ -1512,9 +1512,9 @@ void Application::InitMetrics() { // it's enabled or upload interval. bool is_metrics_enabled = persistent_settings_->GetPersistentSettingAsBool( metrics::kMetricEnabledSettingName, false); - metrics_services_manager_->SetUploadInterval( - persistent_settings_->GetPersistentSettingAsInt( - metrics::kMetricEventIntervalSettingName, 300)); + auto metric_event_interval = persistent_settings_->GetPersistentSettingAsInt( + metrics::kMetricEventIntervalSettingName, 300); + metrics_services_manager_->SetUploadInterval(metric_event_interval); metrics_services_manager_->ToggleMetricsEnabled(is_metrics_enabled); // Metric recording state initialization _must_ happen before we bootstrap // otherwise we crash. @@ -1523,6 +1523,10 @@ void Application::InitMetrics() { // UpdateUploadPermissions bootstraps the whole metric reporting, scheduling, // and uploading cycle. metrics_services_manager_->UpdateUploadPermissions(is_metrics_enabled); + LOG(INFO) + << "Cobalt Telemetry initialized with settings: is_metrics_enabled: " + << is_metrics_enabled + << ", metric_event_interval: " << metric_event_interval; } } // namespace browser diff --git a/cobalt/browser/metrics/cobalt_metrics_services_manager.cc b/cobalt/browser/metrics/cobalt_metrics_services_manager.cc index 3874d08b6eca..acb5d8bd2c63 100644 --- a/cobalt/browser/metrics/cobalt_metrics_services_manager.cc +++ b/cobalt/browser/metrics/cobalt_metrics_services_manager.cc @@ -16,6 +16,7 @@ #include +#include "base/logging.h" #include "cobalt/browser/metrics/cobalt_metrics_service_client.h" #include "cobalt/browser/metrics/cobalt_metrics_services_manager_client.h" #include "components/metrics_services_manager/metrics_services_manager.h" @@ -56,6 +57,7 @@ void CobaltMetricsServicesManager::SetOnUploadHandlerInternal( static_cast(GetMetricsServiceClient()); DCHECK(client); client->SetOnUploadHandler(uploader_callback); + LOG(INFO) << "New Cobalt Telemetry metric upload handler bound."; } void CobaltMetricsServicesManager::ToggleMetricsEnabled(bool is_enabled) { @@ -73,6 +75,7 @@ void CobaltMetricsServicesManager::ToggleMetricsEnabledInternal( client->GetEnabledStateProvider()->SetConsentGiven(is_enabled); client->GetEnabledStateProvider()->SetReportingEnabled(is_enabled); UpdateUploadPermissions(is_enabled); + LOG(INFO) << "Cobalt Telemetry enabled state toggled to: " << is_enabled; } void CobaltMetricsServicesManager::SetUploadInterval( @@ -90,6 +93,8 @@ void CobaltMetricsServicesManager::SetUploadIntervalInternal( GetMetricsServiceClient()); DCHECK(client); client->SetUploadInterval(interval_seconds); + LOG(INFO) << "Cobalt Telemetry metric upload interval changed to: " + << interval_seconds; }