diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d77e8fe03..c83cfc6a36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Rust * Add support for determining `client_info.os_version` for Android binaries ([#3434](https://github.com/mozilla/glean/pull/3434)) + * `client_info.os_version` can now be set by the application. If unset Glean still uses the auto-detection ([#3419](https://github.com/mozilla/glean/pull/3419)) # v67.2.0 (2026-04-06) diff --git a/docs/user/reference/general/initializing.md b/docs/user/reference/general/initializing.md index 6a2edd50f4..a552ea0897 100644 --- a/docs/user/reference/general/initializing.md +++ b/docs/user/reference/general/initializing.md @@ -251,6 +251,7 @@ let client_info = ClientInfoMetrics { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, // auto-detected }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/crashing-threads.rs b/glean-core/rlb-tests/src/bin/crashing-threads.rs index 1840689c18..e76734d9b1 100644 --- a/glean-core/rlb-tests/src/bin/crashing-threads.rs +++ b/glean-core/rlb-tests/src/bin/crashing-threads.rs @@ -123,6 +123,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/delayed-ping-data.rs b/glean-core/rlb-tests/src/bin/delayed-ping-data.rs index 4be459dcb1..cfa5fcc94a 100644 --- a/glean-core/rlb-tests/src/bin/delayed-ping-data.rs +++ b/glean-core/rlb-tests/src/bin/delayed-ping-data.rs @@ -115,6 +115,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/enabled-pings.rs b/glean-core/rlb-tests/src/bin/enabled-pings.rs index d94ee87cda..aeb8134e37 100644 --- a/glean-core/rlb-tests/src/bin/enabled-pings.rs +++ b/glean-core/rlb-tests/src/bin/enabled-pings.rs @@ -160,6 +160,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/long-running.rs b/glean-core/rlb-tests/src/bin/long-running.rs index 6f0b8ae7ed..a9065e1815 100644 --- a/glean-core/rlb-tests/src/bin/long-running.rs +++ b/glean-core/rlb-tests/src/bin/long-running.rs @@ -74,6 +74,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/mps-delay.rs b/glean-core/rlb-tests/src/bin/mps-delay.rs index d4114fcef5..be034966be 100644 --- a/glean-core/rlb-tests/src/bin/mps-delay.rs +++ b/glean-core/rlb-tests/src/bin/mps-delay.rs @@ -126,6 +126,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb-tests/src/bin/pending-gets-removed.rs b/glean-core/rlb-tests/src/bin/pending-gets-removed.rs index b802fe38d0..46c285b379 100644 --- a/glean-core/rlb-tests/src/bin/pending-gets-removed.rs +++ b/glean-core/rlb-tests/src/bin/pending-gets-removed.rs @@ -141,6 +141,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; // Ensure this ping is always registered early. diff --git a/glean-core/rlb-tests/src/bin/ping-lifetime-flush.rs b/glean-core/rlb-tests/src/bin/ping-lifetime-flush.rs index eeceaa8358..f1a79e373d 100644 --- a/glean-core/rlb-tests/src/bin/ping-lifetime-flush.rs +++ b/glean-core/rlb-tests/src/bin/ping-lifetime-flush.rs @@ -118,6 +118,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/examples/frequent-events.rs b/glean-core/rlb/examples/frequent-events.rs index 3fcd145c4e..8ba6d7110a 100644 --- a/glean-core/rlb/examples/frequent-events.rs +++ b/glean-core/rlb/examples/frequent-events.rs @@ -96,6 +96,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/glean-core/rlb/examples/prototype.rs b/glean-core/rlb/examples/prototype.rs index a74a75ca50..424d05dc79 100644 --- a/glean-core/rlb/examples/prototype.rs +++ b/glean-core/rlb/examples/prototype.rs @@ -66,6 +66,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: 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 70c11fea87..e749745398 100644 --- a/glean-core/rlb/src/core_metrics.rs +++ b/glean-core/rlb/src/core_metrics.rs @@ -15,6 +15,8 @@ pub struct ClientInfoMetrics { pub channel: Option, /// The locale of the application during initialization (e.g. "es-ES"). pub locale: Option, + /// The user-visible version of the operating system (e.g. "1.2.3"). + pub os_version: Option, } impl ClientInfoMetrics { @@ -25,6 +27,7 @@ impl ClientInfoMetrics { app_display_version: "Unknown".to_string(), channel: None, locale: None, + os_version: None, } } } @@ -36,7 +39,7 @@ impl From for glean_core::ClientInfoMetrics { app_display_version: metrics.app_display_version, channel: metrics.channel, locale: metrics.locale, - os_version: system::get_os_version(), + os_version: metrics.os_version.unwrap_or_else(system::get_os_version), windows_build_number: system::get_windows_build_number(), architecture: system::ARCH.to_string(), ..Default::default() diff --git a/glean-core/rlb/tests/collection_enabled.rs b/glean-core/rlb/tests/collection_enabled.rs index 7ecfe2bad0..f32a34fb9c 100644 --- a/glean-core/rlb/tests/collection_enabled.rs +++ b/glean-core/rlb/tests/collection_enabled.rs @@ -114,6 +114,7 @@ fn nofollows_contains_client_info_when_collection_disabled() { app_display_version: "1.0.0".to_string(), channel: Some("testing".to_string()), locale: Some("xx-XX".to_string()), + os_version: None, }; glean::test_reset_glean(cfg, client_info, false); diff --git a/glean-core/rlb/tests/collection_enabled_bin.rs b/glean-core/rlb/tests/collection_enabled_bin.rs index 7d83ad11d7..ec59e701d9 100644 --- a/glean-core/rlb/tests/collection_enabled_bin.rs +++ b/glean-core/rlb/tests/collection_enabled_bin.rs @@ -112,6 +112,7 @@ fn nofollows_contains_client_info_when_collection_disabled() { app_display_version: "1.0.0".to_string(), channel: Some("testing".to_string()), locale: Some("xx-XX".to_string()), + os_version: None, }; glean::test_reset_glean(cfg, client_info, false); diff --git a/glean-core/rlb/tests/common/mod.rs b/glean-core/rlb/tests/common/mod.rs index c261666e02..828b543072 100644 --- a/glean-core/rlb/tests/common/mod.rs +++ b/glean-core/rlb/tests/common/mod.rs @@ -46,6 +46,7 @@ pub fn initialize(cfg: Configuration) { app_display_version: "1.0.0".to_string(), channel: Some("testing".to_string()), locale: Some("xx-XX".to_string()), + os_version: None, }; _ = PingBuilder::new("store1").with_send_if_empty(true).build(); diff --git a/glean-core/rlb/tests/schema.rs b/glean-core/rlb/tests/schema.rs index 893fb7c4d5..abc2d6fdce 100644 --- a/glean-core/rlb/tests/schema.rs +++ b/glean-core/rlb/tests/schema.rs @@ -83,6 +83,7 @@ fn validate_against_schema() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: Some("testing".to_string()), locale: Some("xx-XX".to_string()), + os_version: None, }; glean::initialize(cfg, client_info); diff --git a/samples/rapid-metrics/src/main.rs b/samples/rapid-metrics/src/main.rs index 430d05c2b1..ceaa80dacb 100644 --- a/samples/rapid-metrics/src/main.rs +++ b/samples/rapid-metrics/src/main.rs @@ -78,6 +78,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; _ = &*glean_metrics::prototype; diff --git a/samples/rust/src/main.rs b/samples/rust/src/main.rs index 8e08f1cdf5..b36a594f71 100644 --- a/samples/rust/src/main.rs +++ b/samples/rust/src/main.rs @@ -111,6 +111,7 @@ fn main() { app_display_version: env!("CARGO_PKG_VERSION").to_string(), channel: None, locale: None, + os_version: None, }; _ = &*glean_metrics::prototype;