Expand description

Tools to trace a Future.

FutureExt extends Future with two methods: in_span() and enter_on_poll(). The out-most future must use in_span(), otherwise, the tracing inside the future will be lost.

Example

use minitrace::prelude::*;

let collector = {
    let (root, collector) = Span::root("root");

    // To trace a task
    let task = async {
        async {
            // some work
        }.enter_on_poll("future is polled").await;
    }
    .in_span(Span::enter_with_parent("task", &root));

    runtime.spawn(task);
};

Structs

Traits

An extension trait for Futures that provides tracing instrument adapters.