Octri

instrument

Turns every call to some methods of an object into a span. Point it at a database client, a cache or a module once, and every call is traced with no code at the call sites. It changes the object in place and returns it.

Parameters

targetobjectrequired

The object, or its prototype.

methodslist of namesrequired

The methods to trace. A name that isn't a function is skipped.

opstringdefault: server

A category, such as db or cache.

namefunctiondefault: the method's name

Builds each span's name from the method name and the call's arguments.

Example

Node
import { instrument } from "@octri/node";

instrument(pool, ["query"], { op: "db" });
instrument(cache, ["get", "set"], { op: "cache" });

In each language

LanguageCall
Nodeinstrument()
Pythonoctri.instrument()
GoNot available
RubyOctri.instrument
JavaNot available
KotlinNot available
PHPNot available
RustNot available
SwiftNot available
DartNot available

Node also has instrumentFunction(fn, { name, op }), which wraps a single function.