File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 22
33[ Full changelog] ( https://github.com/mozilla/glean/compare/v66.1.1...main )
44
5+ * General
6+ * Use an explicit match for the labeled metric ping sections ([ #3335 ] ( https://github.com/mozilla/glean/pull/3335 ) )
7+
58# v66.1.1 (2025-11-06)
69
710[ Full changelog] ( https://github.com/mozilla/glean/compare/v66.1.0...v66.1.1 )
Original file line number Diff line number Diff line change @@ -32,7 +32,18 @@ fn snapshot_labeled_metrics(
3232 metric_id : & str ,
3333 metric : & Metric ,
3434) {
35- let ping_section = format ! ( "labeled_{}" , metric. ping_section( ) ) ;
35+ // Explicit match for supported labeled metrics, avoiding the formatting string
36+ let ping_section = match metric. ping_section ( ) {
37+ "boolean" => "labeled_boolean" . to_string ( ) ,
38+ "counter" => "labeled_counter" . to_string ( ) ,
39+ "timing_distribution" => "labeled_timing_distribution" . to_string ( ) ,
40+ "memory_distribution" => "labeled_memory_distribution" . to_string ( ) ,
41+ "custom_distribution" => "labeled_custom_distribution" . to_string ( ) ,
42+ "quantity" => "labeled_quantity" . to_string ( ) ,
43+ // This should never happen, we covered all cases.
44+ // Should we ever extend it this would however at least catch it and do the right thing.
45+ _ => format ! ( "labeled_{}" , metric. ping_section( ) ) ,
46+ } ;
3647 let map = snapshot. entry ( ping_section) . or_default ( ) ;
3748
3849 // Safe unwrap, the function is only called when the id does contain a '/'
You can’t perform that action at this time.
0 commit comments