pub struct RateMetrics {
pub total_bytes: AtomicU64,
pub total_wait_time_us: AtomicU64,
pub acquisition_count: AtomicU64,
pub wait_count: AtomicU64,
pub last_measurement: AtomicU64,
pub window_bytes: AtomicU64,
}Expand description
Metrics for tracking rate limiting performance
Fields§
§total_bytes: AtomicU64Total bytes acquired
total_wait_time_us: AtomicU64Total wait time in microseconds
acquisition_count: AtomicU64Number of acquisitions
wait_count: AtomicU64Number of times tokens were not immediately available
last_measurement: AtomicU64Last measurement timestamp
window_bytes: AtomicU64Bytes acquired in current measurement window
Implementations§
Source§impl RateMetrics
impl RateMetrics
pub fn record_acquisition(&self, bytes: u64, wait_time_us: u64)
pub fn get_throughput(&self) -> f64
pub fn get_utilization(&self, current_rate: u64) -> f64
pub fn reset_window(&self)
Trait Implementations§
Source§impl Debug for RateMetrics
impl Debug for RateMetrics
Auto Trait Implementations§
impl !Freeze for RateMetrics
impl RefUnwindSafe for RateMetrics
impl Send for RateMetrics
impl Sync for RateMetrics
impl Unpin for RateMetrics
impl UnsafeUnpin for RateMetrics
impl UnwindSafe for RateMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more