Hardcoded random ID generator — the only generator this SDK ships.
Generates non-zero random integers using :rand.uniform/1:
- trace_id: 128-bit (1 to 2^128 - 1)
- span_id: 64-bit (1 to 2^64 - 1)
Spec ref: trace/sdk.md §IdGenerator. The behaviour
abstraction (and a separate Default impl module) was
collapsed because the SDK ships only this generator and
users cannot substitute their own (per minikube-style
scope).
Public API
| Function | Role |
|---|---|
generate_trace_id/0 | SDK (OTel API MUST) — trace/sdk.md §IdGenerator |
generate_span_id/0 | SDK (OTel API MUST) — trace/sdk.md §IdGenerator |
Deferred Development-status features
- Random TraceFlag bit. Spec
trace/api.mdL237-L242 defines bit 1 (0x02) of the W3Ctrace-flagsbyte as the Random flag, set when the IdGenerator produces trace IDs whose lower 7 bytes are random. Spectrace/sdk.mdL902-L912 "IdGenerator randomness" (Status: Development) describes the SDK's responsibility to declare this property. Not implemented —span.excurrently sets only the Sampled bit (0x01) on the in-memorytrace_flags. When stabilised, this module will gain a method describing its randomness profile andspan.exwill set bit 1 accordingly.
References
- OTel Trace SDK §IdGenerator:
opentelemetry-specification/specification/trace/sdk.md
Summary
Functions
SDK (OTel API MUST) — Generates a 64-bit span ID.
SDK (OTel API MUST) — Generates a 128-bit trace ID.
Functions
@spec generate_span_id() :: Otel.Trace.SpanId.t()
SDK (OTel API MUST) — Generates a 64-bit span ID.
@spec generate_trace_id() :: Otel.Trace.TraceId.t()
SDK (OTel API MUST) — Generates a 128-bit trace ID.