pub struct PerTenantRateLimitConfig {
pub burst: u32,
pub qps: f64,
}Expand description
Per-tenant (secondary) rate-limit configuration.
Sits in front of the per-token bucket as the primary defence against a
noisy-neighbour tenant saturating a shared token’s overall quota. The
per-token bucket (see RateLimitConfig) is retained as a backstop.
Composite bucket key is (TokenId, TenantId) — so a single token used by
two tenants does not let one tenant drain the other’s allowance.
Field semantics:
burst == 0=> disabled (this layer admits unconditionally). The per- token backstop still applies if it is itself configured.qps == 0.0=> non-zero burst is a one-shot allowance with no refill. Useful for tests; in production an operator who wants no per-tenant ceiling should setburst = 0to disable the layer outright.
Fields§
§burst: u32Maximum burst — the per-tenant bucket capacity, in permits.
qps: f64Steady-state requests-per-second admitted per (token, tenant) pair.
0.0 disables refill (the bucket drains and stays empty until process
restart).
Implementations§
Source§impl PerTenantRateLimitConfig
impl PerTenantRateLimitConfig
Sourcepub const DEFAULT_BURST: u32 = 20
pub const DEFAULT_BURST: u32 = 20
Default per-tenant burst. Deliberately conservative so a misbehaving tenant on a shared token cannot trample neighbours; operators tune upward as their multi-tenant workload demands.
Sourcepub const DEFAULT_QPS: f64 = 10.0
pub const DEFAULT_QPS: f64 = 10.0
Default per-tenant steady-state QPS. Matches the conservative
DEFAULT_BURST shape — sized for the small
internal tenant fleet today; operators raise it as needed.
Sourcepub const fn is_disabled(&self) -> bool
pub const fn is_disabled(&self) -> bool
true if the per-tenant layer is disabled. Determined solely by
burst == 0: a non-zero burst with qps == 0.0 is a valid (no-
refill) configuration, not a disabled one.
Trait Implementations§
Source§impl Clone for PerTenantRateLimitConfig
impl Clone for PerTenantRateLimitConfig
Source§fn clone(&self) -> PerTenantRateLimitConfig
fn clone(&self) -> PerTenantRateLimitConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PerTenantRateLimitConfig
Source§impl Debug for PerTenantRateLimitConfig
impl Debug for PerTenantRateLimitConfig
Source§impl Default for PerTenantRateLimitConfig
impl Default for PerTenantRateLimitConfig
Source§fn default() -> Self
fn default() -> Self
Default to the conservative active configuration
(burst = 20, qps = 10.0). Operators reach the fully-disabled
posture via PerTenantRateLimitConfig::disabled.
Source§impl PartialEq for PerTenantRateLimitConfig
impl PartialEq for PerTenantRateLimitConfig
Source§fn eq(&self, other: &PerTenantRateLimitConfig) -> bool
fn eq(&self, other: &PerTenantRateLimitConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PerTenantRateLimitConfig
Auto Trait Implementations§
impl Freeze for PerTenantRateLimitConfig
impl RefUnwindSafe for PerTenantRateLimitConfig
impl Send for PerTenantRateLimitConfig
impl Sync for PerTenantRateLimitConfig
impl Unpin for PerTenantRateLimitConfig
impl UnsafeUnpin for PerTenantRateLimitConfig
impl UnwindSafe for PerTenantRateLimitConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more