summaryrefslogtreecommitdiffstats
path: root/third_party/rust/glean/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/glean/src')
-rw-r--r--third_party/rust/glean/src/lib.rs10
-rw-r--r--third_party/rust/glean/src/private/ping.rs11
-rw-r--r--third_party/rust/glean/src/test.rs29
3 files changed, 37 insertions, 13 deletions
diff --git a/third_party/rust/glean/src/lib.rs b/third_party/rust/glean/src/lib.rs
index 81899d42ee..7f7f2c48be 100644
--- a/third_party/rust/glean/src/lib.rs
+++ b/third_party/rust/glean/src/lib.rs
@@ -23,7 +23,7 @@
//! let cfg = ConfigurationBuilder::new(true, "/tmp/data", "org.mozilla.glean_core.example").build();
//! glean::initialize(cfg, ClientInfoMetrics::unknown());
//!
-//! let prototype_ping = PingType::new("prototype", true, true, true, true, vec!());
+//! let prototype_ping = PingType::new("prototype", true, true, true, true, true, vec!(), vec!());
//!
//! prototype_ping.submit(None);
//! ```
@@ -187,9 +187,9 @@ pub fn test_get_experimentation_id() -> Option<String> {
/// Set the remote configuration values for the metrics' disabled property
///
-/// See [`glean_core::Glean::set_metrics_enabled_config`].
-pub fn glean_set_metrics_enabled_config(json: String) {
- glean_core::glean_set_metrics_enabled_config(json)
+/// See [`glean_core::Glean::glean_apply_server_knobs_config`].
+pub fn glean_apply_server_knobs_config(json: String) {
+ glean_core::glean_apply_server_knobs_config(json)
}
/// Performs the collection/cleanup operations required by becoming active.
@@ -293,7 +293,7 @@ pub fn get_timestamp_ms() -> u64 {
/// If Glean hasn't been initialized this will dispatch and return Ok(()),
/// otherwise it will block until the persist is done and return its Result.
pub fn persist_ping_lifetime_data() {
- glean_core::persist_ping_lifetime_data();
+ glean_core::glean_persist_ping_lifetime_data();
}
#[cfg(test)]
diff --git a/third_party/rust/glean/src/private/ping.rs b/third_party/rust/glean/src/private/ping.rs
index 6c126992bc..b54eec91a6 100644
--- a/third_party/rust/glean/src/private/ping.rs
+++ b/third_party/rust/glean/src/private/ping.rs
@@ -27,13 +27,22 @@ impl PingType {
/// * `name` - The name of the ping.
/// * `include_client_id` - Whether to include the client ID in the assembled ping when.
/// * `send_if_empty` - Whether the ping should be sent empty or not.
+ /// * `precise_timestamps` - Whether the ping should use precise timestamps for the start and end time.
+ /// * `include_info_sections` - Whether the ping should include the client/ping_info sections.
+ /// * `enabled` - Whether or not this ping is enabled. Note: Data that would be sent on a disabled
+ /// ping will still be collected and is discarded instead of being submitted.
+ /// * `schedules_pings` - A list of pings which are triggered for submission when this ping is
+ /// submitted.
/// * `reason_codes` - The valid reason codes for this ping.
+ #[allow(clippy::too_many_arguments)]
pub fn new<A: Into<String>>(
name: A,
include_client_id: bool,
send_if_empty: bool,
precise_timestamps: bool,
include_info_sections: bool,
+ enabled: bool,
+ schedules_pings: Vec<String>,
reason_codes: Vec<String>,
) -> Self {
let inner = glean_core::metrics::PingType::new(
@@ -42,6 +51,8 @@ impl PingType {
send_if_empty,
precise_timestamps,
include_info_sections,
+ enabled,
+ schedules_pings,
reason_codes,
);
diff --git a/third_party/rust/glean/src/test.rs b/third_party/rust/glean/src/test.rs
index 16d6d05447..c547cabccd 100644
--- a/third_party/rust/glean/src/test.rs
+++ b/third_party/rust/glean/src/test.rs
@@ -49,7 +49,8 @@ fn send_a_ping() {
// Define a new ping and submit it.
const PING_NAME: &str = "test-ping";
- let custom_ping = private::PingType::new(PING_NAME, true, true, true, true, vec![]);
+ let custom_ping =
+ private::PingType::new(PING_NAME, true, true, true, true, true, vec![], vec![]);
custom_ping.submit(None);
// Wait for the ping to arrive.
@@ -90,7 +91,8 @@ fn send_a_ping_without_info_sections() {
// Define a new ping and submit it.
const PING_NAME: &str = "noinfo-ping";
- let custom_ping = private::PingType::new(PING_NAME, true, true, true, false, vec![]);
+ let custom_ping =
+ private::PingType::new(PING_NAME, true, true, true, false, true, vec![], vec![]);
custom_ping.submit(None);
// Wait for the ping to arrive.
@@ -594,7 +596,7 @@ fn ping_collection_must_happen_after_concurrently_scheduled_metrics_recordings()
);
let ping_name = "custom_ping_1";
- let ping = private::PingType::new(ping_name, true, false, true, true, vec![]);
+ let ping = private::PingType::new(ping_name, true, false, true, true, true, vec![], vec![]);
let metric = private::StringMetric::new(CommonMetricData {
name: "string_metric".into(),
category: "telemetry".into(),
@@ -1097,7 +1099,16 @@ fn flipping_upload_enabled_respects_order_of_events() {
.build();
// We create a ping and a metric before we initialize Glean
- let sample_ping = PingType::new("sample-ping-1", true, false, true, true, vec![]);
+ let sample_ping = PingType::new(
+ "sample-ping-1",
+ true,
+ false,
+ true,
+ true,
+ true,
+ vec![],
+ vec![],
+ );
let metric = private::StringMetric::new(CommonMetricData {
name: "string_metric".into(),
category: "telemetry".into(),
@@ -1141,7 +1152,7 @@ fn registering_pings_before_init_must_work() {
}
// Create a custom ping and attempt its registration.
- let sample_ping = PingType::new("pre-register", true, true, true, true, vec![]);
+ let sample_ping = PingType::new("pre-register", true, true, true, true, true, vec![], vec![]);
// Create a custom configuration to use a fake uploader.
let dir = tempfile::tempdir().unwrap();
@@ -1193,7 +1204,7 @@ fn test_a_ping_before_submission() {
let _t = new_glean(Some(cfg), true);
// Create a custom ping and register it.
- let sample_ping = PingType::new("custom1", true, true, true, true, vec![]);
+ let sample_ping = PingType::new("custom1", true, true, true, true, true, vec![], vec![]);
let metric = CounterMetric::new(CommonMetricData {
name: "counter_metric".into(),
@@ -1310,7 +1321,8 @@ fn signaling_done() {
// Define a new ping and submit it.
const PING_NAME: &str = "test-ping";
- let custom_ping = private::PingType::new(PING_NAME, true, true, true, true, vec![]);
+ let custom_ping =
+ private::PingType::new(PING_NAME, true, true, true, true, true, vec![], vec![]);
custom_ping.submit(None);
custom_ping.submit(None);
@@ -1381,7 +1393,8 @@ fn configure_ping_throttling() {
// Define a new ping.
const PING_NAME: &str = "test-ping";
- let custom_ping = private::PingType::new(PING_NAME, true, true, true, true, vec![]);
+ let custom_ping =
+ private::PingType::new(PING_NAME, true, true, true, true, true, vec![], vec![]);
// Submit and receive it `pings_per_interval` times.
for _ in 0..pings_per_interval {