HealthMonitor

Struct HealthMonitor 

Source
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

Source

pub fn new(parser_name: &'static str) -> Self

Create a new health monitor for a parser

Source

pub fn record_parsed(&self)

Record that an event was parsed successfully

Source

pub fn record_ignored(&self)

Record that an event was ignored

Source

pub fn record_unknown_event(&self)

Record an unknown event type (valid JSON but unhandled)

Source

pub fn record_parse_error(&self)

Record a parse error (malformed JSON)

Source

pub fn record_control_event(&self)

Record a control event (state management with no user-facing output)

Source

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.

Source

pub fn check_and_warn(&self, colors: Colors) -> Option<String>

Check if we should warn about parser health (only warn once)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.