pub struct MetaCollector { /* private fields */ }Expand description
Accumulates metadata during processing with automatic tracing.
Every addition is traced at the appropriate level:
add_section: DEBUG leveladd_issue: WARN level for warnings, ERROR for errorstimed_section: INFO span with timing
Implementations§
Source§impl MetaCollector
impl MetaCollector
Sourcepub fn add_section<T: Serialize>(&mut self, name: impl Into<String>, data: &T)
pub fn add_section<T: Serialize>(&mut self, name: impl Into<String>, data: &T)
Add a named section with any serializable data. Automatically traces at DEBUG level.
Sourcepub fn merge_section<T: Serialize>(&mut self, name: impl Into<String>, data: &T)
pub fn merge_section<T: Serialize>(&mut self, name: impl Into<String>, data: &T)
Add or merge into a named section. If section exists and both are objects, merges keys.
Sourcepub fn get_section(&self, name: &str) -> Option<&Value>
pub fn get_section(&self, name: &str) -> Option<&Value>
Get a section by name
Sourcepub fn has_section(&self, name: &str) -> bool
pub fn has_section(&self, name: &str) -> bool
Check if a section exists
Sourcepub fn add_issue(&mut self, issue: impl Into<String>)
pub fn add_issue(&mut self, issue: impl Into<String>)
Add an issue. Automatically traces at WARN or ERROR level.
Sourcepub fn add_issues(&mut self, issues: impl IntoIterator<Item = String>)
pub fn add_issues(&mut self, issues: impl IntoIterator<Item = String>)
Add multiple issues
Sourcepub fn has_issues(&self) -> bool
pub fn has_issues(&self) -> bool
Check if there are any issues
Sourcepub fn set_input_rows(&mut self, rows: usize)
pub fn set_input_rows(&mut self, rows: usize)
Set input row count
Sourcepub fn set_output_rows(&mut self, rows: usize)
pub fn set_output_rows(&mut self, rows: usize)
Set output row count
Sourcepub fn input_rows(&self) -> Option<usize>
pub fn input_rows(&self) -> Option<usize>
Get input rows
Sourcepub fn output_rows(&self) -> Option<usize>
pub fn output_rows(&self) -> Option<usize>
Get output rows
Sourcepub fn timed_section(&mut self, name: impl Into<String>) -> TimedSection<'_>
pub fn timed_section(&mut self, name: impl Into<String>) -> TimedSection<'_>
Start a timed section with a tracing span.
Returns a TimedSection that must be finished via .finish() or
.finish_with_data(). The elapsed time is recorded both to tracing
and to the metadata.
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Get elapsed time since collector creation
Sourcepub fn build(self) -> CollectedMeta
pub fn build(self) -> CollectedMeta
Build the final CollectedMeta