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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we merge this with components/places/android/metrics.yaml? I'm never sure where the best place for the metrics files to live, but with the new code it feels less tied to any particular mobile platform.

However, that would mean the build.rs code would process all the metrics. Maybe its better to wait until this experiment is successful to move forward with that. I'm feeling very 50/50 on this choice.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah once we actually share the metrics we should use a single file. For now I figured it's best to keep it separate.


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]
9 changes: 8 additions & 1 deletion components/places/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -434,7 +435,13 @@ 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