Tell Rust SDK
Rust SDK for Tell — product analytics and structured logging, 1,000× faster than PostHog and Mixpanel.
- 80 ns per call. Serializes, encodes, and enqueues. Your thread moves on.
- 10M events/sec delivered. Batched, encoded, sent over the wire.
- Fire & forget. Synchronous API, async background worker. Zero I/O blocking.
- Thread-safe.
Clone + Send + Sync. Share across threads viaArc.
Installation
Quick Start
use ;
async
Performance
Delivery throughput — batched, encoded, and sent over TCP (Apple M4 Pro):
| Batch size | With payload | No payload |
|---|---|---|
| 10 | 7.8M/s | 14.5M/s |
| 100 | 8.3M/s | 14.3M/s |
| 500 | 9.8M/s | 18.2M/s |
Each event is 200 bytes on the wire — device ID, session ID, timestamp, event name, and user properties, FlatBuffer-encoded with API key and batch headers.
Caller latency — serialize, encode, and enqueue. Wire-ready before your function returns:
| Operation | With properties | No properties |
|---|---|---|
track |
84 ns | 52 ns |
log |
76 ns | 50 ns |
PostHog and Mixpanel send an HTTP request on every track call — ~85 µs on localhost, milliseconds in production. Tell enqueues a wire-ready event in 84 ns — 1,000× less overhead. Your thread never touches the network.
For comparison, FlashLog achieves ~16 ns by copying raw bytes into a ring buffer — serialization and I/O happen later. Tell pays upfront for a wire-ready event.
Configuration
use TellConfig;
// Production — collect.tell.rs:50000, batch=100, flush=10s
let config = production.unwrap;
// Development — localhost:50000, batch=10, flush=2s
let config = development.unwrap;
// Custom — see examples/config.rs for all builder options
let config = builder
.endpoint
.on_error
.build
.unwrap;
API
Tell is Clone + Send + Sync. Cloning is cheap (internally Arc).
let client = new?;
// Events — user_id is always the first parameter
client.track;
client.identify;
client.group;
client.revenue;
client.alias;
// Super properties — merged into every track/group/revenue call
client.register;
client.unregister;
// Logging
client.log;
client.log_info;
client.log_error;
// + log_emergency, log_alert, log_critical, log_warning,
// log_notice, log_debug, log_trace
// Lifecycle
client.reset_session;
client.flush.await?;
client.close.await?;
Properties accept props!, Props::new(), Option<impl Serialize>, or None::<serde_json::Value>:
use ;
// props! macro — fastest path
client.track;
// Props builder — for dynamic values
let p = new
.add
.add;
client.track;
// serde_json — works with any Serialize type
client.track;
// No properties
client.track;
Requirements
- Rust: 2024 edition
- Runtime: Tokio 1.x
License
MIT