Optionaloptions: WithSpanOptionsCreates a custom OTel span and returns a SpanHandle that
implements AsyncDisposable.
Use with await using for an ergonomic resource-management syntax.
Note that the span is not the active context span (see
SpanHandle for details). Call SpanHandle.fail in a
catch block to record errors before re-throwing.
Optionaloptions: WithSpanOptions
Wraps
fnin a custom OTel span and returns whateverfnreturns.The span is activated as the current context span via
startActiveSpan, so any child spans created insidefn(e.g. DB queries frominstrumentKnex) will be correctly nested under it. Error handling is automatic — exceptions are recorded and the span is markedERRORbefore re-throwing.