Installation
Add the SDK as a CMake subdirectory:Quick start
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.TellError if it’s invalid.
Tracking events
Every tracking method takesuser_id as its first parameter. Calls never block or throw — errors go to the optional on_error callback.
Standard event names
The SDK provides typed constants for common events:Super properties
Register properties that get merged into everytrack, group, and revenue call:
Structured logging
Send logs alongside events through the same pipeline. Each log has an RFC 5424 severity level.service parameter defaults to "app" if omitted. 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
TheProps class builds key-value pairs with a chainable API. It writes JSON bytes directly to a buffer — no intermediate allocations.
std::string, const char*, int, int64_t, double, and bool.
Lifecycle
close() before your process exits to avoid losing buffered events. It blocks up to close_timeout (default 5 seconds).
Thread safety
The SDK is fully thread-safe. Internal state is protected bystd::shared_mutex:
Error handling
Construction throws on invalid config:track, identify, log_*, etc.) never throw. Invalid input (empty user ID, event name too long) is reported through the on_error callback:
Advanced
Configuration reference
| Parameter | Default (production) | Default (development) | Description |
|---|---|---|---|
endpoint | collect.tell.rs:50000 | localhost:50000 | TCP collector address |
batch_size | 100 | 10 | Events per batch before auto-flush |
flush_interval | 10s | 2s | Time between auto-flushes |
max_retries | 3 | 3 | Retry attempts on send failure |
close_timeout | 5s | 5s | Max wait on close() |
network_timeout | 30s | 30s | TCP connect/send timeout |
on_error | silent | silent | Error callback |
Validation rules
| Field | Rule |
|---|---|
| API key | 32-character hex string |
| User ID | Non-empty |
| Event name | 1–256 characters |
| Log message | 1–65,536 characters |
| Group ID | Non-empty |
| Revenue amount | Positive number |
| Service | Max 256 characters |
Performance
Caller latency — serialize, encode, and enqueue (Apple M4 Pro):| Operation | Latency |
|---|---|
track (no props) | 85 ns |
track (with props) | 224 ns |
identify | 272 ns |
log | 273 ns |
revenue | 326 ns |
Retry behavior
On TCP send failure, the SDK retries with exponential backoff up tomax_retries attempts. After exhausting retries, the batch is dropped and the error reported via on_error.