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

Commit d0b1f2c

Browse files
mergify[bot]lijunwangsHaoranYi
authored andcommitted
v1.17: Show staked vs nonstaked packets sent down/throttled (backport of #600) (#613)
* Show staked vs nonstaked packets sent down/throttled (#600) * Show staked vs nonstaked packets sent down * add metrics on throttled staked vs non-staked (cherry picked from commit b443cfb) # Conflicts: # streamer/src/quic.rs * fix merge conflicts --------- Co-authored-by: Lijun Wang <[email protected]> Co-authored-by: HaoranYi <[email protected]>
1 parent 3822ac2 commit d0b1f2c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

streamer/src/nonblocking/quic.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,18 @@ async fn handle_connection(
798798
streams_in_current_interval = 0;
799799
} else if streams_in_current_interval >= max_streams_per_100ms {
800800
stats.throttled_streams.fetch_add(1, Ordering::Relaxed);
801+
match peer_type {
802+
ConnectionPeerType::Unstaked => {
803+
stats
804+
.throttled_unstaked_streams
805+
.fetch_add(1, Ordering::Relaxed);
806+
}
807+
ConnectionPeerType::Staked => {
808+
stats
809+
.throttled_staked_streams
810+
.fetch_add(1, Ordering::Relaxed);
811+
}
812+
}
801813
let _ = stream.stop(VarInt::from_u32(STREAM_STOP_CODE_THROTTLING));
802814
continue;
803815
}
@@ -966,6 +978,19 @@ async fn handle_chunk(
966978
.total_chunks_sent_for_batching
967979
.fetch_add(chunks_sent, Ordering::Relaxed);
968980

981+
match peer_type {
982+
ConnectionPeerType::Unstaked => {
983+
stats
984+
.total_unstaked_packets_sent_for_batching
985+
.fetch_add(1, Ordering::Relaxed);
986+
}
987+
ConnectionPeerType::Staked => {
988+
stats
989+
.total_staked_packets_sent_for_batching
990+
.fetch_add(1, Ordering::Relaxed);
991+
}
992+
}
993+
969994
trace!("sent {} byte packet for batching", bytes_sent);
970995
}
971996
} else {

streamer/src/quic.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ pub struct StreamStats {
157157
pub(crate) connection_removed: AtomicUsize,
158158
pub(crate) connection_remove_failed: AtomicUsize,
159159
pub(crate) throttled_streams: AtomicUsize,
160+
pub(crate) total_staked_packets_sent_for_batching: AtomicUsize,
161+
pub(crate) total_unstaked_packets_sent_for_batching: AtomicUsize,
162+
pub(crate) throttled_staked_streams: AtomicUsize,
163+
pub(crate) throttled_unstaked_streams: AtomicUsize,
160164
}
161165

162166
impl StreamStats {
@@ -311,6 +315,18 @@ impl StreamStats {
311315
.swap(0, Ordering::Relaxed),
312316
i64
313317
),
318+
(
319+
"staked_packets_sent_for_batching",
320+
self.total_staked_packets_sent_for_batching
321+
.swap(0, Ordering::Relaxed),
322+
i64
323+
),
324+
(
325+
"unstaked_packets_sent_for_batching",
326+
self.total_unstaked_packets_sent_for_batching
327+
.swap(0, Ordering::Relaxed),
328+
i64
329+
),
314330
(
315331
"bytes_sent_for_batching",
316332
self.total_bytes_sent_for_batching
@@ -392,6 +408,16 @@ impl StreamStats {
392408
self.throttled_streams.swap(0, Ordering::Relaxed),
393409
i64
394410
),
411+
(
412+
"throttled_unstaked_streams",
413+
self.throttled_unstaked_streams.swap(0, Ordering::Relaxed),
414+
i64
415+
),
416+
(
417+
"throttled_staked_streams",
418+
self.throttled_staked_streams.swap(0, Ordering::Relaxed),
419+
i64
420+
),
395421
);
396422
}
397423
}

0 commit comments

Comments
 (0)