View Source opentelemetry_xray_id_generator (opentelemetry_xray v0.7.3)

Generate trace_id and span_id compatible with AWS X-Ray.

The X-Ray trace_id is a 64-bit identifier which is unique within a single trace. The first 32 bits is the timestamp, the remaining 96 bits are random. OpenTelemetry trace_ids are integers, so we combine the time and the unique id into a single 128-bit value.

It is represented in text as three values separated by hyphens. For example, the trace_id {1-5759e988-bd862e3fe1be46a994272793} includes three values: version number 1, the time of the original request in Unix epoch time in hex, and finally a 96-bit identifier for the trace which is globally unique.

https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-traceids https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html https://aws-otel.github.io/docs/getting-started/x-ray#configuring-the-aws-x-ray-exporter

Link to this section Summary

Functions

Generate 64-bit random integer to use as a span id.
Generate 128-bit random integer to use as trace id.

Link to this section Functions

-spec generate_span_id() -> opentelemetry:span_id().
Generate 64-bit random integer to use as a span id.
-spec generate_trace_id() -> opentelemetry:trace_id().
Generate 128-bit random integer to use as trace id.