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

Commit c78a972

Browse files
mergify[bot]lijunwangsHaoranYi
authored andcommitted
v1.18: Show staked vs nonstaked packets sent down/throttled (backport of #600) (#614)
* 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 491cb65 commit c78a972

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
@@ -764,6 +764,18 @@ async fn handle_connection(
764764
>= max_streams_per_throttling_interval
765765
{
766766
stats.throttled_streams.fetch_add(1, Ordering::Relaxed);
767+
match params.peer_type {
768+
ConnectionPeerType::Unstaked => {
769+
stats
770+
.throttled_unstaked_streams
771+
.fetch_add(1, Ordering::Relaxed);
772+
}
773+
ConnectionPeerType::Staked(_) => {
774+
stats
775+
.throttled_staked_streams
776+
.fetch_add(1, Ordering::Relaxed);
777+
}
778+
}
767779
let _ = stream.stop(VarInt::from_u32(STREAM_STOP_CODE_THROTTLING));
768780
continue;
769781
}
@@ -932,6 +944,19 @@ async fn handle_chunk(
932944
.total_chunks_sent_for_batching
933945
.fetch_add(chunks_sent, Ordering::Relaxed);
934946

947+
match peer_type {
948+
ConnectionPeerType::Unstaked => {
949+
stats
950+
.total_unstaked_packets_sent_for_batching
951+
.fetch_add(1, Ordering::Relaxed);
952+
}
953+
ConnectionPeerType::Staked(_) => {
954+
stats
955+
.total_staked_packets_sent_for_batching
956+
.fetch_add(1, Ordering::Relaxed);
957+
}
958+
}
959+
935960
trace!("sent {} byte packet for batching", bytes_sent);
936961
}
937962
} else {

streamer/src/quic.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ pub struct StreamStats {
179179
pub(crate) stream_load_ema: AtomicUsize,
180180
pub(crate) stream_load_ema_overflow: AtomicUsize,
181181
pub(crate) stream_load_capacity_overflow: AtomicUsize,
182+
pub(crate) total_staked_packets_sent_for_batching: AtomicUsize,
183+
pub(crate) total_unstaked_packets_sent_for_batching: AtomicUsize,
184+
pub(crate) throttled_staked_streams: AtomicUsize,
185+
pub(crate) throttled_unstaked_streams: AtomicUsize,
182186
}
183187

184188
impl StreamStats {
@@ -333,6 +337,18 @@ impl StreamStats {
333337
.swap(0, Ordering::Relaxed),
334338
i64
335339
),
340+
(
341+
"staked_packets_sent_for_batching",
342+
self.total_staked_packets_sent_for_batching
343+
.swap(0, Ordering::Relaxed),
344+
i64
345+
),
346+
(
347+
"unstaked_packets_sent_for_batching",
348+
self.total_unstaked_packets_sent_for_batching
349+
.swap(0, Ordering::Relaxed),
350+
i64
351+
),
336352
(
337353
"bytes_sent_for_batching",
338354
self.total_bytes_sent_for_batching
@@ -429,6 +445,16 @@ impl StreamStats {
429445
self.stream_load_capacity_overflow.load(Ordering::Relaxed),
430446
i64
431447
),
448+
(
449+
"throttled_unstaked_streams",
450+
self.throttled_unstaked_streams.swap(0, Ordering::Relaxed),
451+
i64
452+
),
453+
(
454+
"throttled_staked_streams",
455+
self.throttled_staked_streams.swap(0, Ordering::Relaxed),
456+
i64
457+
),
432458
);
433459
}
434460
}

0 commit comments

Comments
 (0)