spandoc
Attribute macro that transforms doc comments in functions into tracing spans
.
Details
All doc comments intended to be transformed into spans must begin with SPANDOC:
:
use spandoc;
use info;
The spans that are created by spandoc are explicitly scoped to the expression they're associated with.
use spandoc;
use info;
Running the above example will produce the following output
Local variables can be associated with the generated spans by adding a
trailing block to the doc comment. The syntax for fields in the span is the
same as in tracing
.
use spandoc;
use info;
When applied to expressions that contain await
s spandoc will correctly
use instrument()
and exit/enter the span when suspending and resuming the
future. If there are multiple await expressions inside of the annotated
expression it will instrument each expression with the same span. The macro
will not recurse into async
blocks.
use Future;
use spandoc;
use info;
async
async