Skip to main content

SpanExt

Trait SpanExt 

Source
pub trait SpanExt {
    // Required method
    fn operation(&self) -> Operation;

    // Provided method
    fn start_operation(
        &self,
        id: impl AsRef<str>,
        producer: Option<impl AsRef<str>>,
    ) -> Operation { ... }
}
Expand description

This trait extends tracing::Span with additional functionality provided by this crate.

You should not implement this trait yourself, but I also cannot stop you.

Required Methods§

Source

fn operation(&self) -> Operation

Retrieves an Operation associated with this Span. If one does not already exist, it will be created automatically.

This method is safe to call when this crate’s Layer is not available, e.g. in a development environment. In this case, the returned Operation will not perform any actions.

Provided Methods§

Source

fn start_operation( &self, id: impl AsRef<str>, producer: Option<impl AsRef<str>>, ) -> Operation

A simple wrapper over Operation::init to make creating them a bit nicer.

let op = span.start_operation("id", Some("provider"));

The above is equivalent to:

let op = span.operation();
op.init(OperationInfo::new("id", Some("provider")));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SpanExt for Span

Implementors§