From ab7a08b61e58d1a50565cb892f3402cebafbcf16 Mon Sep 17 00:00:00 2001 From: jessicag Date: Fri, 11 Mar 2016 14:34:49 -0800 Subject: Add support for Blimp engine metrics reporting in development. Currently there is no way of recording or reporting metrics for the Blimp engine. To collect metrics for the Blimp engine in development two things are required. First, for metrics recording and reporting to be enabled on the Blimp engine. Second, for the metrics logging to flag Blimp engine reports so they can be filtered from other linux metrics reports. These code behavior changes are currently kept between a single build arg, but are controlled via separate defines checks. These changes will allow metrics to be collected on development instances of Blimp and viewed separately from Linux builds. BUG=592757 Review URL: https://codereview.chromium.org/1765293002 Cr-Commit-Position: refs/heads/master@{#380760} --- build/args/blimp_engine.gn | 3 ++- chrome/browser/browser_process_impl.cc | 8 ++++++++ components/metrics/BUILD.gn | 14 ++++++++++++++ components/metrics/metrics_log.cc | 5 +++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/build/args/blimp_engine.gn b/build/args/blimp_engine.gn index b78ba7a..ef990cd60 100644 --- a/build/args/blimp_engine.gn +++ b/build/args/blimp_engine.gn @@ -9,9 +9,10 @@ use_aura = true use_ozone = true +metrics_use_blimp = true # Not available within docker container. use_alsa = false use_pulseaudio = false use_cups = false -use_glib = false \ No newline at end of file +use_glib = false diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index d1b356c..5110d02 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -853,8 +853,16 @@ void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterStringPref(prefs::kHardwareKeyboardLayout, std::string()); #endif // defined(OS_CHROMEOS) + +#if defined(ENABLE_REPORTING_BLIMP) + // Enables reporting for the (headless) blimp engine. Defined in + // components/metrics/BUILD.gn + registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, true); +#else registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, GoogleUpdateSettings::GetCollectStatsConsent()); +#endif // defined(ENABLE_REPORTING_HEADLESS) + #if BUILDFLAG(ANDROID_JAVA_UI) registry->RegisterBooleanPref( prefs::kCrashReportingEnabled, false); diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn index 6130dd5..c49e4a3 100644 --- a/components/metrics/BUILD.gn +++ b/components/metrics/BUILD.gn @@ -2,6 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +declare_args() { + # Overrides os name in uma metrics log to "Blimp". + metrics_use_blimp = false +} + # GYP version: components/metrics.gypi:metrics source_set("metrics") { sources = [ @@ -347,5 +352,14 @@ source_set("unit_tests") { if (is_chromeos) { deps += [ ":leak_detector_unit_tests" ] } + + # These are only used by the blimp team, which has entirely migrated to gn, + # so this logic is not replicated in the gyp file. + if (metrics_use_blimp) { + defines = [ + "OVERRIDE_OS_NAME_TO_BLIMP", + "ENABLE_REPORTING_BLIMP", + ] + } } # TODO(GYP): metrics_chromeos diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc index 9777412..f0bf415 100644 --- a/components/metrics/metrics_log.cc +++ b/components/metrics/metrics_log.cc @@ -325,9 +325,14 @@ void MetricsLog::RecordEnvironment( hardware->set_dll_base(reinterpret_cast(&__ImageBase)); #endif +#if defined(OVERRIDE_OS_NAME_TO_BLIMP) + os->set_name("Blimp"); +#else SystemProfileProto::OS* os = system_profile->mutable_os(); std::string os_name = base::SysInfo::OperatingSystemName(); os->set_name(os_name); +#endif + os->set_version(base::SysInfo::OperatingSystemVersion()); #if defined(OS_ANDROID) os->set_fingerprint( -- cgit v1.1