commit 5a9502cb10e897146a993dd18d7a02ba4cdae295
parent 7f3efcc6563cab0c86447b9405548ddaaee2f294
Author: Oskar Mansfeld <git@omansfeld.net>
Date: Mon, 8 Dec 2025 16:33:23 +0000
Bug 1992148 - Add metric to track spurious congestion event ratio. r=mxinden,necko-reviewers,kershaw
Tracks the ratio of spurious congestion events to loss induced
congestion events. Uses a scaling factor of 10k.
I gave the probe a range_max of 10k (which would represent every
congestion event being spurious), because while I expect the overall
ratio to be much lower, it is most likely that a connection seeing some
spurious congestion will see a lot of it, while other connections see
none at all. So setting the range_max to something lower might cut those
single data points off. It's the same reason why this is a linear
histogram and not an exponential one.
Differential Revision: https://phabricator.services.mozilla.com/D275053
Diffstat:
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/netwerk/metrics.yaml b/netwerk/metrics.yaml
@@ -1094,6 +1094,26 @@ networking:
- minden@mozilla.com
expires: never
+ http_3_spurious_congestion_event_ratio:
+ type: custom_distribution
+ unit: integer
+ range_min: 0
+ range_max: 10000
+ bucket_count: 100
+ histogram_type: linear
+ description: >
+ HTTP3: spurious congestion event to loss induced congestion event ratio (10000 scaling factor).
+ bugs:
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1992148
+ data_reviews:
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1992148
+ data_sensitivity:
+ - technical
+ notification_emails:
+ - necko@mozilla.com
+ - omansfeld@mozilla.com
+ expires: 157
+
http_3_connection_close_reason:
type: labeled_counter
description: >
diff --git a/netwerk/socket/neqo_glue/src/lib.rs b/netwerk/socket/neqo_glue/src/lib.rs
@@ -684,6 +684,21 @@ impl NeqoHttp3Conn {
debug_assert!(false, "{msg}");
}
}
+
+ // Ignore connections that never had loss induced congestion events (and prevent dividing by zero)
+ if stats.cc.congestion_events_loss != 0 {
+ if let Ok(spurious) = i64::try_from(
+ (stats.cc.congestion_events_spurious * PRECISION_FACTOR_USIZE)
+ / stats.cc.congestion_events_loss,
+ ) {
+ glean::http_3_spurious_congestion_event_ratio
+ .accumulate_single_sample_signed(spurious);
+ } else {
+ let msg = "Failed to convert ratio to i64 for use with glean";
+ qwarn!("{msg}");
+ debug_assert!(false, "{msg}");
+ }
+ }
}
fn increment_would_block_rx(&mut self) {