# `Jizoku.Runtime.Trace`
[🔗](https://github.com/dark-trench/jizoku/blob/main/lib/jizoku/runtime/trace.ex#L1)

Durable trace context for Jizoku runtime commands and work.

Trace contexts are persisted as plain atom-key maps. Identifiers follow the
W3C Trace Context sizes and lowercase hexadecimal representation without
depending on process-local tracing state.

# `error`

```elixir
@type error() :: {:invalid_trace, term()}
```

# `t`

```elixir
@type t() :: %{
  :trace_id =&gt; String.t(),
  :span_id =&gt; String.t(),
  optional(:parent_span_id) =&gt; String.t(),
  optional(:causation_id) =&gt; String.t(),
  optional(:tracestate) =&gt; String.t()
}
```

A normalized, version-tolerant durable trace map.

# `child_of`

```elixir
@spec child_of(t() | map(), String.t() | nil) :: {:ok, t()} | {:error, error()}
```

Creates a durable child span from a normalized parent trace.

# `new_root`

```elixir
@spec new_root(keyword()) :: {:ok, t()} | {:error, error()}
```

Creates a new root trace with W3C-compatible identifiers.

# `normalize`

```elixir
@spec normalize(term()) :: {:ok, t()} | {:error, error()}
```

Validates and canonicalizes atom- or string-key trace input.

# `valid?`

```elixir
@spec valid?(term()) :: boolean()
```

Returns whether a value is a valid normalized trace context.

---

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