Bug 1878375 - Synchronize vendored Rust libraries with mozilla-central. r=darktrojan
mozilla-central: 00f574fb9f0cde95935f22084807dc7bd60eae84 comm-central: baf3acadc707839386367ca525a3db9373a5bab9 Differential Revision: https://phabricator.services.mozilla.com/D211795 --HG-- extra : amend_source : 22625a5ede39350d139052ad3366613905c54f63
This commit is contained in:
Родитель
ec132c456b
Коммит
f50804ead6
|
@ -2149,9 +2149,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "glean"
|
||||
version = "60.1.0"
|
||||
version = "60.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17dbdd29dcae47b7f8fae9378ae7bf17be18b902cbb490341af2f4d04ead6bbf"
|
||||
checksum = "047fc0c40fa7743eead09622e9966c6fd0c0ff8d6815ad876f471a8017691b28"
|
||||
dependencies = [
|
||||
"glean-core",
|
||||
"inherent",
|
||||
|
@ -2162,9 +2162,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "glean-core"
|
||||
version = "60.1.0"
|
||||
version = "60.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99bf32010135ab5b1db37fff66096d08b9df4e9dd94c881aa0774df61c122fdf"
|
||||
checksum = "30ca0b0a7e75a80a2db3ac59b2ccea826e54e1bcb54889711e1c4ed6821bb5f9"
|
||||
dependencies = [
|
||||
"android_logger",
|
||||
"bincode",
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"mc_workspace_toml": "f1ce18006dbf908d8c7444f4bb796d0958b2492c79c7831b510a1093250eca426596d3f0ca27355a7e885e0c93179f8205a2ccc738ee0031c63b09b60e089c00", "mc_gkrust_toml": "63065de10ae7b60f6a36ae337c06879fc727ec58f881a5e9f08d0fd18a22dbe49c55a562f27bd7a3c44489e6be8d4a20a00cab12fa622e001a10d11a1267f7cc", "mc_cargo_lock": "fb1df8fb8b5bd6187dc786fc2af5fb9dd4bb44666b6ef51088fc91e50f2b244009cd176d75b1dc345cb3afe7464fc9aca1fa0ab244fdf10481582d7a1e27e705"}
|
||||
{"mc_workspace_toml": "f1ce18006dbf908d8c7444f4bb796d0958b2492c79c7831b510a1093250eca426596d3f0ca27355a7e885e0c93179f8205a2ccc738ee0031c63b09b60e089c00", "mc_gkrust_toml": "63065de10ae7b60f6a36ae337c06879fc727ec58f881a5e9f08d0fd18a22dbe49c55a562f27bd7a3c44489e6be8d4a20a00cab12fa622e001a10d11a1267f7cc", "mc_cargo_lock": "b3aad1b4a16be441d8a71c0735dc3af950c098787bf4d844feea03b3adfd559c23b8f7c2653045ddffae9c36d3699ac1e2c3d964ece7da1fa2205f63f3a09742"}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -13,7 +13,7 @@
|
|||
edition = "2021"
|
||||
rust-version = "1.66"
|
||||
name = "glean-core"
|
||||
version = "60.1.0"
|
||||
version = "60.2.0"
|
||||
authors = [
|
||||
"Jan-Erik Rediger <jrediger@mozilla.com>",
|
||||
"The Glean Team <glean-team@mozilla.com>",
|
||||
|
|
|
@ -121,6 +121,7 @@ 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![]);
|
||||
|
@ -164,6 +165,7 @@ 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 {
|
||||
|
@ -224,6 +226,7 @@ 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.
|
||||
|
@ -325,6 +328,7 @@ impl Glean {
|
|||
enable_event_timestamps: true,
|
||||
experimentation_id: None,
|
||||
enable_internal_pings,
|
||||
ping_schedule: Default::default(),
|
||||
};
|
||||
|
||||
let mut glean = Self::new(cfg).unwrap();
|
||||
|
|
|
@ -91,6 +91,7 @@ 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.
|
||||
|
|
|
@ -137,6 +137,10 @@ 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.
|
||||
|
|
|
@ -198,6 +198,7 @@ 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();
|
||||
|
||||
|
|
|
@ -283,7 +283,25 @@ impl PingType {
|
|||
ping.name
|
||||
);
|
||||
|
||||
if !ping.schedules_pings.is_empty() {
|
||||
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 {
|
||||
log::info!(
|
||||
"The ping '{}' is being used to schedule other pings: {:?}",
|
||||
ping.name,
|
||||
|
|
|
@ -64,6 +64,7 @@ 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();
|
||||
|
||||
|
|
|
@ -486,6 +486,7 @@ 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();
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ 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();
|
||||
|
@ -145,6 +146,7 @@ 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();
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"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"}
|
||||
{"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"}
|
|
@ -13,7 +13,7 @@
|
|||
edition = "2021"
|
||||
rust-version = "1.66"
|
||||
name = "glean"
|
||||
version = "60.1.0"
|
||||
version = "60.2.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.1.0"
|
||||
version = "60.2.0"
|
||||
|
||||
[dependencies.inherent]
|
||||
version = "1"
|
||||
|
|
|
@ -6,6 +6,7 @@ use log::LevelFilter;
|
|||
|
||||
use crate::net::PingUploader;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// The default server pings are sent to.
|
||||
|
@ -48,6 +49,10 @@ 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.
|
||||
|
@ -96,6 +101,10 @@ 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 {
|
||||
|
@ -120,6 +129,7 @@ impl Builder {
|
|||
enable_event_timestamps: true,
|
||||
experimentation_id: None,
|
||||
enable_internal_pings: true,
|
||||
ping_schedule: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,6 +150,7 @@ 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,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,4 +207,10 @@ 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ 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);
|
||||
|
|
|
@ -1423,3 +1423,51 @@ 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"));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче