Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.17: add metrics on throttled streams (backport of #34579) #34582

Merged
merged 1 commit into from
Dec 23, 2023
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 streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ async fn handle_connection(
if reset_throttling_params_if_needed(&mut last_throttling_instant) {
streams_in_current_interval = 0;
} else if streams_in_current_interval >= max_streams_per_100ms {
stats.throttled_streams.fetch_add(1, Ordering::Relaxed);
let _ = stream.stop(VarInt::from_u32(STREAM_STOP_CODE_THROTTLING));
continue;
}
Expand Down
6 changes: 6 additions & 0 deletions streamer/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub struct StreamStats {
pub(crate) connection_setup_error_locally_closed: AtomicUsize,
pub(crate) connection_removed: AtomicUsize,
pub(crate) connection_remove_failed: AtomicUsize,
pub(crate) throttled_streams: AtomicUsize,
}

impl StreamStats {
Expand Down Expand Up @@ -386,6 +387,11 @@ impl StreamStats {
self.total_stream_read_timeouts.swap(0, Ordering::Relaxed),
i64
),
(
"throttled_streams",
self.throttled_streams.swap(0, Ordering::Relaxed),
i64
),
);
}
}
Expand Down