ReadonlyspanThe underlying OTel span. Use it to set attributes or add events.
Ends the span. Called automatically when exiting an await using block.
Records an exception and marks the span as errored.
Idempotent — safe to call in a catch block even if the same
error might be reported elsewhere.
Handle returned by the disposable form of withSpan.
Implements
AsyncDisposableso it can be used withawait using:Note: The span created by the disposable form is NOT activated as the current context span (OTel's public API requires a callback scope for context propagation). DB / outbound-HTTP child spans created inside the
await usingblock will be siblings of this span (both children of the enclosing HTTP span) rather than nested under it. Use the callback form ofwithSpanwhen proper nesting is required.