From 624072b1b52c63ab88232b141abdce663eab1498 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 21 Apr 2026 15:58:30 -0400 Subject: [PATCH 1/2] Use glean-sym to record (duped) metrics from places Rust implementation --- Cargo.lock | 111 ++++++++++++++++- DEPENDENCIES.md | 38 +++++- components/places/Cargo.toml | 2 + components/places/build.rs | 8 ++ components/places/metrics.yaml | 114 ++++++++++++++++++ components/places/src/ffi.rs | 31 ++++- components/places/src/lib.rs | 5 + megazords/full/DEPENDENCIES.md | 38 +++++- .../full/android/dependency-licenses.xml | 24 ++++ megazords/ios-rust/DEPENDENCIES.md | 38 +++++- tools/dependency_summary.py | 10 ++ 11 files changed, 407 insertions(+), 12 deletions(-) create mode 100644 components/places/metrics.yaml diff --git a/Cargo.lock b/Cargo.lock index 97f7edc586..1f146fef81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -540,7 +540,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -597,7 +597,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.8.0", ] [[package]] @@ -1044,7 +1044,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.0", ] [[package]] @@ -1509,6 +1509,17 @@ dependencies = [ "instant", ] +[[package]] +name = "fd-lock" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44818c96aec5cadc9dacfb97bbcbcfc19a0de75b218412d56f57fbaab94e439" +dependencies = [ + "cfg-if", + "rustix 0.38.25", + "windows-sys 0.59.0", +] + [[package]] name = "ffi-support" version = "0.4.4" @@ -1794,6 +1805,25 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +[[package]] +name = "glean-build" +version = "19.1.0" +source = "git+https://github.com/mozilla/glean?rev=0401cd87c365fd8356e5d3bb6d72a67c8940c934#0401cd87c365fd8356e5d3bb6d72a67c8940c934" +dependencies = [ + "xshell-venv", +] + +[[package]] +name = "glean-sym" +version = "0.1.0" +source = "git+https://github.com/mozilla/glean?rev=0401cd87c365fd8356e5d3bb6d72a67c8940c934#0401cd87c365fd8356e5d3bb6d72a67c8940c934" +dependencies = [ + "libloading 0.9.0", + "once_cell", + "serde", + "uniffi", +] + [[package]] name = "glob" version = "0.3.1" @@ -2441,6 +2471,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "libloading" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + [[package]] name = "libm" version = "0.2.7" @@ -2496,6 +2536,12 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f508063cc7bb32987c71511216bd5a32be15bccb6a80b52df8b9d7f01fc3aa2" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "litemap" version = "0.8.0" @@ -3114,9 +3160,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "oneshot" @@ -3310,6 +3356,8 @@ dependencies = [ "bitflags 1.3.2", "dogear", "error-support", + "glean-build", + "glean-sym", "icu_casemap", "idna", "interrupt-support", @@ -3892,6 +3940,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustix" +version = "0.38.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +dependencies = [ + "bitflags 2.11.0", + "errno 0.3.1", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.48.0", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -5508,6 +5569,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.36.1" @@ -5545,6 +5612,15 @@ dependencies = [ "windows-targets 0.48.0", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.0" @@ -5826,6 +5902,31 @@ version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a56c84a8ccd4258aed21c92f70c0f6dea75356b6892ae27c24139da456f9336" +[[package]] +name = "xshell" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e7290c623014758632efe00737145b6867b66292c42167f2ec381eb566a373d" +dependencies = [ + "xshell-macros", +] + +[[package]] +name = "xshell-macros" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" + +[[package]] +name = "xshell-venv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7933fb25d6b9716ede532410214bbc9b0fd08aa7a7a499788ede2d2c23dc4b02" +dependencies = [ + "fd-lock", + "xshell", +] + [[package]] name = "xz2" version = "0.1.7" diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 090b9d814a..3a29810ea5 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -38,6 +38,7 @@ the details of which are reproduced below. * [MIT License: want](#mit-license-want) * [MIT License: weedle2](#mit-license-weedle2) * [MIT License: winreg](#mit-license-winreg) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: libloading](#isc-license-libloading) * [ISC License: ring](#isc-license-ring) @@ -57,6 +58,8 @@ The following text applies to code linked from these dependencies: [NSPR](https://hg.mozilla.org/projects/nspr), [NSS](https://hg.mozilla.org/projects/nss), [ece](https://github.com/mozilla/rust-ece), +[glean-build](https://github.com/mozilla/glean), +[glean-sym](https://github.com/mozilla/glean), [hawk](https://github.com/taskcluster/rust-hawk), [jexl-eval](https://github.com/mozilla/jexl-rs), [jexl-parser](https://github.com/mozilla/jexl-rs), @@ -484,6 +487,7 @@ The following text applies to code linked from these dependencies: [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), +[fd-lock](https://github.com/yoshuawuyts/fd-lock), [ffi-support](https://github.com/mozilla/ffi-support), [find-msvc-tools](https://github.com/rust-lang/cc-rs), [fnv](https://github.com/servo/rust-fnv), @@ -600,7 +604,9 @@ The following text applies to code linked from these dependencies: [windows-sys](https://github.com/microsoft/windows-rs), [windows-targets](https://github.com/microsoft/windows-rs), [windows_x86_64_gnu](https://github.com/microsoft/windows-rs), -[windows_x86_64_msvc](https://github.com/microsoft/windows-rs) +[windows_x86_64_msvc](https://github.com/microsoft/windows-rs), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License @@ -1766,6 +1772,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/components/places/Cargo.toml b/components/places/Cargo.toml index a537c44610..990da5af1b 100644 --- a/components/places/Cargo.toml +++ b/components/places/Cargo.toml @@ -32,6 +32,7 @@ sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random" thiserror = "2" anyhow = "1.0" uniffi = { version = "0.31" } +glean-sym = { git = "https://github.com/mozilla/glean", rev = "0401cd87c365fd8356e5d3bb6d72a67c8940c934" } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } @@ -40,3 +41,4 @@ sql-support = { path = "../support/sql" } [build-dependencies] uniffi = { version = "0.31", features=["build"]} +glean-build = { git = "https://github.com/mozilla/glean", rev = "0401cd87c365fd8356e5d3bb6d72a67c8940c934" } diff --git a/components/places/build.rs b/components/places/build.rs index 9889857733..deabb9fe2e 100644 --- a/components/places/build.rs +++ b/components/places/build.rs @@ -2,6 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use glean_build::Builder; + fn main() { uniffi::generate_scaffolding("./src/places.udl").unwrap(); + + Builder::default() + .file("metrics.yaml") + .format("rust_sym") + .generate() + .expect("Error generating Glean Rust bindings"); } diff --git a/components/places/metrics.yaml b/components/places/metrics.yaml new file mode 100644 index 0000000000..4d03733236 --- /dev/null +++ b/components/places/metrics.yaml @@ -0,0 +1,114 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +--- +$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 + +places_manager: + connection_initialized: + type: counter + description: | + Number of times a `PlacesConnection` was initialized. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=2034534 + data_reviews: + - https://github.com/mozilla/application-services/pull/7336 + notification_emails: + - jrediger@mozilla.com + expires: 2026-11-13 + data_sensitivity: + - technical + + run_maintenance_prune_time_temp: + type: timing_distribution + description: | + Time taken to execute `prune_older_visits()` inside `run_maintenance()` + + Duplication of `run_maintenance_prune_time` for glean-sym testing. + time_unit: millisecond + bugs: + - https://github.com/mozilla/application-services/issues/5246 + - https://bugzilla.mozilla.org/show_bug.cgi?id=2034534 + data_reviews: + - https://github.com/mozilla/application-services/issues/5247 + - https://github.com/mozilla/application-services/issues/5387 + - https://github.com/mozilla/application-services/issues/5830 + - https://github.com/mozilla/application-services/pull/7336 + notification_emails: + - synced-client-integrations@mozilla.com + - bdk@mozilla.com + - jrediger@mozilla.com + expires: 2026-11-13 + data_sensitivity: + - technical + no_lint: [COMMON_PREFIX] + + run_maintenance_vacuum_time_temp: + type: timing_distribution + description: | + Time taken to execute `VACUUM` inside `run_maintenance()` + + Duplication of `run_maintenance_vacuum_time` for glean-sym testing. + time_unit: millisecond + bugs: + - https://github.com/mozilla/application-services/issues/5246 + - https://bugzilla.mozilla.org/show_bug.cgi?id=2034534 + data_reviews: + - https://github.com/mozilla/application-services/issues/5247 + - https://github.com/mozilla/application-services/issues/5387 + - https://github.com/mozilla/application-services/issues/5830 + - https://github.com/mozilla/application-services/pull/7336 + notification_emails: + - synced-client-integrations@mozilla.com + - bdk@mozilla.com + - jrediger@mozilla.com + expires: 2026-11-13 + data_sensitivity: + - technical + + run_maintenance_optimize_time_temp: + type: timing_distribution + description: | + Time taken to execute `PRAGMA optimize` inside `run_maintenance()` + + Duplication of `run_maintenance_optimize_time` for glean-sym testing. + time_unit: millisecond + bugs: + - https://github.com/mozilla/application-services/issues/5246 + - https://bugzilla.mozilla.org/show_bug.cgi?id=2034534 + data_reviews: + - https://github.com/mozilla/application-services/issues/5247 + - https://github.com/mozilla/application-services/issues/5387 + - https://github.com/mozilla/application-services/issues/5830 + - https://github.com/mozilla/application-services/pull/7336 + notification_emails: + - synced-client-integrations@mozilla.com + - bdk@mozilla.com + - jrediger@mozilla.com + expires: 2026-11-13 + data_sensitivity: + - technical + + run_maintenance_chk_pnt_time_temp: + type: timing_distribution + description: | + Time taken to execute `PRAGMA_CHECKPOINT` inside `run_maintenance()` + + Duplication of `run_maintenance_chk_pnt_time_temp` for glean-sym testing. + time_unit: millisecond + bugs: + - https://github.com/mozilla/application-services/issues/5246 + - https://bugzilla.mozilla.org/show_bug.cgi?id=2034534 + data_reviews: + - https://github.com/mozilla/application-services/issues/5247 + - https://github.com/mozilla/application-services/issues/5387 + - https://github.com/mozilla/application-services/issues/5830 + - https://github.com/mozilla/application-services/pull/7336 + notification_emails: + - synced-client-integrations@mozilla.com + - bdk@mozilla.com + - jrediger@mozilla.com + expires: 2026-11-13 + data_sensitivity: + - technical diff --git a/components/places/src/ffi.rs b/components/places/src/ffi.rs index f5e35f645b..6ca2d177d2 100644 --- a/components/places/src/ffi.rs +++ b/components/places/src/ffi.rs @@ -8,6 +8,7 @@ use crate::api::matcher::{self, search_frecent, SearchParams}; pub use crate::api::places_api::places_api_new; pub use crate::error::{warn, Result}; pub use crate::error::{ApiResult, PlacesApiError}; +use crate::glean_metrics::places_manager; pub use crate::import::common::HistoryMigrationResult; use crate::import::import_ios_history; use crate::storage; @@ -111,6 +112,7 @@ pub struct PlacesConnection { impl PlacesConnection { pub fn new(db: PlacesDb) -> Self { + places_manager::connection_initialized.add(1); Self { interrupt_handle: db.new_interrupt_handle(), db: Mutex::new(db), @@ -384,22 +386,43 @@ impl PlacesConnection { db_size_limit: u32, prune_limit: u32, ) -> ApiResult { - self.with_conn(|conn| storage::run_maintenance_prune(conn, db_size_limit, prune_limit)) + let timer_id = places_manager::run_maintenance_prune_time_temp.start(); + let res = + self.with_conn(|conn| storage::run_maintenance_prune(conn, db_size_limit, prune_limit)); + + places_manager::run_maintenance_prune_time_temp.stop_and_accumulate(timer_id); + + res } #[handle_error(crate::Error)] pub fn run_maintenance_vacuum(&self) -> ApiResult<()> { - self.with_conn(storage::run_maintenance_vacuum) + let timer_id = places_manager::run_maintenance_vacuum_time_temp.start(); + let res = self.with_conn(storage::run_maintenance_vacuum); + + places_manager::run_maintenance_vacuum_time_temp.stop_and_accumulate(timer_id); + + res } #[handle_error(crate::Error)] pub fn run_maintenance_optimize(&self) -> ApiResult<()> { - self.with_conn(storage::run_maintenance_optimize) + let timer_id = places_manager::run_maintenance_optimize_time_temp.start(); + let res = self.with_conn(storage::run_maintenance_optimize); + + places_manager::run_maintenance_optimize_time_temp.stop_and_accumulate(timer_id); + + res } #[handle_error(crate::Error)] pub fn run_maintenance_checkpoint(&self) -> ApiResult<()> { - self.with_conn(storage::run_maintenance_checkpoint) + let timer_id = places_manager::run_maintenance_chk_pnt_time_temp.start(); + let res = self.with_conn(storage::run_maintenance_checkpoint); + + places_manager::run_maintenance_chk_pnt_time_temp.stop_and_accumulate(timer_id); + + res } #[handle_error(crate::Error)] diff --git a/components/places/src/lib.rs b/components/places/src/lib.rs index 3e7ff3df5c..432ce70113 100644 --- a/components/places/src/lib.rs +++ b/components/places/src/lib.rs @@ -38,4 +38,9 @@ pub use crate::types::*; pub use ffi::*; +#[allow(clippy::all)] // Don't lint generated code. +pub mod glean_metrics { + include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs")); +} + uniffi::include_scaffolding!("places"); diff --git a/megazords/full/DEPENDENCIES.md b/megazords/full/DEPENDENCIES.md index 7274c2cd75..51308b5637 100644 --- a/megazords/full/DEPENDENCIES.md +++ b/megazords/full/DEPENDENCIES.md @@ -25,6 +25,7 @@ the details of which are reproduced below. * [MIT License: textwrap](#mit-license-textwrap) * [MIT License: tracing, tracing-attributes, tracing-core, tracing-subscriber](#mit-license-tracing-tracing-attributes-tracing-core-tracing-subscriber) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: libloading](#isc-license-libloading) * [ISC License: ring](#isc-license-ring) @@ -42,6 +43,8 @@ The following text applies to code linked from these dependencies: [NSPR](https://hg.mozilla.org/projects/nspr), [NSS](https://hg.mozilla.org/projects/nss), [ece](https://github.com/mozilla/rust-ece), +[glean-build](https://github.com/mozilla/glean), +[glean-sym](https://github.com/mozilla/glean), [hawk](https://github.com/taskcluster/rust-hawk), [jexl-eval](https://github.com/mozilla/jexl-rs), [jexl-parser](https://github.com/mozilla/jexl-rs), @@ -468,6 +471,7 @@ The following text applies to code linked from these dependencies: [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), +[fd-lock](https://github.com/yoshuawuyts/fd-lock), [ffi-support](https://github.com/mozilla/ffi-support), [find-msvc-tools](https://github.com/rust-lang/cc-rs), [form_urlencoded](https://github.com/servo/rust-url), @@ -555,7 +559,9 @@ The following text applies to code linked from these dependencies: [windows-sys](https://github.com/microsoft/windows-rs), [windows-targets](https://github.com/microsoft/windows-rs), [windows_x86_64_gnu](https://github.com/microsoft/windows-rs), -[windows_x86_64_msvc](https://github.com/microsoft/windows-rs) +[windows_x86_64_msvc](https://github.com/microsoft/windows-rs), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License @@ -1323,6 +1329,36 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/megazords/full/android/dependency-licenses.xml b/megazords/full/android/dependency-licenses.xml index 6a924e8d33..0ab0fc177e 100644 --- a/megazords/full/android/dependency-licenses.xml +++ b/megazords/full/android/dependency-licenses.xml @@ -16,6 +16,14 @@ the details of which are reproduced below. Mozilla Public License 2.0: ece https://github.com/mozilla/rust-ece/blob/main/LICENSE + + Mozilla Public License 2.0: glean-build + https://github.com/mozilla/glean/blob/main/LICENSE + + + Mozilla Public License 2.0: glean-sym + https://github.com/mozilla/glean/blob/main/LICENSE + Mozilla Public License 2.0: hawk https://github.com/taskcluster/rust-hawk/blob/main/LICENSE @@ -196,6 +204,10 @@ the details of which are reproduced below. Apache License 2.0: fastrand https://github.com/smol-rs/fastrand/blob/master/LICENSE-APACHE + + Apache License 2.0: fd-lock + https://github.com/yoshuawuyts/fd-lock/blob/master/LICENSE-APACHE + Apache License 2.0: ffi-support https://raw.githubusercontent.com/mozilla/ffi-support/main/LICENSE-APACHE @@ -548,6 +560,14 @@ the details of which are reproduced below. Apache License 2.0: windows_x86_64_msvc https://github.com/microsoft/windows-rs/blob/master/license-mit + + Apache License 2.0: xshell + https://github.com/matklad/xshell/blob/master/LICENSE-APACHE + + + Apache License 2.0: xshell-macros + https://github.com/matklad/xshell/blob/master/LICENSE-APACHE + MIT License: aho-corasick https://github.com/BurntSushi/aho-corasick/blob/master/LICENSE-MIT @@ -652,6 +672,10 @@ the details of which are reproduced below. MIT License: weedle2 https://github.com/mozilla/uniffi-rs/blob/main/weedle2/LICENSE.md + + MIT License: xshell-venv + https://github.com/badboy/xshell-venv/blob/main/LICENSE + CC0-1.0 License: base16 https://github.com/thomcc/rust-base16/blob/master/LICENSE-APACHE diff --git a/megazords/ios-rust/DEPENDENCIES.md b/megazords/ios-rust/DEPENDENCIES.md index d95d96790a..274549548c 100644 --- a/megazords/ios-rust/DEPENDENCIES.md +++ b/megazords/ios-rust/DEPENDENCIES.md @@ -35,6 +35,7 @@ the details of which are reproduced below. * [MIT License: try-lock](#mit-license-try-lock) * [MIT License: want](#mit-license-want) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: libloading](#isc-license-libloading) * [ISC License: ring](#isc-license-ring) @@ -52,6 +53,8 @@ The following text applies to code linked from these dependencies: [NSPR](https://hg.mozilla.org/projects/nspr), [NSS](https://hg.mozilla.org/projects/nss), [ece](https://github.com/mozilla/rust-ece), +[glean-build](https://github.com/mozilla/glean), +[glean-sym](https://github.com/mozilla/glean), [hawk](https://github.com/taskcluster/rust-hawk), [jexl-eval](https://github.com/mozilla/jexl-rs), [jexl-parser](https://github.com/mozilla/jexl-rs), @@ -477,6 +480,7 @@ The following text applies to code linked from these dependencies: [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), +[fd-lock](https://github.com/yoshuawuyts/fd-lock), [ffi-support](https://github.com/mozilla/ffi-support), [find-msvc-tools](https://github.com/rust-lang/cc-rs), [fnv](https://github.com/servo/rust-fnv), @@ -578,7 +582,9 @@ The following text applies to code linked from these dependencies: [utf8_iter](https://github.com/hsivonen/utf8_iter), [uuid](https://github.com/uuid-rs/uuid), [vcpkg](https://github.com/mcgoo/vcpkg-rs), -[version_check](https://github.com/SergioBenitez/version_check) +[version_check](https://github.com/SergioBenitez/version_check), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License @@ -1666,6 +1672,36 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/tools/dependency_summary.py b/tools/dependency_summary.py index 6dae4f2153..3e9dfddd91 100755 --- a/tools/dependency_summary.py +++ b/tools/dependency_summary.py @@ -718,6 +718,16 @@ "fixup": "https://raw.githubusercontent.com/mozilla/glean/main/LICENSE", }, }, + "glean-sym": { + "license_url": { + "check": None, + "fixup": "https://github.com/mozilla/glean/blob/main/LICENSE", + }, + "license_file": { + "check": None, + "fixup": "https://raw.githubusercontent.com/mozilla/glean/main/LICENSE", + }, + }, "lmdb-rkv-sys": { "license_url": { "check": None, From f7ed050211f65932629ca93cfe076e583ca00a1d Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 13 May 2026 14:39:34 +0200 Subject: [PATCH 2/2] Limit glean-sym usage to android --- components/places/build.rs | 15 ++++++++++----- components/places/src/ffi.rs | 11 +++++++++++ components/places/src/lib.rs | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/components/places/build.rs b/components/places/build.rs index deabb9fe2e..fa4b5578a1 100644 --- a/components/places/build.rs +++ b/components/places/build.rs @@ -7,9 +7,14 @@ use glean_build::Builder; fn main() { uniffi::generate_scaffolding("./src/places.udl").unwrap(); - Builder::default() - .file("metrics.yaml") - .format("rust_sym") - .generate() - .expect("Error generating Glean Rust bindings"); + if let Ok("android") = std::env::var("CARGO_CFG_TARGET_OS") + .as_ref() + .map(String::as_str) + { + Builder::default() + .file("metrics.yaml") + .format("rust_sym") + .generate() + .expect("Error generating Glean Rust bindings"); + } } diff --git a/components/places/src/ffi.rs b/components/places/src/ffi.rs index 6ca2d177d2..492a0c2761 100644 --- a/components/places/src/ffi.rs +++ b/components/places/src/ffi.rs @@ -8,6 +8,7 @@ use crate::api::matcher::{self, search_frecent, SearchParams}; pub use crate::api::places_api::places_api_new; pub use crate::error::{warn, Result}; pub use crate::error::{ApiResult, PlacesApiError}; +#[cfg(target_os = "android")] use crate::glean_metrics::places_manager; pub use crate::import::common::HistoryMigrationResult; use crate::import::import_ios_history; @@ -112,7 +113,9 @@ pub struct PlacesConnection { impl PlacesConnection { pub fn new(db: PlacesDb) -> Self { + #[cfg(target_os = "android")] places_manager::connection_initialized.add(1); + Self { interrupt_handle: db.new_interrupt_handle(), db: Mutex::new(db), @@ -386,10 +389,12 @@ impl PlacesConnection { db_size_limit: u32, prune_limit: u32, ) -> ApiResult { + #[cfg(target_os = "android")] let timer_id = places_manager::run_maintenance_prune_time_temp.start(); let res = self.with_conn(|conn| storage::run_maintenance_prune(conn, db_size_limit, prune_limit)); + #[cfg(target_os = "android")] places_manager::run_maintenance_prune_time_temp.stop_and_accumulate(timer_id); res @@ -397,9 +402,11 @@ impl PlacesConnection { #[handle_error(crate::Error)] pub fn run_maintenance_vacuum(&self) -> ApiResult<()> { + #[cfg(target_os = "android")] let timer_id = places_manager::run_maintenance_vacuum_time_temp.start(); let res = self.with_conn(storage::run_maintenance_vacuum); + #[cfg(target_os = "android")] places_manager::run_maintenance_vacuum_time_temp.stop_and_accumulate(timer_id); res @@ -407,9 +414,11 @@ impl PlacesConnection { #[handle_error(crate::Error)] pub fn run_maintenance_optimize(&self) -> ApiResult<()> { + #[cfg(target_os = "android")] let timer_id = places_manager::run_maintenance_optimize_time_temp.start(); let res = self.with_conn(storage::run_maintenance_optimize); + #[cfg(target_os = "android")] places_manager::run_maintenance_optimize_time_temp.stop_and_accumulate(timer_id); res @@ -417,9 +426,11 @@ impl PlacesConnection { #[handle_error(crate::Error)] pub fn run_maintenance_checkpoint(&self) -> ApiResult<()> { + #[cfg(target_os = "android")] let timer_id = places_manager::run_maintenance_chk_pnt_time_temp.start(); let res = self.with_conn(storage::run_maintenance_checkpoint); + #[cfg(target_os = "android")] places_manager::run_maintenance_chk_pnt_time_temp.stop_and_accumulate(timer_id); res diff --git a/components/places/src/lib.rs b/components/places/src/lib.rs index 432ce70113..e6e3499ba3 100644 --- a/components/places/src/lib.rs +++ b/components/places/src/lib.rs @@ -38,6 +38,7 @@ pub use crate::types::*; pub use ffi::*; +#[cfg(target_os = "android")] #[allow(clippy::all)] // Don't lint generated code. pub mod glean_metrics { include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs"));