[][src]Attribute Macro zipkin::spanned

#[spanned]

Wraps the execution of a function or method in a span.

Both normal and async methods and functions are supported. The name of the span is specified as an argument to the macro attribute.

Requires the macros Cargo feature.

Examples

#[zipkin::spanned(name = "shave yaks")]
fn shave_some_yaks(yaks: &mut [Yak]) {
    // ...
}

#[zipkin::spanned(name = "asynchronously shave yaks")]
async fn shave_some_other_yaks(yaks: &mut [Yak]) {
    // ...
}

struct Yak;

impl Yak {
    #[zipkin::spanned(name = "shave a yak")]
    fn shave(&mut self) {
        // ...
    }

    #[zipkin::spanned(name = "asynchronously shave a yak")]
    async fn shave_nonblocking(&mut self) {
         // ...
    }
}