Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9b8f666
Put some state about the migration INTO the database
badboy Jul 14, 2026
116a3de
Bug 2060553: Add submitted_pings database table and add get/store met…
jeddai Aug 4, 2026
eec4f45
update glean-sym-test Cargo.lock
jeddai Aug 4, 2026
c3dd9c4
update CHANGELOG.md
jeddai Aug 4, 2026
b25e5a5
fix where create and migrate diverged
jeddai Aug 5, 2026
0dc5561
adjust test to account for re-insert
jeddai Aug 6, 2026
1ad013a
update based on feedback
jeddai Aug 6, 2026
e909789
fix issue with insert query
jeddai Aug 6, 2026
f277ff1
update changelog and fix rebase issue
jeddai Aug 11, 2026
c0b06f4
update Glean to have configuration options for enabling storing pings
jeddai Aug 12, 2026
e243286
fix formatting
jeddai Aug 12, 2026
781199e
add cleanup method that runs on shutdown/maintenance
jeddai Aug 13, 2026
8034ae8
add variables and things to rlb
jeddai Aug 13, 2026
85dca1e
set default value for enable_store_submitted_pings in InternalConfigu…
jeddai Aug 13, 2026
35a314c
update based on feedback
jeddai Aug 13, 2026
79025ce
uv.lock changes
jeddai Aug 14, 2026
8203357
update glean-sym-test Cargo.lock
jeddai Aug 14, 2026
af406b0
add method to lib to clear the stored submitted pings
jeddai Aug 14, 2026
907fb15
update based on feedback
jeddai Aug 14, 2026
e1b27ae
add FFI/RLB methods to retrieve stored submitted pings from database
jeddai Aug 14, 2026
abc37cc
update changelog
jeddai Aug 14, 2026
f8a5477
fix formatting
jeddai Sep 1, 2026
2e62db3
update based on feedback
jeddai Sep 16, 2026
40d8c6e
fix failing test
jeddai Sep 16, 2026
1bfc5f3
update lib SubmittedPing members to be public
jeddai Sep 16, 2026
fd54f21
export SubmittedPing from rlb lib
jeddai Sep 16, 2026
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
5 changes: 5 additions & 0 deletions 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)

* General
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
}
}
29 changes: 28 additions & 1 deletion glean-core/rlb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use glean_core::{
},
traits, AttributionMetrics, CommonMetricData, DistributionMetrics, Error, ErrorType, Glean,
HistogramType, LabeledMetricData, Lifetime, PingRateLimit, RecordedExperiment, Result,
SessionMode,
SessionMode, SubmittedPing,
};

mod configuration;
Expand Down 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