startSpan
Opens a span inside the current request, for you to finish when the work is done. The span sits under the request's own span in the waterfall. Outside a request, or before init, it returns a handle that does nothing.
Parameters
namestringrequiredWhat the work is, such as users.findById.
opstringA category that colours it in the waterfall, such as db, cache or http.
Returns
A handle. Call finish() when the work is done, with "error" if it failed. A second finish() does nothing.
Example
Node
import { startSpan } from "@octri/node";
const span = startSpan("users.findById", { op: "db" });
const user = await db.user.find(id);
span.finish();In each language
| Language | Call |
|---|---|
| Node | startSpan() |
| Python | octri.start_span() |
| Go | octri.StartSpan() |
| Ruby | Octri.start_span |
| 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,withSpan,instrument,autoInstrument. - Backend SDKs: installing a runtime and its framework integrations.