Merge mozilla-central to autoland.

This commit is contained in:
Cosmin Sabou 2024-05-28 03:22:14 +03:00
commit b4905d99cb
38 changed files with 204 additions and 217 deletions

8
Cargo.lock generated
View file

@ -2374,9 +2374,9 @@ dependencies = [
[[package]]
name = "glean"
version = "60.2.0"
version = "60.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "047fc0c40fa7743eead09622e9966c6fd0c0ff8d6815ad876f471a8017691b28"
checksum = "17dbdd29dcae47b7f8fae9378ae7bf17be18b902cbb490341af2f4d04ead6bbf"
dependencies = [
"glean-core",
"inherent",
@ -2387,9 +2387,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "60.2.0"
version = "60.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ca0b0a7e75a80a2db3ac59b2ccea826e54e1bcb54889711e1c4ed6821bb5f9"
checksum = "99bf32010135ab5b1db37fff66096d08b9df4e9dd94c881aa0774df61c122fdf"
dependencies = [
"android_logger",
"bincode",

8
gfx/wr/Cargo.lock generated
View file

@ -996,9 +996,9 @@ dependencies = [
[[package]]
name = "glean"
version = "60.2.0"
version = "60.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "047fc0c40fa7743eead09622e9966c6fd0c0ff8d6815ad876f471a8017691b28"
checksum = "17dbdd29dcae47b7f8fae9378ae7bf17be18b902cbb490341af2f4d04ead6bbf"
dependencies = [
"glean-core",
"inherent",
@ -1009,9 +1009,9 @@ dependencies = [
[[package]]
name = "glean-core"
version = "60.2.0"
version = "60.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ca0b0a7e75a80a2db3ac59b2ccea826e54e1bcb54889711e1c4ed6821bb5f9"
checksum = "99bf32010135ab5b1db37fff66096d08b9df4e9dd94c881aa0774df61c122fdf"
dependencies = [
"android_logger",
"bincode",

View file

@ -52,7 +52,7 @@ svg_fmt = "0.4"
tracy-rs = "0.1.2"
derive_more = { version = "0.99", default-features = false, features = ["add_assign"] }
etagere = "0.2.6"
glean = { version = "60.2.0", optional = true }
glean = { version = "60.1.0", optional = true }
firefox-on-glean = { version = "0.1.0", optional = true }
swgl = { path = "../swgl", optional = true }
topological-sort = "0.1"

View file

@ -25,7 +25,7 @@ tracy-rs = "0.1.2"
log = "0.4"
lazy_static = "1"
fxhash = "0.2.1"
glean = { version = "60.2.0", optional = true }
glean = { version = "60.1.0", optional = true }
firefox-on-glean = { version = "0.1.0", optional = true }
serde = { optional = true, version = "1.0", features = ["serde_derive"] }

View file

@ -19,7 +19,7 @@ object Versions {
const val serialization = "1.6.3"
const val python_envs_plugin = "0.0.31"
const val mozilla_glean = "60.2.0"
const val mozilla_glean = "60.1.0"
const val junit = "4.13.2"
const val robolectric = "4.12.1"

View file

@ -96,7 +96,7 @@ vendored:third_party/python/wheel
vendored:third_party/python/zipp
# glean-sdk may not be installable if a wheel isn't available
# and it has to be built from source.
pypi-optional:glean-sdk==60.2.0:telemetry will not be collected
pypi-optional:glean-sdk==60.1.0:telemetry will not be collected
# Mach gracefully handles the case where `psutil` is unavailable.
# We aren't (yet) able to pin packages in automation, so we have to
# support down to the oldest locally-installed version (5.4.2).

View file

@ -440,6 +440,14 @@ criteria = "safe-to-deploy"
version = "2.7.0"
criteria = "safe-to-deploy"
[[exemptions.fuchsia-zircon]]
version = "0.3.3"
criteria = "safe-to-run"
[[exemptions.fuchsia-zircon-sys]]
version = "0.3.3"
criteria = "safe-to-run"
[[exemptions.futures-macro]]
version = "0.3.21"
criteria = "safe-to-deploy"
@ -576,10 +584,22 @@ criteria = "safe-to-deploy"
version = "0.8.0"
criteria = "safe-to-deploy"
[[exemptions.mio-extras]]
version = "2.0.6"
criteria = "safe-to-run"
[[exemptions.miow]]
version = "0.3.7"
criteria = "safe-to-run"
[[exemptions.murmurhash3]]
version = "0.0.5"
criteria = "safe-to-deploy"
[[exemptions.net2]]
version = "0.2.37"
criteria = "safe-to-run"
[[exemptions.nix]]
version = "0.15.0"
criteria = "safe-to-deploy"
@ -596,6 +616,14 @@ criteria = "safe-to-deploy"
version = "1.12.0"
criteria = "safe-to-deploy"
[[exemptions.owning_ref]]
version = "0.4.1"
criteria = "safe-to-deploy"
[[exemptions.packed_simd]]
version = "0.3.8"
criteria = "safe-to-deploy"
[[exemptions.phf]]
version = "0.10.1"
criteria = "safe-to-deploy"

View file

@ -226,15 +226,15 @@ user-login = "jrmuizel"
user-name = "Jeff Muizelaar"
[[publisher.glean]]
version = "60.2.0"
when = "2024-05-23"
version = "60.1.0"
when = "2024-05-06"
user-id = 48
user-login = "badboy"
user-name = "Jan-Erik Rediger"
[[publisher.glean-core]]
version = "60.2.0"
when = "2024-05-23"
version = "60.1.0"
when = "2024-05-06"
user-id = 48
user-login = "badboy"
user-name = "Jan-Erik Rediger"
@ -351,6 +351,13 @@ user-id = 72814
user-login = "gabrielesvelto"
user-name = "Gabriele Svelto"
[[publisher.mio]]
version = "0.6.21"
when = "2019-11-27"
user-id = 10
user-login = "carllerche"
user-name = "Carl Lerche"
[[publisher.nss-gk-api]]
version = "0.3.0"
when = "2023-06-14"
@ -699,18 +706,36 @@ user-id = 1
user-login = "alexcrichton"
user-name = "Alex Crichton"
[[publisher.wasm-encoder]]
version = "0.201.0"
when = "2024-02-27"
user-id = 73222
user-login = "wasmtime-publish"
[[publisher.wasm-encoder]]
version = "0.205.0"
when = "2024-04-18"
user-id = 73222
user-login = "wasmtime-publish"
[[publisher.wasm-smith]]
version = "0.201.0"
when = "2024-02-27"
user-id = 73222
user-login = "wasmtime-publish"
[[publisher.wasm-smith]]
version = "0.205.0"
when = "2024-04-18"
user-id = 73222
user-login = "wasmtime-publish"
[[publisher.wast]]
version = "201.0.0"
when = "2024-02-27"
user-id = 73222
user-login = "wasmtime-publish"
[[publisher.wast]]
version = "205.0.0"
when = "2024-04-18"
@ -1026,6 +1051,12 @@ criteria = "safe-to-deploy"
version = "0.4.6"
notes = "provides a datastructure implemented using std's Vec. all uses of unsafe are just delegating to the underlying unsafe Vec methods."
[[audits.bytecode-alliance.audits.socket2]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
delta = "0.4.7 -> 0.4.9"
notes = "Minor OS compat updates but otherwise nothing major here."
[[audits.bytecode-alliance.audits.tempfile]]
who = "Pat Hickey <phickey@fastly.com>"
criteria = "safe-to-deploy"

File diff suppressed because one or more lines are too long

View file

@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.66"
name = "glean-core"
version = "60.2.0"
version = "60.1.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",

View file

@ -121,7 +121,6 @@ where
/// enable_event_timestamps: true,
/// experimentation_id: None,
/// enable_internal_pings: true,
/// ping_schedule: Default::default(),
/// };
/// let mut glean = Glean::new(cfg).unwrap();
/// let ping = PingType::new("sample", true, false, true, true, true, vec![], vec![]);
@ -165,7 +164,6 @@ pub struct Glean {
pub(crate) remote_settings_epoch: AtomicU8,
pub(crate) remote_settings_config: Arc<Mutex<RemoteSettingsConfig>>,
pub(crate) with_timestamps: bool,
pub(crate) ping_schedule: HashMap<String, Vec<String>>,
}
impl Glean {
@ -226,7 +224,6 @@ impl Glean {
remote_settings_epoch: AtomicU8::new(0),
remote_settings_config: Arc::new(Mutex::new(RemoteSettingsConfig::new())),
with_timestamps: cfg.enable_event_timestamps,
ping_schedule: cfg.ping_schedule.clone(),
};
// Ensuring these pings are registered.
@ -328,7 +325,6 @@ impl Glean {
enable_event_timestamps: true,
experimentation_id: None,
enable_internal_pings,
ping_schedule: Default::default(),
};
let mut glean = Self::new(cfg).unwrap();

View file

@ -91,7 +91,6 @@ dictionary InternalConfiguration {
boolean enable_event_timestamps;
string? experimentation_id;
boolean enable_internal_pings;
record<string, sequence<string>> ping_schedule;
};
// How to specify the rate pings may be uploaded before they are throttled.

View file

@ -137,10 +137,6 @@ pub struct InternalConfiguration {
pub experimentation_id: Option<String>,
/// Whether to enable internal pings. Default: true
pub enable_internal_pings: bool,
/// A ping schedule map.
/// Maps a ping name to a list of pings to schedule along with it.
/// Only used if the ping's own ping schedule list is empty.
pub ping_schedule: HashMap<String, Vec<String>>,
}
/// How to specify the rate at which pings may be uploaded before they are throttled.

View file

@ -198,7 +198,6 @@ fn experimentation_id_is_set_correctly() {
enable_event_timestamps: true,
experimentation_id: Some(experimentation_id.to_string()),
enable_internal_pings: true,
ping_schedule: Default::default(),
})
.unwrap();

View file

@ -283,25 +283,7 @@ impl PingType {
ping.name
);
if ping.schedules_pings.is_empty() {
let ping_schedule = glean
.ping_schedule
.get(ping.name)
.map(|v| &v[..])
.unwrap_or(&[]);
if !ping_schedule.is_empty() {
log::info!(
"The ping '{}' is being used to schedule other pings: {:?}",
ping.name,
ping_schedule
);
for scheduled_ping_name in ping_schedule {
glean.submit_ping_by_name(scheduled_ping_name, reason);
}
}
} else {
if !ping.schedules_pings.is_empty() {
log::info!(
"The ping '{}' is being used to schedule other pings: {:?}",
ping.name,

View file

@ -64,7 +64,6 @@ pub fn new_glean(tempdir: Option<tempfile::TempDir>) -> (Glean, tempfile::TempDi
enable_event_timestamps: false,
experimentation_id: None,
enable_internal_pings: true,
ping_schedule: Default::default(),
};
let glean = Glean::new(cfg).unwrap();

View file

@ -486,7 +486,6 @@ fn with_event_timestamps() {
enable_event_timestamps: true,
experimentation_id: None, // Enabling event timestamps
enable_internal_pings: true,
ping_schedule: Default::default(),
};
let glean = Glean::new(cfg).unwrap();

View file

@ -92,7 +92,6 @@ fn test_metrics_must_report_experimentation_id() {
enable_event_timestamps: true,
experimentation_id: Some("test-experimentation-id".to_string()),
enable_internal_pings: true,
ping_schedule: Default::default(),
})
.unwrap();
let ping_maker = PingMaker::new();
@ -146,7 +145,6 @@ fn experimentation_id_is_removed_if_send_if_empty_is_false() {
enable_event_timestamps: true,
experimentation_id: Some("test-experimentation-id".to_string()),
enable_internal_pings: true,
ping_schedule: Default::default(),
})
.unwrap();
let ping_maker = PingMaker::new();

View file

@ -1 +1 @@
{"files":{"Cargo.toml":"9d9a3aa1c1cdeeb56a4dd46e353c91ecd4e7652720354ec9cb9f9fa3062b9b32","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"de47b53dcca37985c0a2b8c02daecbf32309aa54f5a4dd9290719c2c1fd0fa55","src/configuration.rs":"b205a3aa2f86d583417fc9d2938383ea078c110fa7862753575e190251e44cd9","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"340b5af4de60028a4c8d169f031b895527b2cd0a3c81ab2ae97e67d4c149dd7d","src/net/http_uploader.rs":"01ad5bd91384411a12c74434cd1c5cd585078cb34faba4615c70bdb669a9bccb","src/net/mod.rs":"f47b96bb878f1a6c771cedbaeaeefb270bc87fb1d1bbbed1b282dddca16216ed","src/private/event.rs":"d7c70c02648584c19c73af89e5180d3c6153c911f2c6830f7d1599b18d6150eb","src/private/mod.rs":"3565eb569d2b96f938f130abe0fc3ee3f55e7e03fd6501e309d3ef6af72ef6ee","src/private/object.rs":"3f70363a196aea46cc163af025a53e48c117c6208babc4bce772bb4c337cced8","src/private/ping.rs":"31d33d7f661a7a17ccb69351328700b4d7b80024d1e128f406c3534f9d163475","src/system.rs":"6eae5b41c15eba9cad6dbd116abe3519ee3e1fe034e79bdd692b029829a8c384","src/test.rs":"83ed92df360398fed53d58923b425e3d4275027179a9c76d8c1203ec3b62969d","tests/common/mod.rs":"08fb9483d9b6ed9fe873b4395245166ae8a15263be750c7a8e298c41d9604745","tests/init_fails.rs":"46d7064bba9386c3065635434e17ac9212c6c2236b3cd12bd985fc3229e659a3","tests/never_init.rs":"7a6e8a011fbd945f2544f204367eeceff3f6039c99d98799477e3b2352ae6227","tests/no_time_to_init.rs":"4a5bdddc2f8226d2ad17038229e8767a6dd195977af49527fbb84a9f6b0154bb","tests/overflowing_preinit.rs":"7ad4b2274dd9240b53430859a4eb1d2597cf508a5a678333f3d3abbadd2ed4a7","tests/persist_ping_lifetime.rs":"81415dc1d74743f02269f0d0dfa524003147056853f080276972e64a0b761d3c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"dde65bce8a715ca3bd9c54b2466d831dd5e0d559e0773fe7657827f22a66bb44","tests/simple.rs":"1835b5df6f76ff894b45805bd54eaab23ca2d9d2b0694ec64af3aa6132baf30e","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"8d5ed070754e09fbe55183bb2792ae6e234a95770e39397caf05e4ec4d6015db","tests/timing_distribution_single_sample.rs":"fddf2f13f1620a8808029d250a64e4c822828bf80b4bb4f9e3b645ab70643f9b","tests/upload_timing.rs":"6a97aa355d808123af0914ffecf1da0ecb2cc441c95c63c600b14f97ce0d45a0"},"package":"047fc0c40fa7743eead09622e9966c6fd0c0ff8d6815ad876f471a8017691b28"}
{"files":{"Cargo.toml":"78a1972b9bbfcd28816592f60f1a504adcfd041936ce5d0fec3e0788391c784a","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"de47b53dcca37985c0a2b8c02daecbf32309aa54f5a4dd9290719c2c1fd0fa55","src/configuration.rs":"27075b12236021c54d0c99427bcbd417933ca02545275604d3c13f32ca25af13","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"3a43c992275f06c4189ffc9ca0775fe840b5598c2f6a39504aea3ae5df43fa23","src/net/http_uploader.rs":"01ad5bd91384411a12c74434cd1c5cd585078cb34faba4615c70bdb669a9bccb","src/net/mod.rs":"f47b96bb878f1a6c771cedbaeaeefb270bc87fb1d1bbbed1b282dddca16216ed","src/private/event.rs":"d7c70c02648584c19c73af89e5180d3c6153c911f2c6830f7d1599b18d6150eb","src/private/mod.rs":"3565eb569d2b96f938f130abe0fc3ee3f55e7e03fd6501e309d3ef6af72ef6ee","src/private/object.rs":"3f70363a196aea46cc163af025a53e48c117c6208babc4bce772bb4c337cced8","src/private/ping.rs":"31d33d7f661a7a17ccb69351328700b4d7b80024d1e128f406c3534f9d163475","src/system.rs":"6eae5b41c15eba9cad6dbd116abe3519ee3e1fe034e79bdd692b029829a8c384","src/test.rs":"39dd7468dcdaf17593b8b07970ced25c07cbd76853aaef2532fdcad0281a21d3","tests/common/mod.rs":"08fb9483d9b6ed9fe873b4395245166ae8a15263be750c7a8e298c41d9604745","tests/init_fails.rs":"46d7064bba9386c3065635434e17ac9212c6c2236b3cd12bd985fc3229e659a3","tests/never_init.rs":"7a6e8a011fbd945f2544f204367eeceff3f6039c99d98799477e3b2352ae6227","tests/no_time_to_init.rs":"4a5bdddc2f8226d2ad17038229e8767a6dd195977af49527fbb84a9f6b0154bb","tests/overflowing_preinit.rs":"7ad4b2274dd9240b53430859a4eb1d2597cf508a5a678333f3d3abbadd2ed4a7","tests/persist_ping_lifetime.rs":"81415dc1d74743f02269f0d0dfa524003147056853f080276972e64a0b761d3c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"dde65bce8a715ca3bd9c54b2466d831dd5e0d559e0773fe7657827f22a66bb44","tests/simple.rs":"1835b5df6f76ff894b45805bd54eaab23ca2d9d2b0694ec64af3aa6132baf30e","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"8d5ed070754e09fbe55183bb2792ae6e234a95770e39397caf05e4ec4d6015db","tests/timing_distribution_single_sample.rs":"fddf2f13f1620a8808029d250a64e4c822828bf80b4bb4f9e3b645ab70643f9b","tests/upload_timing.rs":"6a97aa355d808123af0914ffecf1da0ecb2cc441c95c63c600b14f97ce0d45a0"},"package":"17dbdd29dcae47b7f8fae9378ae7bf17be18b902cbb490341af2f4d04ead6bbf"}

View file

@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.66"
name = "glean"
version = "60.2.0"
version = "60.1.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@ -35,7 +35,7 @@ license = "MPL-2.0"
repository = "https://github.com/mozilla/glean"
[dependencies.glean-core]
version = "60.2.0"
version = "60.1.0"
[dependencies.inherent]
version = "1"

View file

@ -6,7 +6,6 @@ use log::LevelFilter;
use crate::net::PingUploader;
use std::collections::HashMap;
use std::path::PathBuf;
/// The default server pings are sent to.
@ -49,10 +48,6 @@ pub struct Configuration {
pub experimentation_id: Option<String>,
/// Whether to enable internal pings. Default: true
pub enable_internal_pings: bool,
/// A ping schedule map.
/// Maps a ping name to a list of pings to schedule along with it.
/// Only used if the ping's own ping schedule list is empty.
pub ping_schedule: HashMap<String, Vec<String>>,
}
/// Configuration builder.
@ -101,10 +96,6 @@ pub struct Builder {
pub experimentation_id: Option<String>,
/// Whether to enable internal pings. Default: true
pub enable_internal_pings: bool,
/// A ping schedule map.
/// Maps a ping name to a list of pings to schedule along with it.
/// Only used if the ping's own ping schedule list is empty.
pub ping_schedule: HashMap<String, Vec<String>>,
}
impl Builder {
@ -129,7 +120,6 @@ impl Builder {
enable_event_timestamps: true,
experimentation_id: None,
enable_internal_pings: true,
ping_schedule: HashMap::new(),
}
}
@ -150,7 +140,6 @@ impl Builder {
enable_event_timestamps: self.enable_event_timestamps,
experimentation_id: self.experimentation_id,
enable_internal_pings: self.enable_internal_pings,
ping_schedule: self.ping_schedule,
}
}
@ -207,10 +196,4 @@ impl Builder {
self.enable_internal_pings = value;
self
}
/// Set the ping schedule map.
pub fn with_ping_schedule(mut self, value: HashMap<String, Vec<String>>) -> Self {
self.ping_schedule = value;
self
}
}

View file

@ -123,7 +123,6 @@ fn initialize_internal(cfg: Configuration, client_info: ClientInfoMetrics) -> Op
enable_event_timestamps: cfg.enable_event_timestamps,
experimentation_id: cfg.experimentation_id,
enable_internal_pings: cfg.enable_internal_pings,
ping_schedule: cfg.ping_schedule,
};
glean_core::glean_initialize(core_cfg, client_info.into(), callbacks);

View file

@ -1423,51 +1423,3 @@ fn configure_ping_throttling() {
// `seconds_per_interval` before running the next test, since shutting down
// will wait for the queue to clear.
}
#[test]
fn pings_ride_along_builtin_pings() {
let _lock = lock_test();
// Define a fake uploader that reports back the submission headers
// using a crossbeam channel.
let (s, r) = crossbeam_channel::bounded::<String>(3);
#[derive(Debug)]
pub struct FakeUploader {
sender: crossbeam_channel::Sender<String>,
}
impl net::PingUploader for FakeUploader {
fn upload(&self, upload_request: net::PingUploadRequest) -> net::UploadResult {
self.sender.send(upload_request.url).unwrap();
net::UploadResult::http_status(200)
}
}
let _ride_along_ping =
private::PingType::new("ride-along", true, true, true, true, true, vec![], vec![]);
// Create a custom configuration to use a fake uploader.
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let ping_schedule = HashMap::from([("baseline".to_string(), vec!["ride-along".to_string()])]);
let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
.with_server_endpoint("invalid-test-host")
.with_uploader(FakeUploader { sender: s })
.with_ping_schedule(ping_schedule)
.build();
let _t = new_glean(Some(cfg), true);
// Simulate becoming active.
handle_client_active();
// We expect a baseline ping to be generated here (reason: 'active').
let url = r.recv().unwrap();
assert!(url.contains("baseline"));
// We expect a ride-along ping to ride along.
let url = r.recv().unwrap();
assert!(url.contains("ride-along"));
}

View file

@ -6,7 +6,7 @@ edition = "2018"
license = "MPL-2.0"
[dependencies]
glean = "60.2.0"
glean = "60.1.0"
log = "0.4"
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }

View file

@ -9,7 +9,7 @@ license = "MPL-2.0"
[dependencies]
bincode = "1.0"
chrono = "0.4.10"
glean = "60.2.0"
glean = "60.1.0"
inherent = "1.0.0"
log = "0.4"
nsstring = { path = "../../../../xpcom/rust/nsstring", optional = true }

View file

@ -29,7 +29,22 @@ fn setup_glean(tempdir: Option<tempfile::TempDir>) -> tempfile::TempDir {
};
let tmpname = dir.path().to_path_buf();
let cfg = glean::ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID).build();
let cfg = glean::Configuration {
upload_enabled: true,
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.into(),
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: None,
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
log_level: None,
rate_limit: None,
enable_event_timestamps: false,
experimentation_id: None,
enable_internal_pings: true,
};
let client_info = glean::ClientInfoMetrics {
app_build: "test-build".into(),

View file

@ -11,7 +11,7 @@ use crate::ipc::need_ipc;
/// See [Glean Pings](https://mozilla.github.io/glean/book/user/pings/index.html).
#[derive(Clone)]
pub enum Ping {
Parent(glean::private::PingType),
Parent(glean::private::PingType, String),
Child,
}
@ -39,16 +39,19 @@ impl Ping {
Ping::Child
} else {
let name = name.into();
Ping::Parent(glean::private::PingType::new(
name.clone(),
include_client_id,
send_if_empty,
precise_timestamps,
include_info_sections,
enabled,
schedules_pings,
reason_codes,
))
Ping::Parent(
glean::private::PingType::new(
name.clone(),
include_client_id,
send_if_empty,
precise_timestamps,
include_info_sections,
enabled,
schedules_pings,
reason_codes,
),
name,
)
}
}
@ -62,7 +65,7 @@ impl Ping {
/// `send_if_empty` is `false`).
pub fn test_before_next_submit(&self, cb: impl FnOnce(Option<&str>) + Send + 'static) {
match self {
Ping::Parent(p) => p.test_before_next_submit(cb),
Ping::Parent(p, _) => p.test_before_next_submit(cb),
Ping::Child => {
panic!("Cannot use ping test API from non-parent process!");
}
@ -80,8 +83,9 @@ impl glean::traits::Ping for Ping {
/// `ping_info.reason` part of the payload.
pub fn submit(&self, reason: Option<&str>) {
match self {
Ping::Parent(p) => {
Ping::Parent(p, name) => {
p.submit(reason);
crate::pings::schedule_pings(&name, reason);
}
Ping::Child => {
log::error!(

View file

@ -54,18 +54,35 @@ pub fn register_pings(application_id: Option<&str>) {
}
}
/// Map from pings to the pings scheduled along with them.
/// Schedule pings alongside a parent ping.
///
/// Should be called in `submit` of the parent ping
/// to also submit pings that should ride along.
///
/// # Arguments
///
/// `submitted_ping`: The parent ping that is submitted
/// `reason`: The original reason for the submitted ping.
/// Will be used for the ride-along ping too.
#[doc(hidden)]
pub fn ping_schedule() -> std::collections::HashMap<String, Vec<String>> {
std::collections::HashMap::from([
{% for ping, schedule in ping_schedule_reverse_map.items() %}
(
{{ ping|rust }},
{{ schedule|rust }}
),
{% endfor %}
])
pub fn schedule_pings(submitted_ping: &str, reason: Option<&str>) {
{% if ping_schedule_reverse_map|length %}
match submitted_ping {
{% for ping, schedule in ping_schedule_reverse_map.items() %}
"{{ping}}" => {
log::info!("Submitting pings {{ schedule|join(', ') }} along with {{ping}}");
{% for ping_name in schedule %}
let _ = {{ ping_name|snake_case }}.submit(reason);
{% endfor %}
},
{% endfor %}
_ => {},
}
{% else %}
// Ignore arguments.
_ = submitted_ping;
_ = reason;
{% endif %}
}
#[cfg(feature = "with_gecko")]

View file

@ -189,7 +189,6 @@ fn build_configuration(
enable_event_timestamps: true,
experimentation_id: None,
enable_internal_pings: true,
ping_schedule: pings::ping_schedule(),
};
Ok((configuration, client_info))

View file

@ -493,3 +493,6 @@ TEST_F(FOGFixture, TestRustInGTest) { Rust_TestRustInGTest(); }
extern "C" void Rust_TestJogfile();
TEST_F(FOGFixture, TestJogfile) { Rust_TestJogfile(); }
extern "C" void Rust_TestRideAlongPing();
TEST_F(FOGFixture, TestRustRideAlongPing) { Rust_TestRideAlongPing(); }

View file

@ -1,8 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
extern crate firefox_on_glean;
use firefox_on_glean::metrics;
use firefox_on_glean::{metrics, pings};
extern crate nsstring;
use nsstring::nsString;
@ -53,3 +56,33 @@ pub extern "C" fn Rust_TestJogfile() {
// If it can't, that's perhaps a sign that the inner workings need to be updated.
expect!(jog::jog_load_jogfile(&nsString::from("jogfile_output")));
}
#[no_mangle]
pub extern "C" fn Rust_TestRideAlongPing() {
// A similar test exists in `xpcshell/test_Glean.js`.
// But here we can test that the `test_before_next_submit` callback
// is correctly called.
let test_submitted = Arc::new(AtomicBool::new(false));
let ride_along_submitted = Arc::new(AtomicBool::new(false));
{
let test_submitted = Arc::clone(&test_submitted);
pings::test_ping.test_before_next_submit(move |_reason| {
test_submitted.store(true, Ordering::Release);
});
}
{
let ride_along_submitted = Arc::clone(&ride_along_submitted);
pings::ride_along_ping.test_before_next_submit(move |_reason| {
ride_along_submitted.store(true, Ordering::Release);
});
}
// Submit only a single ping, the other will ride along.
pings::test_ping.submit(None);
expect!(test_submitted.load(Ordering::Acquire));
expect!(ride_along_submitted.load(Ordering::Acquire));
}

View file

@ -370,16 +370,6 @@
true,
[],
[]
],
[
"ridealong-test",
false,
true,
true,
true,
true,
[],
[]
]
]
}

View file

@ -130,18 +130,3 @@ not-ohttp:
notification_emails:
- chutten@mozilla.com
- glean-team@mozilla.com
ridealong-test:
description: >
A fake ping to test ride-along
include_client_id: false
metadata:
ping_schedule:
- baseline
send_if_empty: true
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1897219
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1897219
notification_emails:
- glean-team@mozilla.com

View file

@ -99,21 +99,6 @@ pub static not_ohttp: Lazy<Ping> = Lazy::new(|| {
)
});
#[allow(non_upper_case_globals)]
/// A fake ping to test ride-along
pub static ridealong_test: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"ridealong-test",
false,
true,
true,
true,
true,
vec![],
vec![],
)
});
/// Instantiate custom pings once to trigger registration.
///
@ -130,21 +115,25 @@ pub fn register_pings(application_id: Option<&str>) {
let _ = &*not_events;
let _ = &*not_metrics;
let _ = &*not_ohttp;
let _ = &*ridealong_test;
}
}
}
/// Map from pings to the pings scheduled along with them.
/// Schedule pings alongside a parent ping.
///
/// Should be called in `submit` of the parent ping
/// to also submit pings that should ride along.
///
/// # Arguments
///
/// `submitted_ping`: The parent ping that is submitted
/// `reason`: The original reason for the submitted ping.
/// Will be used for the ride-along ping too.
#[doc(hidden)]
pub fn ping_schedule() -> std::collections::HashMap<String, Vec<String>> {
std::collections::HashMap::from([
(
"baseline".into(),
vec!["ridealong-test".into()]
),
])
pub fn schedule_pings(submitted_ping: &str, reason: Option<&str>) {
// Ignore arguments.
_ = submitted_ping;
_ = reason;
}
#[cfg(feature = "with_gecko")]
@ -167,7 +156,6 @@ pub(crate) fn submit_ping_by_id(id: u32, reason: Option<&str>) {
3 => not_events.submit(reason),
4 => not_metrics.submit(reason),
5 => not_ohttp.submit(reason),
6 => ridealong_test.submit(reason),
_ => {
// TODO: instrument this error.
log::error!("Cannot submit unknown ping {} by id.", id);

View file

@ -63,13 +63,6 @@ constexpr glean::impl::Ping NotMetrics(4);
*/
constexpr glean::impl::Ping NotOhttp(5);
/*
* Generated from ridealong-test.
*
* A fake ping to test ride-along
*/
constexpr glean::impl::Ping RidealongTest(6);
} // namespace mozilla::glean_pings

View file

@ -34,18 +34,16 @@ constexpr char gPingStringTable[] = {
/* 31 - "notEvents" */ 'n', 'o', 't', 'E', 'v', 'e', 'n', 't', 's', '\0',
/* 41 - "notMetrics" */ 'n', 'o', 't', 'M', 'e', 't', 'r', 'i', 'c', 's', '\0',
/* 52 - "notOhttp" */ 'n', 'o', 't', 'O', 'h', 't', 't', 'p', '\0',
/* 61 - "ridealongTest" */ 'r', 'i', 'd', 'e', 'a', 'l', 'o', 'n', 'g', 'T', 'e', 's', 't', '\0',
};
const ping_entry_t sPingByNameLookupEntries[] = {
393277,
131084,
196639,
262185,
65536,
327732,
65536
262185,
131084,
196639
};
@ -72,7 +70,7 @@ PingByNameLookup(const nsACString& aKey)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -92,10 +90,10 @@ PingByNameLookup(const nsACString& aKey)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -112,7 +110,7 @@ PingByNameLookup(const nsACString& aKey)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View file

@ -28,6 +28,6 @@ const char* GetPingName(ping_entry_t aEntry);
*/
Maybe<uint32_t> PingByNameLookup(const nsACString&);
extern const ping_entry_t sPingByNameLookupEntries[6];
extern const ping_entry_t sPingByNameLookupEntries[5];
} // namespace mozilla::glean
#endif // mozilla_GleanJSPingsLookup_h

View file

@ -630,7 +630,8 @@ add_task(async function test_fog_complex_object_works() {
});
add_task(
// FIXME(1898464): ride-along pings are not handled correctly in artifact builds.
// FIXME(1897219): Should be re-enabled along with the newer implementation.
// ride-along pings are not handled correctly in artifact builds.
{
skip_if: () =>
Services.prefs.getBoolPref("telemetry.fog.artifact_build", false),