# `Mojentic.Tracer.NullTracer`
[🔗](https://github.com/svetzal/mojentic-ex/blob/v1.5.0/lib/mojentic/tracer/null_tracer.ex#L1)

A no-op implementation of TracerSystem following the Null Object Pattern.

The NullTracer provides the same API as TracerSystem but performs no operations,
eliminating the need for conditional checks in client code. All record methods
return `:ok` but do nothing, and all query methods return empty lists.

## Usage

    # Use the singleton null tracer instance
    alias Mojentic.Tracer

    # Pass to components that optionally accept a tracer
    broker = Broker.new("gpt-4", gateway, tracer: Tracer.null_tracer())

    # All operations are no-ops
    Tracer.null_tracer() |> NullTracer.record_llm_call(...)  # Does nothing
    Tracer.null_tracer() |> NullTracer.get_events()          # Returns []

## Benefits

- Eliminates conditional tracing checks throughout codebase
- Same API as TracerSystem for seamless substitution
- Zero overhead when tracing is disabled
- Cleaner code without `if tracer != nil` checks

# `clear`

```elixir
@spec clear(atom()) :: :ok
```

No-op: Does nothing.

## Examples

    :ok = NullTracer.clear(:null_tracer)

# `disable`

```elixir
@spec disable(atom()) :: :ok
```

No-op: Does nothing.

## Examples

    :ok = NullTracer.disable(:null_tracer)

# `enable`

```elixir
@spec enable(atom()) :: :ok
```

No-op: Does nothing.

## Examples

    :ok = NullTracer.enable(:null_tracer)

# `enabled?`

```elixir
@spec enabled?(atom()) :: false
```

Always returns false.

## Examples

    false = NullTracer.enabled?(:null_tracer)

# `get_events`

```elixir
@spec get_events(
  atom(),
  keyword()
) :: []
```

Always returns an empty list.

## Examples

    [] = NullTracer.get_events(:null_tracer)
    [] = NullTracer.get_events(:null_tracer, event_type: LLMCallTracerEvent)

# `get_last_n_tracer_events`

```elixir
@spec get_last_n_tracer_events(atom(), non_neg_integer(), keyword()) :: []
```

Always returns an empty list.

## Examples

    [] = NullTracer.get_last_n_tracer_events(:null_tracer, 10)

# `record_agent_interaction`

```elixir
@spec record_agent_interaction(
  atom(),
  keyword()
) :: :ok
```

No-op: Does not record the agent interaction.

## Examples

    :ok = NullTracer.record_agent_interaction(:null_tracer,
      from_agent: "A",
      to_agent: "B",
      event_type: "request",
      correlation_id: "abc"
    )

# `record_event`

```elixir
@spec record_event(atom(), Mojentic.Tracer.TracerEvents.TracerEvent.t()) :: :ok
```

No-op: Does not record the event.

## Examples

    event = %TracerEvent{...}
    :ok = NullTracer.record_event(:null_tracer, event)

# `record_llm_call`

```elixir
@spec record_llm_call(
  atom(),
  keyword()
) :: :ok
```

No-op: Does not record the LLM call.

## Examples

    :ok = NullTracer.record_llm_call(:null_tracer,
      model: "gpt-4",
      messages: [],
      correlation_id: "abc"
    )

# `record_llm_response`

```elixir
@spec record_llm_response(
  atom(),
  keyword()
) :: :ok
```

No-op: Does not record the LLM response.

## Examples

    :ok = NullTracer.record_llm_response(:null_tracer,
      model: "gpt-4",
      content: "Hello",
      correlation_id: "abc"
    )

# `record_tool_batch`

```elixir
@spec record_tool_batch(
  atom(),
  keyword()
) :: :ok
```

No-op: Does not record the tool batch.

# `record_tool_call`

```elixir
@spec record_tool_call(
  atom(),
  keyword()
) :: :ok
```

No-op: Does not record the tool call.

## Examples

    :ok = NullTracer.record_tool_call(:null_tracer,
      tool_name: "date_resolver",
      arguments: %{},
      result: "2024-11-15",
      correlation_id: "abc"
    )

---

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