captureSpan
Reports one span of a trace, with times you measured yourself. Spans with the same traceId form a request's trace waterfall. Most code uses startSpan or the framework integrations instead, which fill these in for you.
Parameters
traceIdstringrequiredThe trace it belongs to.
spanIdstringrequiredThis span's id, 16 hex characters.
parentSpanIdstringThe span that started this one.
namestringrequiredWhat it was, such as orders.insert.
servicestringA category that colours it in the waterfall, such as db.
operationIdstringThe operation it belongs to.
startTimeISO timestamprequiredWhen it started.
endTimeISO timestampWhen it ended.
statuschoiceok or error.
Example
Node
import { captureSpan, newSpanId } from "@octri/node";
captureSpan({
traceId: trace.traceId,
spanId: newSpanId(),
parentSpanId: trace.parentSpanId,
name: "invoice.render",
service: "pdf",
startTime: started.toISOString(),
endTime: new Date().toISOString(),
status: "ok",
});In each language
| Language | Call |
|---|---|
| Node | captureSpan() |
| Python | octri.capture_span() |
| Go | octri.CaptureSpan() |
| Ruby | Octri.capture_span |
| Java | Octri.captureSpan() |
| Kotlin | Octri.captureSpan() |
| PHP | Octri::captureSpan() |
| Rust | octri_monitoring::capture_span() |
| Swift | Octri.captureSpan() |
| Dart | Octri.captureSpan() |
Related
- Other functions:
init,captureError,captureEvent,traceFromHeader,addScrubFields,setBeforeSend,startSpan,withSpan,instrument,autoInstrument. - Backend SDKs: installing a runtime and its framework integrations.