pub struct ProcessingMetrics { /* private fields */ }Expand description
Processing metrics entity for comprehensive performance tracking and analysis.
ProcessingMetrics collects and maintains detailed performance data
throughout pipeline execution. It provides real-time insights into
processing speed, resource utilization, error rates, and overall operational
health.
§Metrics Categories
§Processing Progress
- Bytes Processed: Total data processed and remaining
- Chunks Processed: Number of data chunks completed
- Completion Status: Progress percentage and estimated time remaining
§Performance Metrics
- Throughput: Bytes per second and MB/s processing rates
- Duration: Total processing time and stage-specific timings
- Efficiency: Success rates and error statistics
§File Information
- Input/Output Sizes: File sizes before and after processing
- Checksums: Integrity verification data
- Compression Ratios: Data reduction achieved
§Stage Analytics
- Individual Stage Performance: Per-stage timing and throughput
- Resource Usage: Memory and CPU consumption by stage
- Error Tracking: Stage-specific error and warning counts
§Usage Examples
§Basic Metrics Tracking
§Complete Processing Workflow
§Error and Warning Tracking
§Time Estimation
§Merging Metrics from Multiple Sources
§Serialization and Persistence
Metrics support serialization for logging and analysis:
§Performance Considerations
- High-resolution timing uses
Instantfor accuracy - Throughput calculations are performed on-demand
- Memory usage scales with the number of tracked stages
- Serialization excludes
Instantfields for compatibility - Real-time updates have minimal performance overhead
Implementations§
Source§impl ProcessingMetrics
impl ProcessingMetrics
Sourcepub fn update_bytes_processed(&mut self, bytes: u64)
pub fn update_bytes_processed(&mut self, bytes: u64)
Updates bytes processed
Sourcepub fn add_bytes_processed(&mut self, bytes: u64)
pub fn add_bytes_processed(&mut self, bytes: u64)
Adds bytes processed
Sourcepub fn update_chunks_processed(&mut self, chunks: u64)
pub fn update_chunks_processed(&mut self, chunks: u64)
Updates chunks processed
Sourcepub fn add_chunks_processed(&mut self, chunks: u64)
pub fn add_chunks_processed(&mut self, chunks: u64)
Adds chunks processed
Sourcepub fn set_compression_ratio(&mut self, ratio: f64)
pub fn set_compression_ratio(&mut self, ratio: f64)
Sets the compression ratio
Sourcepub fn increment_errors(&mut self)
pub fn increment_errors(&mut self)
Increments error count
Sourcepub fn increment_warnings(&mut self)
pub fn increment_warnings(&mut self)
Increments warning count
Sourcepub fn add_stage_metrics(&mut self, metrics: StageMetrics)
pub fn add_stage_metrics(&mut self, metrics: StageMetrics)
Adds stage metrics
Sourcepub fn bytes_processed(&self) -> u64
pub fn bytes_processed(&self) -> u64
Gets bytes processed
Sourcepub fn bytes_total(&self) -> u64
pub fn bytes_total(&self) -> u64
Gets total bytes
Sourcepub fn chunks_processed(&self) -> u64
pub fn chunks_processed(&self) -> u64
Gets chunks processed
Sourcepub fn chunks_total(&self) -> u64
pub fn chunks_total(&self) -> u64
Gets total chunks
Sourcepub fn processing_duration(&self) -> Option<Duration>
pub fn processing_duration(&self) -> Option<Duration>
Gets processing duration
Sourcepub fn start_time(&self) -> Option<DateTime<Utc>>
pub fn start_time(&self) -> Option<DateTime<Utc>>
Gets start time as DateTime<Utc>
Sourcepub fn throughput_bytes_per_second(&self) -> f64
pub fn throughput_bytes_per_second(&self) -> f64
Gets throughput in bytes per second
Sourcepub fn throughput_mb_per_second(&self) -> f64
pub fn throughput_mb_per_second(&self) -> f64
Gets throughput in MB/s
Sourcepub fn compression_ratio(&self) -> Option<f64>
pub fn compression_ratio(&self) -> Option<f64>
Gets compression ratio
Sourcepub fn error_count(&self) -> u64
pub fn error_count(&self) -> u64
Gets error count
Sourcepub fn warning_count(&self) -> u64
pub fn warning_count(&self) -> u64
Gets warning count
Sourcepub fn stage_metrics(&self) -> &HashMap<String, StageMetrics>
pub fn stage_metrics(&self) -> &HashMap<String, StageMetrics>
Gets stage metrics
Sourcepub fn input_file_size_bytes(&self) -> u64
pub fn input_file_size_bytes(&self) -> u64
Gets input file size in bytes
Sourcepub fn output_file_size_bytes(&self) -> u64
pub fn output_file_size_bytes(&self) -> u64
Gets output file size in bytes
Sourcepub fn input_file_size_mib(&self) -> f64
pub fn input_file_size_mib(&self) -> f64
Gets input file size in MiB
Sourcepub fn output_file_size_mib(&self) -> f64
pub fn output_file_size_mib(&self) -> f64
Gets output file size in MiB
Sourcepub fn input_file_checksum(&self) -> &Option<String>
pub fn input_file_checksum(&self) -> &Option<String>
Gets input file checksum
Sourcepub fn output_file_checksum(&self) -> &Option<String>
pub fn output_file_checksum(&self) -> &Option<String>
Gets output file checksum
Sourcepub fn progress_percentage(&self) -> f64
pub fn progress_percentage(&self) -> f64
Calculates processing progress as percentage
Sourcepub fn chunk_progress_percentage(&self) -> f64
pub fn chunk_progress_percentage(&self) -> f64
Calculates chunk progress as percentage
Sourcepub fn estimated_remaining_time(&self) -> Option<Duration>
pub fn estimated_remaining_time(&self) -> Option<Duration>
Estimates remaining time
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Checks if processing is complete
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculates overall success rate
Sourcepub fn set_input_file_info(&mut self, size_bytes: u64, checksum: Option<String>)
pub fn set_input_file_info(&mut self, size_bytes: u64, checksum: Option<String>)
Sets input file size and checksum
Sourcepub fn set_output_file_info(
&mut self,
size_bytes: u64,
checksum: Option<String>,
)
pub fn set_output_file_info( &mut self, size_bytes: u64, checksum: Option<String>, )
Sets output file size and checksum
Sourcepub fn merge(&mut self, other: &ProcessingMetrics)
pub fn merge(&mut self, other: &ProcessingMetrics)
Merges metrics from another instance
Trait Implementations§
Source§impl Clone for ProcessingMetrics
impl Clone for ProcessingMetrics
Source§fn clone(&self) -> ProcessingMetrics
fn clone(&self) -> ProcessingMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessingMetrics
impl Debug for ProcessingMetrics
Source§impl Default for ProcessingMetrics
impl Default for ProcessingMetrics
Source§impl<'de> Deserialize<'de> for ProcessingMetrics
impl<'de> Deserialize<'de> for ProcessingMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ProcessingMetrics
impl RefUnwindSafe for ProcessingMetrics
impl Send for ProcessingMetrics
impl Sync for ProcessingMetrics
impl Unpin 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> 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