TraceContext

org.llm4s.trace.TraceContext
See theTraceContext companion object
@Stable
final case class TraceContext

A position in a distributed trace, in W3C Trace Context terms (design 4.58): the trace (traceId, 32 lowercase hex digits), one span in it (spanId, 16 lowercase hex digits) and whether the trace is sampled. Neither id is all zeros. It is the serializable carrier a caller stores or sends so that work done elsewhere - another thread, another process, another machine - continues the same trace: written as a traceparent header value (traceParent, 00-<traceId>-<spanId>-<flags>) and read back with TraceContext.parse; its JSON form is that string.

Whoever continues a context makes it the remote parent of the span it opens, so that span keeps the context's trace id. A backend that cannot express a parent ignores it.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def spanFor(key: String): TraceContext

The context of the span key names in this trace: the same trace id and sampling, and a span id derived from the trace id and key alone (the first 8 bytes of a SHA-256), so every process that names the same span the same way computes the same id, with no coordination. The new span's parent is whatever its emitter says; it need not be this context's span.

The context of the span key names in this trace: the same trace id and sampling, and a span id derived from the trace id and key alone (the first 8 bytes of a SHA-256), so every process that names the same span the same way computes the same id, with no coordination. The new span's parent is whatever its emitter says; it need not be this context's span.

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def traceParent: String

This context as a W3C traceparent value: version 00, the ids, and flags 01 when sampled, else 00.

This context as a W3C traceparent value: version 00, the ids, and flags 01 when sampled, else 00.

Attributes

def withSampled(s: Boolean): TraceContext

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product