Skip to main content

Monitor

The Monitor class buffers traces and spans and flushes them to the Adaline API in the background. It follows the OpenTelemetry error handling principle: telemetry failures never propagate to your application. Items that fail after retries are dropped and counted, not stored. Create a Monitor via adaline.init_monitor().

Properties

Methods

log_trace

Creates a new Trace and appends it to the buffer. This is a synchronous method.

Parameters

name
str
required
Display name for the trace.
status
str
default:"unknown"
Trace status (TraceStatus). One of: "success", "failure", "aborted", "cancelled", "pending", "unknown".
session_id
str | None
Optional session identifier for grouping related traces.
reference_id
str | None
Client-side unique identifier. If omitted, a UUID is auto-generated.
tags
list[str] | None
Optional list of string tags.
attributes
dict[str, Any] | None
Optional key-value metadata. Values are wrapped in LogAttributesValue automatically.
Returns: A new Trace instance.

flush

Manually flushes all ready items from the buffer to the API. Sends each ready trace or span concurrently. Successfully sent items are removed from the buffer. Failed items are dropped and counted via dropped_count. Skips if a flush is already in progress. This is an async method.

stop

Stops the background flush loop and cancels the flush task. This is a synchronous method. After calling stop(), no more automatic flushes occur. Call flush() before stop() if you need to send remaining items.

Usage Pattern