Octri

captureSpan

报告一个跟踪跨度,时间由你自行测量。具有相同 traceId 的跨度会组成请求的跟踪瀑布图。大多数代码会改用 startSpan 或框架集成,由它们为你填充这些信息。

参数

traceIdstring必填

它所属的跟踪。

spanIdstring必填

此跨度的 ID,为 16 个十六进制字符。

parentSpanIdstring

启动此跨度的父跨度。

namestring必填

它执行的操作,例如 orders.insert。

servicestring

在瀑布图中为其着色的类别,例如 db。

operationIdstring

所属操作。

startTimeISO timestamp必填

开始时间。

endTimeISO timestamp

结束时间。

statuschoice

ok 或 error。

示例

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",
});

各语言中的用法

语言调用
NodecaptureSpan()
Pythonoctri.capture_span()
Gooctri.CaptureSpan()
RubyOctri.capture_span
JavaOctri.captureSpan()
KotlinOctri.captureSpan()
PHPOctri::captureSpan()
Rustoctri_monitoring::capture_span()
SwiftOctri.captureSpan()
DartOctri.captureSpan()