Octri

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

namestringrequired

What the work is, such as users.findById.

opstringdefault: server

A 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

LanguageCall
NodestartSpan()
Pythonoctri.start_span()
Gooctri.StartSpan()
RubyOctri.start_span
JavaNot available
KotlinNot available
PHPNot available
RustNot available
SwiftNot available
DartNot available