TraceId

zio.blocks.telemetry.TraceId
object TraceId

Utility object for OpenTelemetry TraceId operations.

TraceId is a 128-bit identifier represented as two Long values (hi and lo). Instead of wrapping them in a case class, the hi/lo values are inlined directly into SpanContext for zero heap allocation.

Attributes

Source
TraceId.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
TraceId.type

Members list

Value members

Concrete methods

def fromHex(s: String): Option[(Long, Long)]

Parses a 32-character hexadecimal string into a (hi, lo) pair.

Parses a 32-character hexadecimal string into a (hi, lo) pair.

Returns None if the string is not exactly 32 characters or contains non-hex characters.

Attributes

Source
TraceId.scala
def isValid(hi: Long, lo: Long): Boolean

Checks if a trace ID (hi, lo) pair is valid (not all zeros).

Checks if a trace ID (hi, lo) pair is valid (not all zeros).

Attributes

Source
TraceId.scala
def random(): (Long, Long)

Generates a random valid trace ID as a (hi, lo) pair.

Generates a random valid trace ID as a (hi, lo) pair.

If both hi and lo are zero, regenerates until a valid one is obtained.

Attributes

Source
TraceId.scala
def toByteArray(hi: Long, lo: Long): Array[Byte]

Converts a trace ID to a 16-byte big-endian array.

Converts a trace ID to a 16-byte big-endian array.

Attributes

Source
TraceId.scala
def toHex(hi: Long, lo: Long): String

Converts a trace ID to a 32-character lowercase hexadecimal string.

Converts a trace ID to a 32-character lowercase hexadecimal string.

Attributes

Source
TraceId.scala