msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Peer stream statistics

Open nibanks opened this issue 6 months ago • 3 comments

Description

Fixes #4606 by defining a new extension to exchange and expose peer statistics.

Testing

Locally

Documentation

Some added

nibanks avatar Jun 06 '25 11:06 nibanks

Cargo - ubuntu-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/linux_bindings.rs b/src/rs/ffi/linux_bindings.rs
index 283e538..f43e3bf 100644
--- a/src/rs/ffi/linux_bindings.rs
+++ b/src/rs/ffi/linux_bindings.rs
@@ -216,6 +216,7 @@ pub const QUIC_PARAM_STREAM_IDEAL_SEND_BUFFER_SIZE: u32 = 134217730;
 pub const QUIC_PARAM_STREAM_PRIORITY: u32 = 134217731;
 pub const QUIC_PARAM_STREAM_STATISTICS: u32 = 134217732;
 pub const QUIC_PARAM_STREAM_RELIABLE_OFFSET: u32 = 134217733;
+pub const QUIC_PARAM_STREAM_PEER_STATISTICS: u32 = 134217734;
 pub const QUIC_API_VERSION_1: u32 = 1;
 pub const QUIC_API_VERSION_2: u32 = 2;
 pub type BOOLEAN = ::std::os::raw::c_uchar;
@@ -1497,14 +1498,47 @@ impl QUIC_STATISTICS_V2 {
         }
     }
     #[inline]
+    pub fn StreamStatisticsNegotiated(&self) -> u32 {
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) }
+    }
+    #[inline]
+    pub fn set_StreamStatisticsNegotiated(&mut self, val: u32) {
+        unsafe {
+            let val: u32 = ::std::mem::transmute(val);
+            self._bitfield_1.set(7usize, 1u8, val as u64)
+        }
+    }
+    #[inline]
+    pub unsafe fn StreamStatisticsNegotiated_raw(this: *const Self) -> u32 {
+        unsafe {
+            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
+                ::std::ptr::addr_of!((*this)._bitfield_1),
+                7usize,
+                1u8,
+            ) as u32)
+        }
+    }
+    #[inline]
+    pub unsafe fn set_StreamStatisticsNegotiated_raw(this: *mut Self, val: u32) {
+        unsafe {
+            let val: u32 = ::std::mem::transmute(val);
+            <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
+                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
+                7usize,
+                1u8,
+                val as u64,
+            )
+        }
+    }
+    #[inline]
     pub fn RESERVED(&self) -> u32 {
-        unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) }
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 24u8) as u32) }
     }
     #[inline]
     pub fn set_RESERVED(&mut self, val: u32) {
         unsafe {
             let val: u32 = ::std::mem::transmute(val);
-            self._bitfield_1.set(7usize, 25u8, val as u64)
+            self._bitfield_1.set(8usize, 24u8, val as u64)
         }
     }
     #[inline]
@@ -1512,8 +1546,8 @@ impl QUIC_STATISTICS_V2 {
         unsafe {
             ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
                 ::std::ptr::addr_of!((*this)._bitfield_1),
-                7usize,
-                25u8,
+                8usize,
+                24u8,
             ) as u32)
         }
     }
@@ -1523,8 +1557,8 @@ impl QUIC_STATISTICS_V2 {
             let val: u32 = ::std::mem::transmute(val);
             <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
                 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                25u8,
+                8usize,
+                24u8,
                 val as u64,
             )
         }
@@ -1538,6 +1572,7 @@ impl QUIC_STATISTICS_V2 {
         GreaseBitNegotiated: u32,
         EcnCapable: u32,
         EncryptionOffloaded: u32,
+        StreamStatisticsNegotiated: u32,
         RESERVED: u32,
     ) -> __BindgenBitfieldUnit<[u8; 4usize]> {
         let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
@@ -1569,7 +1604,12 @@ impl QUIC_STATISTICS_V2 {
             let EncryptionOffloaded: u32 = unsafe { ::std::mem::transmute(EncryptionOffloaded) };
             EncryptionOffloaded as u64
         });
-        __bindgen_bitfield_unit.set(7usize, 25u8, {
+        __bindgen_bitfield_unit.set(7usize, 1u8, {
+            let StreamStatisticsNegotiated: u32 =
+                unsafe { ::std::mem::transmute(StreamStatisticsNegotiated) };
+            StreamStatisticsNegotiated as u64
+        });
+        __bindgen_bitfield_unit.set(8usize, 24u8, {
             let RESERVED: u32 = unsafe { ::std::mem::transmute(RESERVED) };
             RESERVED as u64
         });

github-actions[bot] avatar Jun 06 '25 12:06 github-actions[bot]

Cargo - windows-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/win_bindings.rs b/src/rs/ffi/win_bindings.rs
index c2af262..5c1c565 100644
--- a/src/rs/ffi/win_bindings.rs
+++ b/src/rs/ffi/win_bindings.rs
@@ -213,6 +213,7 @@ pub const QUIC_PARAM_STREAM_IDEAL_SEND_BUFFER_SIZE: u32 = 134217730;
 pub const QUIC_PARAM_STREAM_PRIORITY: u32 = 134217731;
 pub const QUIC_PARAM_STREAM_STATISTICS: u32 = 134217732;
 pub const QUIC_PARAM_STREAM_RELIABLE_OFFSET: u32 = 134217733;
+pub const QUIC_PARAM_STREAM_PEER_STATISTICS: u32 = 134217734;
 pub const QUIC_API_VERSION_1: u32 = 1;
 pub const QUIC_API_VERSION_2: u32 = 2;
 pub type BYTE = ::std::os::raw::c_uchar;
@@ -1491,14 +1492,47 @@ impl QUIC_STATISTICS_V2 {
         }
     }
     #[inline]
+    pub fn StreamStatisticsNegotiated(&self) -> u32 {
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) }
+    }
+    #[inline]
+    pub fn set_StreamStatisticsNegotiated(&mut self, val: u32) {
+        unsafe {
+            let val: u32 = ::std::mem::transmute(val);
+            self._bitfield_1.set(7usize, 1u8, val as u64)
+        }
+    }
+    #[inline]
+    pub unsafe fn StreamStatisticsNegotiated_raw(this: *const Self) -> u32 {
+        unsafe {
+            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
+                ::std::ptr::addr_of!((*this)._bitfield_1),
+                7usize,
+                1u8,
+            ) as u32)
+        }
+    }
+    #[inline]
+    pub unsafe fn set_StreamStatisticsNegotiated_raw(this: *mut Self, val: u32) {
+        unsafe {
+            let val: u32 = ::std::mem::transmute(val);
+            <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
+                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
+                7usize,
+                1u8,
+                val as u64,
+            )
+        }
+    }
+    #[inline]
     pub fn RESERVED(&self) -> u32 {
-        unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) }
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 24u8) as u32) }
     }
     #[inline]
     pub fn set_RESERVED(&mut self, val: u32) {
         unsafe {
             let val: u32 = ::std::mem::transmute(val);
-            self._bitfield_1.set(7usize, 25u8, val as u64)
+            self._bitfield_1.set(8usize, 24u8, val as u64)
         }
     }
     #[inline]
@@ -1506,8 +1540,8 @@ impl QUIC_STATISTICS_V2 {
         unsafe {
             ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
                 ::std::ptr::addr_of!((*this)._bitfield_1),
-                7usize,
-                25u8,
+                8usize,
+                24u8,
             ) as u32)
         }
     }
@@ -1517,8 +1551,8 @@ impl QUIC_STATISTICS_V2 {
             let val: u32 = ::std::mem::transmute(val);
             <__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
                 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                25u8,
+                8usize,
+                24u8,
                 val as u64,
             )
         }
@@ -1532,6 +1566,7 @@ impl QUIC_STATISTICS_V2 {
         GreaseBitNegotiated: u32,
         EcnCapable: u32,
         EncryptionOffloaded: u32,
+        StreamStatisticsNegotiated: u32,
         RESERVED: u32,
     ) -> __BindgenBitfieldUnit<[u8; 4usize]> {
         let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
@@ -1563,7 +1598,12 @@ impl QUIC_STATISTICS_V2 {
             let EncryptionOffloaded: u32 = unsafe { ::std::mem::transmute(EncryptionOffloaded) };
             EncryptionOffloaded as u64
         });
-        __bindgen_bitfield_unit.set(7usize, 25u8, {
+        __bindgen_bitfield_unit.set(7usize, 1u8, {
+            let StreamStatisticsNegotiated: u32 =
+                unsafe { ::std::mem::transmute(StreamStatisticsNegotiated) };
+            StreamStatisticsNegotiated as u64
+        });
+        __bindgen_bitfield_unit.set(8usize, 24u8, {
             let RESERVED: u32 = unsafe { ::std::mem::transmute(RESERVED) };
             RESERVED as u64
         });

github-actions[bot] avatar Jun 06 '25 12:06 github-actions[bot]

Codecov Report

Attention: Patch coverage is 77.19298% with 26 lines in your changes missing coverage. Please review.

Project coverage is 67.46%. Comparing base (0298f93) to head (05b4e33). Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/core/stream.c 63.04% 17 Missing :warning:
src/core/frame.c 85.71% 4 Missing :warning:
src/core/crypto_tls.c 81.81% 2 Missing :warning:
src/core/connection.c 0.00% 1 Missing :warning:
src/core/stream_recv.c 90.00% 1 Missing :warning:
src/core/stream_send.c 94.11% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5145       +/-   ##
===========================================
- Coverage   87.10%   67.46%   -19.65%     
===========================================
  Files          59       59               
  Lines       18035    18134       +99     
===========================================
- Hits        15710    12234     -3476     
- Misses       2325     5900     +3575     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 06 '25 12:06 codecov[bot]