Skip to content

Commit

Permalink
Surface the extended stable channel in metrics::SystemProfileProto.
Browse files Browse the repository at this point in the history
The new is_extended_stable_channel bool field is set to true for clients
that follow updates on the extended stable update channel.

Bug: 1185621
Change-Id: Ic81466d2d790ddee3f4b9d1b015dca935bfbc939
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752467
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#863204}
  • Loading branch information
GregTho authored and Chromium LUCI CQ committed Mar 16, 2021
1 parent f30f5c1 commit 942e601
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chrome/browser/metrics/chrome_metrics_service_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() {
return metrics::AsProtobufChannel(chrome::GetChannel());
}

bool ChromeMetricsServiceClient::IsExtendedStableChannel() {
return chrome::IsExtendedStableChannel();
}

std::string ChromeMetricsServiceClient::GetVersionString() {
return metrics::GetVersionString();
}
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/metrics/chrome_metrics_service_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
std::string GetApplicationLocale() override;
bool GetBrand(std::string* brand_code) override;
metrics::SystemProfileProto::Channel GetChannel() override;
bool IsExtendedStableChannel() override;
std::string GetVersionString() override;
void OnEnvironmentUpdate(std::string* serialized_environment) override;
void CollectFinalMetricsForLog(base::OnceClosure done_callback) override;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/startup_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void StartupData::RecordCoreSystemProfile() {
metrics::MetricsLog::RecordCoreSystemProfile(
metrics::GetVersionString(),
metrics::AsProtobufChannel(chrome::GetChannel()),
chrome::IsExtendedStableChannel(),
chrome_feature_list_creator_->actual_locale(),
metrics::GetAppPackageName(), &system_profile);

Expand Down
4 changes: 4 additions & 0 deletions chromecast/metrics/cast_metrics_service_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ ::metrics::SystemProfileProto::Channel CastMetricsServiceClient::GetChannel() {
#endif // defined(OS_ANDROID) || defined(OS_FUCHSIA)
}

bool CastMetricsServiceClient::IsExtendedStableChannel() {
return false; // Not supported on Chromecast.
}

std::string CastMetricsServiceClient::GetVersionString() {
int build_number;
if (!base::StringToInt(CAST_BUILD_INCREMENTAL, &build_number))
Expand Down
1 change: 1 addition & 0 deletions chromecast/metrics/cast_metrics_service_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class CastMetricsServiceClient : public ::metrics::MetricsServiceClient,
std::string GetApplicationLocale() override;
bool GetBrand(std::string* brand_code) override;
::metrics::SystemProfileProto::Channel GetChannel() override;
bool IsExtendedStableChannel() override;
std::string GetVersionString() override;
void CollectFinalMetricsForLog(base::OnceClosure done_callback) override;
GURL GetMetricsServerUrl() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ SystemProfileProto::Channel AndroidMetricsServiceClient::GetChannel() {
return AsProtobufChannel(version_info::android::GetChannel());
}

bool AndroidMetricsServiceClient::IsExtendedStableChannel() {
return false; // Not supported on AndroidMetricsServiceClients.
}

std::string AndroidMetricsServiceClient::GetVersionString() {
return metrics::GetVersionString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class AndroidMetricsServiceClient : public MetricsServiceClient,
std::string GetApplicationLocale() override;
bool GetBrand(std::string* brand_code) override;
SystemProfileProto::Channel GetChannel() override;
bool IsExtendedStableChannel() override;
std::string GetVersionString() override;
void CollectFinalMetricsForLog(
const base::OnceClosure done_callback) override;
Expand Down
4 changes: 4 additions & 0 deletions components/metrics/metrics_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ void MetricsLog::RecordUserAction(const std::string& key,
void MetricsLog::RecordCoreSystemProfile(MetricsServiceClient* client,
SystemProfileProto* system_profile) {
RecordCoreSystemProfile(client->GetVersionString(), client->GetChannel(),
client->IsExtendedStableChannel(),
client->GetApplicationLocale(),
client->GetAppPackageName(), system_profile);

Expand All @@ -195,12 +196,15 @@ void MetricsLog::RecordCoreSystemProfile(MetricsServiceClient* client,
void MetricsLog::RecordCoreSystemProfile(
const std::string& version,
metrics::SystemProfileProto::Channel channel,
bool is_extended_stable_channel,
const std::string& application_locale,
const std::string& package_name,
SystemProfileProto* system_profile) {
system_profile->set_build_timestamp(metrics::MetricsLog::GetBuildTime());
system_profile->set_app_version(version);
system_profile->set_channel(channel);
if (is_extended_stable_channel)
system_profile->set_is_extended_stable_channel(true);
system_profile->set_application_locale(application_locale);

#if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON()
Expand Down
1 change: 1 addition & 0 deletions components/metrics/metrics_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class MetricsLog {
static void RecordCoreSystemProfile(
const std::string& version,
metrics::SystemProfileProto::Channel channel,
bool is_extended_stable_channel,
const std::string& application_locale,
const std::string& package_name,
SystemProfileProto* system_profile);
Expand Down
3 changes: 3 additions & 0 deletions components/metrics/metrics_service_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class MetricsServiceClient {
// Returns the release channel (e.g. stable, beta, etc) of the application.
virtual SystemProfileProto::Channel GetChannel() = 0;

// Returns true if the application is on the extended stable channel.
virtual bool IsExtendedStableChannel() = 0;

// Returns the version of the application as a string.
virtual std::string GetVersionString() = 0;

Expand Down
4 changes: 4 additions & 0 deletions components/metrics/test/test_metrics_service_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ SystemProfileProto::Channel TestMetricsServiceClient::GetChannel() {
return SystemProfileProto::CHANNEL_BETA;
}

bool TestMetricsServiceClient::IsExtendedStableChannel() {
return false;
}

std::string TestMetricsServiceClient::GetVersionString() {
return version_string_;
}
Expand Down
1 change: 1 addition & 0 deletions components/metrics/test/test_metrics_service_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TestMetricsServiceClient : public MetricsServiceClient {
std::string GetApplicationLocale() override;
bool GetBrand(std::string* brand_code) override;
SystemProfileProto::Channel GetChannel() override;
bool IsExtendedStableChannel() override;
std::string GetVersionString() override;
void CollectFinalMetricsForLog(base::OnceClosure done_callback) override;
std::unique_ptr<MetricsLogUploader> CreateUploader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class IOSChromeMetricsServiceClient : public IncognitoWebStateObserver,
std::string GetApplicationLocale() override;
bool GetBrand(std::string* brand_code) override;
metrics::SystemProfileProto::Channel GetChannel() override;
bool IsExtendedStableChannel() override;
std::string GetVersionString() override;
void CollectFinalMetricsForLog(base::OnceClosure done_callback) override;
std::unique_ptr<metrics::MetricsLogUploader> CreateUploader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ void GetNetworkConnectionTrackerAsync(
return metrics::AsProtobufChannel(::GetChannel());
}

bool IOSChromeMetricsServiceClient::IsExtendedStableChannel() {
return false; // Not supported on iOS.
}

std::string IOSChromeMetricsServiceClient::GetVersionString() {
return metrics::GetVersionString();
}
Expand Down

0 comments on commit 942e601

Please sign in to comment.