pub(crate) struct Health {
started: Instant,
inflight: Mutex<HashMap<String, (String, Instant)>>,
last_tick_ms: AtomicU64,
threads: AtomicU64,
}Expand description
What the loop is doing, for the heartbeat to srv (mcp_health): the calls
not yet answered, and whether the async runtime is still turning.
Fields§
§started: Instant§inflight: Mutex<HashMap<String, (String, Instant)>>§last_tick_ms: AtomicU64Milliseconds after started when the runtime last ran its tick task.
threads: AtomicU64Call threads started and not yet back: a call given up on that is stuck in blocking code stays counted here.
Implementations§
Source§impl Health
impl Health
pub(crate) fn new() -> Arc<Self> ⓘ
fn threads_start(&self)
fn threads_end(&self)
Sourcepub(crate) fn call_threads(&self) -> u64
pub(crate) fn call_threads(&self) -> u64
Call threads still running, answered for or not.
pub(crate) fn begin(&self, key: String, tool: String)
fn end(&self, key: &str)
Sourcepub(crate) fn oldest_unanswered(&self) -> Option<(String, u64)>
pub(crate) fn oldest_unanswered(&self) -> Option<(String, u64)>
The age in seconds of the oldest call not yet answered, and its tool.
Sourcepub(crate) fn tick(&self)
pub(crate) fn tick(&self)
Run on the runtime once a second: if it stops running, the runtime is
starved or stuck, which Health::runtime_lag_ms shows from outside.
Sourcepub(crate) fn runtime_lag_ms(&self) -> u64
pub(crate) fn runtime_lag_ms(&self) -> u64
How long ago the runtime last ran Health::tick, read from another thread.
Auto Trait Implementations§
impl !Freeze for Health
impl RefUnwindSafe for Health
impl Send for Health
impl Sync for Health
impl Unpin for Health
impl UnsafeUnpin for Health
impl UnwindSafe for Health
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.