TopStats SDK
Rust analytics SDK
A worker-thread design with a level-triggered signal - capture() locks, enqueues and returns. serde/serde_json/ureq are the only dependencies. The topstats-tower and topstats-actix crates wrap it for Axum, hyper and Actix Web.
Install
# crates.io soon; today:
topstats-analytics = { git = "https://github.com/top-stats/analytics-rust-sdk" }Capture your first event
let client = Client::builder(std::env::var("TOPSTATS_API_KEY")?)
.default_source("api")
.build()?;
client.capture("crash_reported", Some(props), CaptureOptions {
actor: Some("device-11".into()),
..Default::default()
});Behaviour you can rely on
- Capture never throws into your code and never blocks on the network - a bounded queue buffers and a background loop batches.
- Retries only 429, 5xx and network failures, with jittered backoff honouring Retry-After; your API key never appears in error output.
- capture never panics; failures surface through the on-error handler.
- Tokio apps hand events over the same bounded queue - no async rewrite, no runtime coupling.