Skip to main content

Tracing

Trait Tracing 

Source
pub trait Tracing: Supervisor {
    // Required method
    fn with_span(self) -> Self;
}
Expand description

Interface to register task traces.

Required Methods§

Source

fn with_span(self) -> Self

Return a context that wraps the next spawned task in a tracing span.

The span’s name field and OpenTelemetry attributes are derived from Supervisor::name. The flag is consumed by the next Spawner::spawn call on the returned context.

Supervisor::child creates a new child context and does not inherit the span flag. Supervisor::with_attribute, Spawner::shared, and Spawner::dedicated keep operating on the same handle, so they can be chained before the spawn:

context
    .child("verify")
    .with_attribute("round", round)
    .with_span()
    .dedicated()
    .spawn(|context| async move {
        // work
    });

Enabling the span only affects tracing. It does not change which metrics are registered, nor does it widen the cardinality of runtime task metrics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Tracing for commonware_runtime::deterministic::Context

Source§

impl Tracing for commonware_runtime::tokio::Context