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 viaadaline.init_monitor().
Properties
| Property | Type | Description |
|---|---|---|
buffer | list | Entries waiting to be flushed. Each item is a BufferedEntry with ready, data, and category keys. |
sent_count | int | Total number of items successfully sent to the API. Starts at 0. |
dropped_count | int | Total number of items dropped due to errors or buffer overflow. Starts at 0. |
default_content | LogSpanContent | Fallback span content when none is provided. Defaults to LogSpanOtherContent(type="Other", input="{}", output="{}"). |
flush_interval_seconds | int | Seconds between automatic background flushes. |
max_buffer_size | int | Maximum buffered items before oldest entries are dropped. |
project_id | str | The project ID associated with this monitor. |
Methods
log_trace
Creates a new Trace and appends it to the buffer. This is a synchronous method.Parameters
Display name for the trace.
Trace status (
TraceStatus). One of: "success", "failure", "aborted", "cancelled", "pending", "unknown".Optional session identifier for grouping related traces.
Client-side unique identifier. If omitted, a UUID is auto-generated.
Optional list of string tags.
Optional key-value metadata. Values are wrapped in
LogAttributesValue automatically.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 viadropped_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 callingstop(), no more automatic flushes occur. Call flush() before stop() if you need to send remaining items.