pub struct RpsRegistry { /* private fields */ }Expand description
Per-service sliding-window request-rate counter.
Records one timestamp per successfully-routed request and reports the
requests-per-second rate over a fixed [RPS_WINDOW]. Cheap to clone (it is
an Arc-friendly wrapper around interior-mutable state) and safe to share
across the proxy’s per-connection service clones.
This is the real per-service RPS signal the autoscaler consumes: the proxy
records every routed request via RpsRegistry::record, and the scheduler
reads RpsRegistry::rps for the same service key to drive request-rate
scaling.
Implementations§
Source§impl RpsRegistry
impl RpsRegistry
Sourcepub async fn record(&self, service: &str)
pub async fn record(&self, service: &str)
Record a single request against service at the current instant,
pruning timestamps older than the window.
Trait Implementations§
Source§impl Debug for RpsRegistry
impl Debug for RpsRegistry
Source§impl Default for RpsRegistry
impl Default for RpsRegistry
Source§fn default() -> RpsRegistry
fn default() -> RpsRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for RpsRegistry
impl !RefUnwindSafe for RpsRegistry
impl !UnwindSafe for RpsRegistry
impl Send for RpsRegistry
impl Sync for RpsRegistry
impl Unpin for RpsRegistry
impl UnsafeUnpin for RpsRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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