Skip to content

Commit

Permalink
add metrics on throttled streams (solana-labs#34579)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs authored Dec 23, 2023
1 parent cc584a0 commit 1a00175
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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 @@ -175,6 +175,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 @@ -405,6 +406,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

0 comments on commit 1a00175

Please sign in to comment.