pub struct SpanCollector {
pub capture_span_for_reports_with_children: bool,
}Expand description
Attachment collector for capturing tracing spans.
When registered as a report creation hook, this collector automatically
captures the current tracing span and attaches it as a Span attachment.
§Examples
Basic usage with default settings:
use rootcause::hooks::Hooks;
use rootcause_tracing::SpanCollector;
Hooks::new()
.report_creation_hook(SpanCollector::new())
.install()
.expect("failed to install hooks");Custom configuration:
use rootcause::hooks::Hooks;
use rootcause_tracing::SpanCollector;
let collector = SpanCollector {
capture_span_for_reports_with_children: true,
};
Hooks::new()
.report_creation_hook(collector)
.install()
.expect("failed to install hooks");Fields§
§capture_span_for_reports_with_children: boolWhether to capture spans for all reports or only leaf reports (those without children).
When true, all reports get span attachments. When false, only leaf
reports do.
Implementations§
Source§impl SpanCollector
impl SpanCollector
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SpanCollector with default settings.
Configuration is controlled by environment variables.
§Environment Variables
ROOTCAUSE_TRACING- Comma-separated options:leafs- Only capture tracing spans for leaf errors (errors without children)
§Examples
use rootcause::hooks::Hooks;
use rootcause_tracing::SpanCollector;
// Respects ROOTCAUSE_TRACING environment variable
Hooks::new()
.report_creation_hook(SpanCollector::new())
.install()
.expect("failed to install hooks");Trait Implementations§
Source§impl Clone for SpanCollector
impl Clone for SpanCollector
Source§fn clone(&self) -> SpanCollector
fn clone(&self) -> SpanCollector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for SpanCollector
impl Default for SpanCollector
Source§impl ReportCreationHook for SpanCollector
impl ReportCreationHook for SpanCollector
impl Copy for SpanCollector
Auto Trait Implementations§
impl Freeze for SpanCollector
impl RefUnwindSafe for SpanCollector
impl Send for SpanCollector
impl Sync for SpanCollector
impl Unpin for SpanCollector
impl UnwindSafe for SpanCollector
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
Mutably borrows from an owned value. Read more