Octri

captureEvent

Reports an event that isn't an error, such as a payment that was declined. Events appear in logs and can be searched like errors.

Parameters

messagestringrequired

What happened.

levelchoicedefault: info

debug, info, warning, error or fatal.

timestampstring or datedefault: now

When it happened.

operationIdstring

The operation it belongs to.

methodstring

The HTTP method.

pathstring

The request path.

statusCodenumber

The response status.

latencyMsnumber

How long the request took.

attemptnumber

Which attempt this was, when the call was retried.

requestIdstring

Your own request id.

userobject

Who it happened to, such as { id }. Redacted like everything else.

tagsobject

Your own labels, which you can search by.

contextobject

Anything else worth keeping with the event.

breadcrumbslist

What led up to it, each with message, category, type, level, data and timestamp.

fingerprintstring

Groups events with the same fingerprint into one issue, instead of grouping by message.

traceTraceContext

The request's trace, from traceFromHeader. It links this event to the client SDK's error for the same request. A fresh trace is started without it.

spanIdstring

The span it happened in.

eventIdstringdefault: a random id

Pass your own to make a retried delivery count once.

Example

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

captureEvent("Card declined", {
  level: "warning",
  operationId: "createOrder",
  tags: { gateway: "stripe" },
  context: { declineCode: "insufficient_funds" },
});

In each language

LanguageCall
NodecaptureEvent()
Pythonoctri.capture_event()
Gooctri.CaptureEvent()
RubyOctri.capture_event
JavaOctri.captureEvent()
KotlinOctri.captureEvent()
PHPOctri::captureEvent()
Rustoctri_monitoring::capture_event()
SwiftOctri.captureEvent()
DartOctri.captureEvent()

Python and Ruby take the same options in snake_case, such as operation_id and status_code.