Identity, Time, and Order
Every event envelope includes a ULID. At first glance, this appears to be a minor detail. In practice, it determines how the system scales.
Unlike randomly generated identifiers, ULIDs encode time directly. When sorted lexicographically, they appear in chronological order. This allows time-based queries to be executed as simple range scans:
WHERE event_id BETWEEN X AND Y
No secondary index is required.
At millions of events per second, sorting or indexing on every query is not viable. ULIDs eliminate that cost by design.
They also require no coordination. Each service generates identifiers independently. There is no central authority and no bottleneck. In distributed systems, this independence is essential.
SpanForge extends ULIDs with monotonic ordering. When multiple events are created within the same millisecond, their identifiers preserve the exact sequence in which they occurred. This ensures that even high-frequency operations—such as rapid span completions—can be reconstructed precisely.