Octri

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

namestringrequired

What the work is.

fnfunctionrequired

The work. Its result is returned, and an error it throws is reported on the span and thrown again.

opstringdefault: server

A 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

LanguageCall
NodewithSpan()
Pythonwith octri.span():
Gooctri.WithSpan()
RubyNot available
JavaNot available
KotlinNot available
PHPNot available
RustNot available
SwiftNot available
DartNot available