LevelOps Rust SDK
Ingest SLI events into LevelOps from any Rust application.
Installation
Add to Cargo.toml:
[]
= "0.1"
Quickstart
use ;
use HashMap;
async
Usage
Direct record
// Auto-generated event_id
client.record.await?;
// Explicit event_id for idempotent retries
client.record.await?;
Measure (async closure)
// Auto-generated event_id
client.measure.await?;
// Explicit event_id
client.measure.await?;
Configuration
| Field | Default | Description |
|---|---|---|
api_key |
— | Tenant API key (required) |
sli_id |
— | Target SLI UUID (required) |
base_url |
https://api.levelops.io |
API base URL |
batch_size |
100 |
Flush after N events |
flush_interval |
1s |
Flush every N duration |
Behaviour
event_idauto-generated (Uuid::new_v4()) perrecord()and permeasure()closure exit. Override viaevent_id.timestampauto-set to UTC now if not provided.- Thread-safe buffer (
Mutex) with backgroundtokio::spawnflush task. - Retries on HTTP 429 respecting
Retry-Afterheader (max 3 attempts, exponential backoff). - Async-first API (
tokio).