pub struct ProcessingMetrics { /* private fields */ }Expand description
Metrics collector for tracking processing performance and statistics
Thread-safe metrics tracking for queries, document processing, batches, rate limiting, and system resource usage. Uses atomic operations for counters and locks for duration collections.
Implementations§
Source§impl ProcessingMetrics
impl ProcessingMetrics
Sourcepub fn increment_query_started(&self)
pub fn increment_query_started(&self)
Increments the counter for queries started
Sourcepub fn increment_query_success(&self)
pub fn increment_query_success(&self)
Increments the counter for successfully completed queries
Sourcepub fn increment_query_error(&self)
pub fn increment_query_error(&self)
Increments the counter for failed queries
Sourcepub fn record_query_duration(&self, duration: Duration)
pub fn record_query_duration(&self, duration: Duration)
Records the execution duration of a query
Keeps only the most recent 1000 measurements to prevent unbounded memory growth.
§Parameters
duration: Time taken to execute the query
Sourcepub fn increment_document_processing_started(&self)
pub fn increment_document_processing_started(&self)
Increments the counter for document processing operations started
Sourcepub fn increment_document_processing_success(&self)
pub fn increment_document_processing_success(&self)
Increments the counter for successfully processed documents
Sourcepub fn increment_document_processing_error(&self)
pub fn increment_document_processing_error(&self)
Increments the counter for failed document processing operations
Sourcepub fn record_document_processing_duration(&self, duration: Duration)
pub fn record_document_processing_duration(&self, duration: Duration)
Records the processing duration of a document
Keeps only the most recent 1000 measurements to prevent unbounded memory growth.
§Parameters
duration: Time taken to process the document
Sourcepub fn increment_batch_processing_started(&self)
pub fn increment_batch_processing_started(&self)
Increments the counter for batch processing operations started
Sourcepub fn record_batch_processing_duration(&self, duration: Duration)
pub fn record_batch_processing_duration(&self, duration: Duration)
Records the processing duration of a batch
Keeps only the most recent 100 measurements to prevent unbounded memory growth.
§Parameters
duration: Time taken to process the batch
Sourcepub fn increment_rate_limit_errors(&self)
pub fn increment_rate_limit_errors(&self)
Increments the counter for rate limiting errors
Sourcepub fn update_peak_memory_usage(&self, memory_bytes: u64)
pub fn update_peak_memory_usage(&self, memory_bytes: u64)
Updates peak memory usage if the new value exceeds the current peak
§Parameters
memory_bytes: Current memory usage in bytes
Sourcepub fn get_queries_started(&self) -> usize
pub fn get_queries_started(&self) -> usize
Returns the number of queries started
Sourcepub fn get_queries_succeeded(&self) -> usize
pub fn get_queries_succeeded(&self) -> usize
Returns the number of queries that succeeded
Sourcepub fn get_queries_failed(&self) -> usize
pub fn get_queries_failed(&self) -> usize
Returns the number of queries that failed
Sourcepub fn get_documents_started(&self) -> usize
pub fn get_documents_started(&self) -> usize
Returns the number of document processing operations started
Sourcepub fn get_documents_succeeded(&self) -> usize
pub fn get_documents_succeeded(&self) -> usize
Returns the number of documents processed successfully
Sourcepub fn get_documents_failed(&self) -> usize
pub fn get_documents_failed(&self) -> usize
Returns the number of document processing operations that failed
Sourcepub fn get_batches_started(&self) -> usize
pub fn get_batches_started(&self) -> usize
Returns the number of batch processing operations started
Sourcepub fn get_rate_limit_errors(&self) -> usize
pub fn get_rate_limit_errors(&self) -> usize
Returns the number of rate limiting errors encountered
Sourcepub fn get_peak_memory_usage(&self) -> u64
pub fn get_peak_memory_usage(&self) -> u64
Returns the peak memory usage observed in bytes
Sourcepub fn get_uptime(&self) -> Duration
pub fn get_uptime(&self) -> Duration
Returns the time elapsed since metrics tracking started
Sourcepub fn get_average_query_duration(&self) -> Option<Duration>
pub fn get_average_query_duration(&self) -> Option<Duration>
Calculates the average query execution duration
§Returns
Average duration if queries have been recorded, None otherwise
Sourcepub fn get_average_document_duration(&self) -> Option<Duration>
pub fn get_average_document_duration(&self) -> Option<Duration>
Calculates the average document processing duration
§Returns
Average duration if documents have been processed, None otherwise
Sourcepub fn get_query_success_rate(&self) -> f64
pub fn get_query_success_rate(&self) -> f64
Calculates the query success rate
§Returns
Ratio of successful queries to total queries (0.0-1.0), or 1.0 if no queries
Sourcepub fn get_document_success_rate(&self) -> f64
pub fn get_document_success_rate(&self) -> f64
Calculates the document processing success rate
§Returns
Ratio of successful documents to total documents (0.0-1.0), or 1.0 if no documents
Sourcepub fn get_summary(&self) -> MetricsSummary
pub fn get_summary(&self) -> MetricsSummary
Generates a comprehensive summary of all metrics
§Returns
Structured summary containing query, document, and system metrics
Sourcepub fn print_summary(&self)
pub fn print_summary(&self)
Prints a formatted summary of all metrics to the log
Trait Implementations§
Source§impl Debug for ProcessingMetrics
impl Debug for ProcessingMetrics
Auto Trait Implementations§
impl !Freeze for ProcessingMetrics
impl RefUnwindSafe for ProcessingMetrics
impl Send for ProcessingMetrics
impl Sync for ProcessingMetrics
impl Unpin for ProcessingMetrics
impl UnsafeUnpin for ProcessingMetrics
impl UnwindSafe for ProcessingMetrics
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