# `WardrikCore.Span`

A span in a turn's trace.

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

# `t`

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

# `child`

```elixir
@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`

```elixir
@spec root() :: t()
```

Starts a new trace.

# `traceparent`

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

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
