Unverified Commit 93bec737 authored by Jan-Erik Rediger's avatar Jan-Erik Rediger Committed by GitHub
Browse files

Bug 2034534 - Use glean-sym to record a metric from places Rust implementation (#7336)

* Use glean-sym to record (duped) metrics from places Rust implementation

* Limit glean-sym usage to android
parent cffe8121
Loading
Loading
Loading
Loading
+106 −5
Original line number Diff line number Diff line
@@ -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"
+37 −1
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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" }
+13 −0
Original line number Diff line number Diff line
@@ -2,6 +2,19 @@
 * 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();

    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");
    }
}
+114 −0
Original line number Diff line number Diff line
# 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
Loading