pub struct ParserHealth {
pub total_events: u64,
pub parsed_events: u64,
pub partial_events: u64,
pub ignored_events: u64,
pub control_events: u64,
pub unknown_events: u64,
pub parse_errors: u64,
}Expand description
Parser health statistics
Fields§
§total_events: u64Total number of events processed
parsed_events: u64Number of events successfully parsed and displayed
partial_events: u64Number of partial/delta events (streaming content displayed incrementally)
ignored_events: u64Number of events ignored (malformed JSON, unknown events, etc.)
control_events: u64Number of control events (state management, no user output)
unknown_events: u64Number of unknown event types (valid JSON but unhandled)
parse_errors: u64Number of JSON parse errors (malformed JSON)
Implementations§
Source§impl ParserHealth
impl ParserHealth
Sourcepub const fn record_parsed(&mut self)
pub const fn record_parsed(&mut self)
Record a parsed event
Sourcepub const fn record_ignored(&mut self)
pub const fn record_ignored(&mut self)
Record an ignored event
Sourcepub const fn record_unknown_event(&mut self)
pub const fn record_unknown_event(&mut self)
Record an unknown event type (valid JSON but unhandled)
Unknown events are valid JSON that the parser deserialized successfully but doesn’t have specific handling for. These should not trigger health warnings as they represent future/new event types, not parser errors.
Sourcepub const fn record_parse_error(&mut self)
pub const fn record_parse_error(&mut self)
Record a parse error (malformed JSON)
Sourcepub const fn record_control_event(&mut self)
pub const fn record_control_event(&mut self)
Record a control event (state management with no user-facing output)
Control events are valid JSON that represent state transitions rather than user-facing content. They should not be counted as “ignored” for health monitoring purposes.
Sourcepub const fn record_partial_event(&mut self)
pub const fn record_partial_event(&mut 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. They are tracked separately to show streaming activity.
Sourcepub fn parse_error_percentage(&self) -> f64
pub fn parse_error_percentage(&self) -> f64
Get the percentage of parse errors (excluding unknown events)
Returns percentage using integer-safe arithmetic to avoid precision loss warnings.
Sourcepub fn parse_error_percentage_int(&self) -> u32
pub fn parse_error_percentage_int(&self) -> u32
Get the percentage of parse errors as a rounded integer.
This is for display purposes where a whole number is sufficient.
Sourcepub fn is_concerning(&self) -> bool
pub fn is_concerning(&self) -> bool
Check if the parser health is concerning
Only returns true if there are actual parse errors (malformed JSON), not just unknown event types. Unknown events are valid JSON that we don’t have specific handling for, which is not a health concern.
Trait Implementations§
Source§impl Clone for ParserHealth
impl Clone for ParserHealth
Source§fn clone(&self) -> ParserHealth
fn clone(&self) -> ParserHealth
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserHealth
impl Debug for ParserHealth
Source§impl Default for ParserHealth
impl Default for ParserHealth
Source§fn default() -> ParserHealth
fn default() -> ParserHealth
impl Copy for ParserHealth
Auto Trait Implementations§
impl Freeze for ParserHealth
impl RefUnwindSafe for ParserHealth
impl Send for ParserHealth
impl Sync for ParserHealth
impl Unpin for ParserHealth
impl UnwindSafe for ParserHealth
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> 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