Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unreleased changes

* Add mechanisms for storing and retrieving submitted pings ([#3585](https://github.com/mozilla/glean/pull/3585)).
* Add new `submitted_pings` table to the SQLite database.
* Add methods to store, retrieve, update, and clear stored submitted pings.
* Update Ping and uploader implementations to store and update submitted pings as appropriate.

[Full changelog](https://github.com/mozilla/glean/compare/v70.0.0...main)

# v70.0.0 (2026-08-20)
Expand All @@ -22,8 +27,8 @@
* Implement glean-noop as a feature of glean-sym ([#3541](https://github.com/mozilla/glean/pull/3541))
* Support pings ([#3544](https://github.com/mozilla/glean/pull/3544))
* Implement the event metric ([#3534](https://github.com/mozilla/glean/pull/3534))
* BREAKING CHANGE: Switch from a noop feature to an `active` feature ([#3583](https://github.com/mozilla/glean/pull/3583))
* iOS
* BREAKING CHANGE: Switch from a noop feature to an `active` feature ([#3583](https://github.com/mozilla/glean/pull/3583))
* Implement the custom distribution metric type ([#3572](https://github.com/mozilla/glean/pull/3572))
* Python
* Implement the custom distribution metric type ([#3572](https://github.com/mozilla/glean/pull/3572))
Expand Down
1 change: 1 addition & 0 deletions glean-core/benchmark/benches/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub fn metric_dispatcher_benchmark(c: &mut Criterion) {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};
let client_info = ClientInfoMetrics::unknown();

Expand Down
5 changes: 4 additions & 1 deletion glean-core/benchmark/benches/lifetime_buffering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! Benchmark the impact of `delay_ping_lifetime_io` and automatic flushing on the overall performance.

use criterion::{Criterion, criterion_group, criterion_main};
use criterion::{criterion_group, criterion_main, Criterion};
use glean_core::{CommonMetricData, CounterMetric, Glean, Lifetime};

pub fn delay_io_benchmark(c: &mut Criterion) {
Expand Down Expand Up @@ -37,6 +37,7 @@ pub fn delay_io_benchmark(c: &mut Criterion) {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};
let glean = Glean::new(cfg).unwrap();

Expand Down Expand Up @@ -85,6 +86,7 @@ pub fn delay_io_benchmark(c: &mut Criterion) {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};
let glean = Glean::new(cfg).unwrap();

Expand Down Expand Up @@ -133,6 +135,7 @@ pub fn delay_io_benchmark(c: &mut Criterion) {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};
let glean = Glean::new(cfg).unwrap();

Expand Down
1 change: 1 addition & 0 deletions glean-core/examples/rkv-open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn main() {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};

let client_info = ClientInfoMetrics::unknown();
Expand Down
12 changes: 12 additions & 0 deletions glean-core/rlb/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub struct Configuration {
pub session_inactivity_timeout: Duration,
/// The number of "events" pings to accelerate each session, plus one.
pub events_ping_acceleration_factor: Option<usize>,
/// Whether to store submitted pings or not
pub enable_store_submitted_pings: bool,
}

/// Configuration builder.
Expand Down Expand Up @@ -131,6 +133,8 @@ pub struct Builder {
pub session_inactivity_timeout: Duration,
/// The number of "events" pings to accelerate each session, plus one.
pub events_ping_acceleration_factor: Option<usize>,
/// Whether to store submitted pings or not.
pub enable_store_submitted_pings: bool,
}

impl Builder {
Expand Down Expand Up @@ -162,6 +166,7 @@ impl Builder {
session_sample_rate: 1.0,
session_inactivity_timeout: Duration::from_secs(30 * 60),
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
}
}

Expand Down Expand Up @@ -189,6 +194,7 @@ impl Builder {
session_sample_rate: self.session_sample_rate,
session_inactivity_timeout: self.session_inactivity_timeout,
events_ping_acceleration_factor: self.events_ping_acceleration_factor,
enable_store_submitted_pings: self.enable_store_submitted_pings,
}
}

Expand Down Expand Up @@ -293,4 +299,10 @@ impl Builder {
self.events_ping_acceleration_factor = Some(factor);
self
}

/// Set whether to store submitted pings or not.
pub fn with_store_submitted_pings_enabled(mut self, value: bool) -> Self {
self.enable_store_submitted_pings = value;
self
}
}
27 changes: 27 additions & 0 deletions glean-core/rlb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ fn initialize_internal(cfg: Configuration, client_info: ClientInfoMetrics) -> Op
session_sample_rate: cfg.session_sample_rate,
session_inactivity_timeout_ms: cfg.session_inactivity_timeout.as_millis() as u64,
events_ping_acceleration_factor: cfg.events_ping_acceleration_factor.map(|x| x as u32),
enable_store_submitted_pings: cfg.enable_store_submitted_pings,
};

glean_core::glean_initialize(core_cfg, client_info.into(), callbacks);
Expand Down Expand Up @@ -180,6 +181,32 @@ pub fn set_collection_enabled(enabled: bool) {
glean_core::glean_set_collection_enabled(enabled)
}

/// Sets whether storing submitted pings is enabled or not.
pub fn set_store_submitted_pings_enabled(enabled: bool) {
glean_core::glean_set_store_submitted_pings_enabled(enabled)
}

/// Returns all stored submitted pings.
///
/// Requires storing submitted pings to be enabled.
/// See [`set_store_submitted_pings_enabled`].
pub fn get_all_stored_submitted_pings() -> Vec<glean_core::SubmittedPing> {
glean_core::glean_get_all_stored_submitted_pings()
}

/// Returns all stored submitted pings with a given ping name.
///
/// Requires storing submitted pings to be enabled.
/// See [`set_store_submitted_pings_enabled`].
pub fn get_stored_submitted_pings_by_name(ping: String) -> Vec<glean_core::SubmittedPing> {
glean_core::glean_get_stored_submitted_pings_by_name(ping)
}

/// Clears all stored submitted pings.
pub fn clear_stored_submitted_pings() {
glean_core::glean_clear_stored_submitted_pings()
}

/// Collects and submits a ping for eventual uploading by name.
///
/// Note that this needs to be public in order for RLB consumers to
Expand Down
14 changes: 14 additions & 0 deletions glean-core/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ where
/// session_sample_rate: 1.0,
/// session_inactivity_timeout_ms: 1_800_000,
/// events_ping_acceleration_factor: None,
/// enable_store_submitted_pings: false,
/// };
/// let mut glean = Glean::new(cfg).unwrap();
/// let ping = PingType::new("sample", true, false, true, true, true, vec![], vec![], true, vec![]);
Expand Down Expand Up @@ -196,6 +197,7 @@ pub struct Glean {
#[ignore_malloc_size_of = "TODO: Expose session memory allocations (bug 2043355)"]
pub(crate) session_manager: SessionManager,
events_ping_acceleration_factor: Option<usize>,
pub(crate) store_submitted_pings_enabled: bool,
}

impl Glean {
Expand Down Expand Up @@ -279,6 +281,7 @@ impl Glean {
events_ping_acceleration_factor: cfg
.events_ping_acceleration_factor
.map(|x| x as usize),
store_submitted_pings_enabled: cfg.enable_store_submitted_pings,
};

// Ensuring these pings are registered.
Expand Down Expand Up @@ -604,6 +607,7 @@ impl Glean {
session_sample_rate: 1.0,
session_inactivity_timeout_ms: 1_800_000,
events_ping_acceleration_factor: None,
enable_store_submitted_pings: false,
};

let mut glean = Self::new(cfg).unwrap();
Expand Down Expand Up @@ -817,6 +821,16 @@ impl Glean {
}
}

/// Sets whether storing submitted pings is enabled or not.
///
/// # Arguments
///
/// * `enabled` - When true, enables storing submitted pings.
///
pub fn set_store_submitted_pings_enabled(&mut self, enabled: bool) {
self.store_submitted_pings_enabled = enabled;
}

/// Enable or disable a ping.
///
/// Disabling a ping causes all data for that ping to be removed from storage
Expand Down
Loading
Loading