Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 107 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions components/places/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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 = "85d08d6bb2a32e13c31a336bf032197bf39bec99" }

[dev-dependencies]
error-support = { path = "../support/error", features = ["testing"] }
Expand All @@ -42,3 +43,4 @@ sql-support = { path = "../support/sql" }

[build-dependencies]
uniffi = { version = "0.31", features=["build"]}
glean-build = { git = "https://github.com/mozilla/glean", rev = "85d08d6bb2a32e13c31a336bf032197bf39bec99" }
8 changes: 8 additions & 0 deletions components/places/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
49 changes: 49 additions & 0 deletions components/places/metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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:
run_maintenance_time_temp:
type: timing_distribution
description: |
Time taken to execute `run_maintenance()`

Duplication of `run_maintenance_time` for glean-sys testing.
time_unit: millisecond
bugs:
- https://github.com/mozilla/application-services/issues/5115
data_reviews:
- https://github.com/mozilla/application-services/issues/5122
- https://github.com/mozilla/application-services/issues/5387
- https://github.com/mozilla/application-services/issues/5830
notification_emails:
- synced-client-integrations@mozilla.com
- bdk@mozilla.com
expires: "never"
data_sensitivity:
- technical
no_lint: [COMMON_PREFIX]

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-sys testing.
time_unit: millisecond
bugs:
- https://github.com/mozilla/application-services/issues/5246
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
notification_emails:
- synced-client-integrations@mozilla.com
- bdk@mozilla.com
expires: "never"
data_sensitivity:
- technical
no_lint: [COMMON_PREFIX]
10 changes: 9 additions & 1 deletion components/places/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// This module implement the traits that make the FFI code easier to manage.

use crate::api::matcher::{self, search_frecent, SearchParams};
use crate::glean_metrics::places_manager;
pub use crate::api::places_api::places_api_new;
pub use crate::error::{warn, Result};
pub use crate::error::{ApiResult, PlacesApiError};
Expand Down Expand Up @@ -434,7 +435,14 @@ impl PlacesConnection {
db_size_limit: u32,
prune_limit: u32,
) -> ApiResult<RunMaintenanceMetrics> {
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)]
Expand Down
5 changes: 5 additions & 0 deletions components/places/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Loading