withSpan
Times a piece of work as a span, and marks it failed if it throws. The same as startSpan, with the finishing done for you. Calls inside it nest under it.
Parameters
namestringrequiredWhat the work is.
fnfunctionrequiredThe work. Its result is returned, and an error it throws is reported on the span and thrown again.
opstringA category, such as db.
Example
Node
import { withSpan } from "@octri/node";
const rows = await withSpan("orders.list", () => db.query(sql), { op: "db" });In each language
| Language | Call |
|---|---|
| Node | withSpan() |
| Python | with octri.span(): |
| Go | octri.WithSpan() |
| Ruby | Not available |
| Java | Not available |
| Kotlin | Not available |
| PHP | Not available |
| Rust | Not available |
| Swift | Not available |
| Dart | Not available |
Related
- Other functions:
init,captureError,captureEvent,captureSpan,traceFromHeader,addScrubFields,setBeforeSend,startSpan,instrument,autoInstrument. - Backend SDKs: installing a runtime and its framework integrations.