From 4198786204fa19c041bdefe7abb91ddc193747db Mon Sep 17 00:00:00 2001 From: Travis Long Date: Tue, 11 Jul 2023 11:05:07 +0200 Subject: [PATCH] Bug 1626969: Expose `locale` through the RLB so that it can be set by consumers --- CHANGELOG.md | 3 ++- docs/user/reference/general/initializing.md | 1 + glean-core/rlb/examples/long-running.rs | 1 + glean-core/rlb/examples/prototype.rs | 1 + glean-core/rlb/src/core_metrics.rs | 4 ++++ glean-core/rlb/tests/common/mod.rs | 1 + glean-core/rlb/tests/schema.rs | 1 + samples/rust/src/main.rs | 1 + 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b317b453..e6efef47d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ * Rust * The Ping Rate Limit type is now accessible in the Rust Language Binding ([#2528](https://github.com/mozilla/glean/pull/2528)) - + * `locale` now exposed through the RLB so it can be set by consumers ([2527](https://github.com/mozilla/glean/pull/2527)) + # v53.1.0 (2023-06-28) [Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...v53.1.0) diff --git a/docs/user/reference/general/initializing.md b/docs/user/reference/general/initializing.md index ba6b59f590..4831519cc7 100644 --- a/docs/user/reference/general/initializing.md +++ b/docs/user/reference/general/initializing.md @@ -238,6 +238,7 @@ let client_info = ClientInfoMetrics { app_build: env!("CARGO_PKG_VERSION").to_string(), app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, + locale: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/examples/long-running.rs b/glean-core/rlb/examples/long-running.rs index 85d09f92e2..d71e8c67ca 100644 --- a/glean-core/rlb/examples/long-running.rs +++ b/glean-core/rlb/examples/long-running.rs @@ -65,6 +65,7 @@ fn main() { app_build: env!("CARGO_PKG_VERSION").to_string(), app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, + locale: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/examples/prototype.rs b/glean-core/rlb/examples/prototype.rs index 630638cc59..702d96631a 100644 --- a/glean-core/rlb/examples/prototype.rs +++ b/glean-core/rlb/examples/prototype.rs @@ -52,6 +52,7 @@ fn main() { app_build: env!("CARGO_PKG_VERSION").to_string(), app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, + locale: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/src/core_metrics.rs b/glean-core/rlb/src/core_metrics.rs index fd3c11f2a1..70c11fea87 100644 --- a/glean-core/rlb/src/core_metrics.rs +++ b/glean-core/rlb/src/core_metrics.rs @@ -13,6 +13,8 @@ pub struct ClientInfoMetrics { pub app_display_version: String, /// The product-provided release channel (e.g. "beta"). pub channel: Option, + /// The locale of the application during initialization (e.g. "es-ES"). + pub locale: Option, } impl ClientInfoMetrics { @@ -22,6 +24,7 @@ impl ClientInfoMetrics { app_build: "Unknown".to_string(), app_display_version: "Unknown".to_string(), channel: None, + locale: None, } } } @@ -32,6 +35,7 @@ impl From for glean_core::ClientInfoMetrics { app_build: metrics.app_build, app_display_version: metrics.app_display_version, channel: metrics.channel, + locale: metrics.locale, os_version: system::get_os_version(), windows_build_number: system::get_windows_build_number(), architecture: system::ARCH.to_string(), diff --git a/glean-core/rlb/tests/common/mod.rs b/glean-core/rlb/tests/common/mod.rs index cc02946d2c..67f010ff6b 100644 --- a/glean-core/rlb/tests/common/mod.rs +++ b/glean-core/rlb/tests/common/mod.rs @@ -45,6 +45,7 @@ pub fn initialize(cfg: Configuration) { app_build: "1.0.0".to_string(), app_display_version: "1.0.0".to_string(), channel: Some("testing".to_string()), + locale: Some("xx-XX".to_string()), }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/tests/schema.rs b/glean-core/rlb/tests/schema.rs index bdcfb84185..cba64b023f 100644 --- a/glean-core/rlb/tests/schema.rs +++ b/glean-core/rlb/tests/schema.rs @@ -84,6 +84,7 @@ fn validate_against_schema() { app_build: env!("CARGO_PKG_VERSION").to_string(), app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: Some("testing".to_string()), + locale: Some("xx-XX".to_string()), }; glean::initialize(cfg, client_info); diff --git a/samples/rust/src/main.rs b/samples/rust/src/main.rs index 57e33cf380..31a080d141 100644 --- a/samples/rust/src/main.rs +++ b/samples/rust/src/main.rs @@ -45,6 +45,7 @@ fn main() { app_build: env!("CARGO_PKG_VERSION").to_string(), app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, + locale: None, }; glean::initialize(cfg, client_info);