pub struct Metrics {
pub requests_total: AtomicU64,
pub captures_total: AtomicU64,
pub errors_total: AtomicU64,
pub extractions_total: AtomicU64,
pub navigations_total: AtomicU64,
pub active_connections: AtomicU32,
pub active_pages: AtomicU32,
/* private fields */
}Expand description
Metrics collection for ReasonKit Web observability
Thread-safe metrics collector using atomics and RwLocks for high-performance concurrent access.
Fields§
§requests_total: AtomicU64Total number of requests received
captures_total: AtomicU64Total number of captures performed (screenshots, PDFs, etc.)
errors_total: AtomicU64Total number of errors encountered
extractions_total: AtomicU64Total number of successful extractions
Total number of navigation operations
active_connections: AtomicU32Current number of active connections
active_pages: AtomicU32Current number of active browser pages
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Metrics instance
Cannot use const fn due to RwLock containing non-const operations
Sourcepub fn record_request(&self, path: &str, status_code: u16, duration: Duration)
pub fn record_request(&self, path: &str, status_code: u16, duration: Duration)
Record a request with timing information
Sourcepub fn record_capture(&self, format: &str)
pub fn record_capture(&self, format: &str)
Record a browser capture operation
Sourcepub fn record_error(&self, error_type: &str)
pub fn record_error(&self, error_type: &str)
Record an error
Sourcepub fn record_extraction(&self)
pub fn record_extraction(&self)
Record a successful text extraction
Record a navigation
Sourcepub fn inc_active_connections(&self)
pub fn inc_active_connections(&self)
Increment active connections
Sourcepub fn dec_active_connections(&self)
pub fn dec_active_connections(&self)
Decrement active connections
Sourcepub fn inc_active_pages(&self)
pub fn inc_active_pages(&self)
Increment active browser pages
Sourcepub fn dec_active_pages(&self)
pub fn dec_active_pages(&self)
Decrement active browser pages
Sourcepub fn get_request_durations(&self) -> Option<RingBuffer<Duration>>
pub fn get_request_durations(&self) -> Option<RingBuffer<Duration>>
Get current request durations histogram
Sourcepub fn to_prometheus_format(&self) -> String
pub fn to_prometheus_format(&self) -> String
Convert metrics to Prometheus text format
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnwindSafe for Metrics
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> 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>
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