Skip to main content
The Rust SDK sends events and structured logs from your backend services to Tell. It’s a server SDK — you create a client, pass a user ID on every call, and a background worker handles batching and delivery over TCP. Your thread does about 80 ns of work per call (serialize, encode, enqueue) and never touches the network.

Installation

The SDK requires Rust 2024 edition and a Tokio runtime.

Quick start

That’s a working setup. The client connects to collect.tell.rs:50000, batches up to 100 events, and flushes every 10 seconds or when you call close().

Configuration

Use one of the two presets, or build a custom config.
For custom settings, use the builder:
The API key must be a 32-character hex string. The SDK validates it at config time and returns an error if it’s invalid.

Tracking events

Every tracking method takes user_id as its first parameter. Calls never block or panic — errors go to the optional on_error callback.

Standard event names

The SDK provides typed constants for common events so you don’t have to remember exact strings:
Constants are available for user lifecycle, revenue, subscriptions, trials, shopping, engagement, and communication events. Custom string names are always accepted too.

Super properties

Register properties that get merged into every track, group, and revenue call:
Event-specific properties override super properties when keys conflict.

Structured logging

Send logs alongside events through the same pipeline. Each log has an RFC 5424 severity level.
The service parameter is optional — pass None to default to "app". Convenience methods are available for all nine levels: log_emergency, log_alert, log_critical, log_error, log_warning, log_notice, log_info, log_debug, and log_trace. You can also use the generic log method with an explicit level:

Properties

You have three ways to pass properties:
Props and props! write JSON bytes directly to a buffer, skipping the intermediate serde_json::Value allocation. Use them on hot paths.

Lifecycle

Always call close() before your process exits to avoid losing buffered events. It blocks up to close_timeout (default 5 seconds).

Sharing across threads

Tell is Clone + Send + Sync. Internally it wraps everything in an Arc, so cloning is cheap:

Error handling

The constructor and lifecycle methods return Result:
Tracking and logging calls (track, identify, log_*, etc.) never return errors. Invalid input (empty user ID, event name too long) is reported through the on_error callback:

Advanced

Configuration reference

Validation rules

Retry behavior

On TCP send failure, the SDK retries with exponential backoff: 1s initial delay, 1.5x multiplier, 20% jitter, capped at 30s. After max_retries attempts, the batch is dropped and the error reported via on_error.