pub struct AdminState {
pub started_at: Instant,
pub metrics: Arc<InferenceMetrics>,
pub rate_aggregator: Option<Arc<RequestRateAggregator>>,
pub kv_cache_policy: Option<Arc<KvCachePolicy>>,
}Expand description
Shared state passed to all admin route handlers.
Fields§
§started_at: InstantTime at which the server was started (used to compute uptime).
metrics: Arc<InferenceMetrics>Shared metrics instance.
rate_aggregator: Option<Arc<RequestRateAggregator>>Optional workload aggregator surfaced via /admin/workload-stats.
kv_cache_policy: Option<Arc<KvCachePolicy>>Optional KV-cache compression policy surfaced via /admin/workload-stats.
Implementations§
Source§impl AdminState
impl AdminState
Sourcepub fn new(metrics: Arc<InferenceMetrics>) -> Self
pub fn new(metrics: Arc<InferenceMetrics>) -> Self
Create a new AdminState with the given metrics. Workload sources
(rate aggregator and KV-cache policy) start unset; attach them with
AdminState::with_rate_aggregator and
AdminState::with_kv_cache_policy.
Sourcepub fn with_rate_aggregator(
self,
aggregator: Arc<RequestRateAggregator>,
) -> Self
pub fn with_rate_aggregator( self, aggregator: Arc<RequestRateAggregator>, ) -> Self
Attach a workload RequestRateAggregator to surface via
/admin/workload-stats. Builder-style consuming setter.
Sourcepub fn with_kv_cache_policy(self, policy: Arc<KvCachePolicy>) -> Self
pub fn with_kv_cache_policy(self, policy: Arc<KvCachePolicy>) -> Self
Attach a KvCachePolicy to surface via /admin/workload-stats.
Builder-style consuming setter.
Sourcepub fn uptime_secs(&self) -> u64
pub fn uptime_secs(&self) -> u64
Return the number of whole seconds the server has been running.
Auto Trait Implementations§
impl Freeze for AdminState
impl RefUnwindSafe for AdminState
impl Send for AdminState
impl Sync for AdminState
impl Unpin for AdminState
impl UnsafeUnpin for AdminState
impl UnwindSafe for AdminState
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
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>
Converts
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>
Converts
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