WardrikCore.Span (wardrik_core v0.1.0-rc.1)

Copy Markdown

A span in a turn's trace.

A turn is the root span. Each of its steps runs in a child span.

Summary

Functions

Starts a span beneath parent.

Starts a new trace.

Returns the span as a W3C traceparent header, for OpenTelemetry.

Types

t()

@type t() :: %WardrikCore.Span{
  id: String.t(),
  parent: String.t() | nil,
  trace: String.t()
}

Functions

child(parent, opts \\ [])

@spec child(t(), keyword()) :: t()

Starts a span beneath parent.

With :key, the span's id is derived from the trace and the key, so it's the same each time. A tool call that runs again after a restart keeps its span this way.

root()

@spec root() :: t()

Starts a new trace.

traceparent(span)

@spec traceparent(t()) :: String.t()

Returns the span as a W3C traceparent header, for OpenTelemetry.

WardrikCore.Span.traceparent(span)
#=> "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"