Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* General
* Stop reporting db file sizes during init phase ([#3331](https://github.com/mozilla/glean/pull/3331))
* Tiny performance improvement for putting tasks on the dispatcher ([#3318](https://github.com/mozilla/glean/pull/3318))
* Use an explicit match for the labeled metric ping sections ([#3335](https://github.com/mozilla/glean/pull/3335))

# v66.1.1 (2025-11-06)

Expand Down
13 changes: 12 additions & 1 deletion glean-core/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ fn snapshot_labeled_metrics(
metric_id: &str,
metric: &Metric,
) {
let ping_section = format!("labeled_{}", metric.ping_section());
// Explicit match for supported labeled metrics, avoiding the formatting string
let ping_section = match metric.ping_section() {
"boolean" => "labeled_boolean".to_string(),
"counter" => "labeled_counter".to_string(),
"timing_distribution" => "labeled_timing_distribution".to_string(),
"memory_distribution" => "labeled_memory_distribution".to_string(),
"custom_distribution" => "labeled_custom_distribution".to_string(),
"quantity" => "labeled_quantity".to_string(),
// This should never happen, we covered all cases.
// Should we ever extend it this would however at least catch it and do the right thing.
_ => format!("labeled_{}", metric.ping_section()),
};
let map = snapshot.entry(ping_section).or_default();

// Safe unwrap, the function is only called when the id does contain a '/'
Expand Down