Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit cc7c59a

Browse files
v1.17: add metrics on throttled streams (backport of #34579) (#34582)
add metrics on throttled streams (#34579) (cherry picked from commit 1a00175) Co-authored-by: Lijun Wang <[email protected]>
1 parent 7d41bc4 commit cc7c59a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

streamer/src/nonblocking/quic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ async fn handle_connection(
742742
if reset_throttling_params_if_needed(&mut last_throttling_instant) {
743743
streams_in_current_interval = 0;
744744
} else if streams_in_current_interval >= max_streams_per_100ms {
745+
stats.throttled_streams.fetch_add(1, Ordering::Relaxed);
745746
let _ = stream.stop(VarInt::from_u32(STREAM_STOP_CODE_THROTTLING));
746747
continue;
747748
}

streamer/src/quic.rs

+6
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ pub struct StreamStats {
156156
pub(crate) connection_setup_error_locally_closed: AtomicUsize,
157157
pub(crate) connection_removed: AtomicUsize,
158158
pub(crate) connection_remove_failed: AtomicUsize,
159+
pub(crate) throttled_streams: AtomicUsize,
159160
}
160161

161162
impl StreamStats {
@@ -386,6 +387,11 @@ impl StreamStats {
386387
self.total_stream_read_timeouts.swap(0, Ordering::Relaxed),
387388
i64
388389
),
390+
(
391+
"throttled_streams",
392+
self.throttled_streams.swap(0, Ordering::Relaxed),
393+
i64
394+
),
389395
);
390396
}
391397
}

0 commit comments

Comments
 (0)