ProcessingMetrics

Struct ProcessingMetrics 

Source
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 Instant for accuracy
  • Throughput calculations are performed on-demand
  • Memory usage scales with the number of tracked stages
  • Serialization excludes Instant fields for compatibility
  • Real-time updates have minimal performance overhead

Implementations§

Source§

impl ProcessingMetrics

Source

pub fn new(bytes_total: u64, chunks_total: u64) -> Self

Creates new processing metrics

Source

pub fn start(&mut self)

Starts the processing timer

Source

pub fn end(&mut self)

Ends the processing timer

Source

pub fn update_bytes_processed(&mut self, bytes: u64)

Updates bytes processed

Source

pub fn add_bytes_processed(&mut self, bytes: u64)

Adds bytes processed

Source

pub fn update_chunks_processed(&mut self, chunks: u64)

Updates chunks processed

Source

pub fn add_chunks_processed(&mut self, chunks: u64)

Adds chunks processed

Source

pub fn set_compression_ratio(&mut self, ratio: f64)

Sets the compression ratio

Source

pub fn increment_errors(&mut self)

Increments error count

Source

pub fn increment_warnings(&mut self)

Increments warning count

Source

pub fn add_stage_metrics(&mut self, metrics: StageMetrics)

Adds stage metrics

Source

pub fn bytes_processed(&self) -> u64

Gets bytes processed

Source

pub fn bytes_total(&self) -> u64

Gets total bytes

Source

pub fn chunks_processed(&self) -> u64

Gets chunks processed

Source

pub fn chunks_total(&self) -> u64

Gets total chunks

Source

pub fn processing_duration(&self) -> Option<Duration>

Gets processing duration

Source

pub fn start_time(&self) -> Option<DateTime<Utc>>

Gets start time as DateTime<Utc>

Source

pub fn end_time(&self) -> Option<DateTime<Utc>>

Gets end time as DateTime<Utc>

Source

pub fn throughput_bytes_per_second(&self) -> f64

Gets throughput in bytes per second

Source

pub fn throughput_mb_per_second(&self) -> f64

Gets throughput in MB/s

Source

pub fn compression_ratio(&self) -> Option<f64>

Gets compression ratio

Source

pub fn error_count(&self) -> u64

Gets error count

Source

pub fn warning_count(&self) -> u64

Gets warning count

Source

pub fn stage_metrics(&self) -> &HashMap<String, StageMetrics>

Gets stage metrics

Source

pub fn input_file_size_bytes(&self) -> u64

Gets input file size in bytes

Source

pub fn output_file_size_bytes(&self) -> u64

Gets output file size in bytes

Source

pub fn input_file_size_mib(&self) -> f64

Gets input file size in MiB

Source

pub fn output_file_size_mib(&self) -> f64

Gets output file size in MiB

Source

pub fn input_file_checksum(&self) -> &Option<String>

Gets input file checksum

Source

pub fn output_file_checksum(&self) -> &Option<String>

Gets output file checksum

Source

pub fn progress_percentage(&self) -> f64

Calculates processing progress as percentage

Source

pub fn chunk_progress_percentage(&self) -> f64

Calculates chunk progress as percentage

Source

pub fn estimated_remaining_time(&self) -> Option<Duration>

Estimates remaining time

Source

pub fn is_complete(&self) -> bool

Checks if processing is complete

Source

pub fn success_rate(&self) -> f64

Calculates overall success rate

Source

pub fn set_input_file_info(&mut self, size_bytes: u64, checksum: Option<String>)

Sets input file size and checksum

Source

pub fn set_output_file_info( &mut self, size_bytes: u64, checksum: Option<String>, )

Sets output file size and checksum

Source

pub fn merge(&mut self, other: &ProcessingMetrics)

Merges metrics from another instance

Trait Implementations§

Source§

impl Clone for ProcessingMetrics

Source§

fn clone(&self) -> ProcessingMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessingMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProcessingMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ProcessingMetrics

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ProcessingMetrics

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,