# `Ash.Tracer`
[🔗](https://github.com/ash-project/ash/blob/v3.17.0/lib/ash/tracer/tracer.ex#L5)

A behaviour for implementing tracing for an Ash application.

# `metadata`

```elixir
@type metadata() :: %{
  domain: nil | module(),
  resource: nil | module(),
  actor: term(),
  tenant: term(),
  action: atom(),
  authorize?: boolean()
}
```

# `span_type`

```elixir
@type span_type() ::
  :action
  | :changeset
  | :query
  | :calculate
  | :request_step
  | :change
  | :validation
  | :preparation
  | :custom
  | :notifier
  | :before_transaction
  | :before_action
  | :after_transaction
  | :after_action
  | {:custom, atom()}
```

# `t`

```elixir
@type t() :: module()
```

# `get_span_context`

```elixir
@callback get_span_context() :: term()
```

# `set_error`
*optional* 

```elixir
@callback set_error(Exception.t()) :: :ok
```

# `set_error`
*optional* 

```elixir
@callback set_error(Exception.t(), Keyword.t()) :: :ok
```

# `set_handled_error`
*optional* 

```elixir
@callback set_handled_error(Exception.t(), Keyword.t()) :: :ok
```

# `set_metadata`

```elixir
@callback set_metadata(span_type(), metadata()) :: :ok
```

Set metadata for the current span.

This may be called multiple times per span, and should ideally merge with previous metadata.

# `set_span_context`

```elixir
@callback set_span_context(term()) :: :ok
```

# `start_span`

```elixir
@callback start_span(span_type(), name :: String.t()) :: :ok
```

# `stop_span`

```elixir
@callback stop_span() :: :ok
```

# `trace_type?`
*optional* 

```elixir
@callback trace_type?(atom()) :: boolean()
```

# `get_span_context`

# `set_error`

# `set_error`

# `set_handled_error`

# `set_metadata`

# `set_span_context`

# `span`
*macro* 

# `start_span`

# `stop_span`

# `telemetry_span`
*macro* 

# `trace_type?`

---

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