pub struct HealthMonitor { /* private fields */ }Expand description
A wrapper that monitors parser health and provides graceful degradation
This wraps any parser function to track how many events are being ignored and emit warnings when the parser seems to be misconfigured.
Implementations§
Source§impl HealthMonitor
impl HealthMonitor
Sourcepub fn record_parsed(&self)
pub fn record_parsed(&self)
Record that an event was parsed successfully
Sourcepub fn record_ignored(&self)
pub fn record_ignored(&self)
Record that an event was ignored
Sourcepub fn record_unknown_event(&self)
pub fn record_unknown_event(&self)
Record an unknown event type (valid JSON but unhandled)
Sourcepub fn record_parse_error(&self)
pub fn record_parse_error(&self)
Record a parse error (malformed JSON)
Sourcepub fn record_control_event(&self)
pub fn record_control_event(&self)
Record a control event (state management with no user-facing output)
Sourcepub fn record_partial_event(&self)
pub fn record_partial_event(&self)
Record a partial/delta event (streaming content displayed incrementally)
Partial events represent streaming content that is shown to the user in real-time as deltas. These are NOT errors and should not trigger health warnings.
Sourcepub fn check_and_warn(&self, colors: Colors) -> Option<String>
pub fn check_and_warn(&self, colors: Colors) -> Option<String>
Check if we should warn about parser health (only warn once)
Auto Trait Implementations§
impl !Freeze for HealthMonitor
impl !RefUnwindSafe for HealthMonitor
impl Send for HealthMonitor
impl !Sync for HealthMonitor
impl Unpin for HealthMonitor
impl UnwindSafe for HealthMonitor
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> 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