# `Tinkex.Telemetry.Reporter.Queue`
[🔗](https://github.com/North-Shore-AI/tinkex/blob/v0.4.0/lib/tinkex/telemetry/reporter/queue.ex#L1)

Queue operations for telemetry events.

Manages enqueueing, dequeueing, and size tracking of telemetry events
with overflow protection.

# `drain_queue`

```elixir
@spec drain_queue(map()) :: {list(), map()}
```

Drain the queue and return all events as a list.

Returns `{events, updated_state}` where the queue is now empty
and flush_counter is incremented by the number of events.

# `enqueue_event`

```elixir
@spec enqueue_event(map(), term()) :: {map(), boolean()}
```

Enqueue an event to the queue.

Returns `{state, true}` if accepted, `{state, false}` if queue is full.
Increments the push_counter when an event is enqueued.

# `maybe_request_flush`

```elixir
@spec maybe_request_flush(map()) :: map()
```

Check if flush should be requested based on queue size vs threshold.

# `maybe_schedule_flush`

```elixir
@spec maybe_schedule_flush(map()) :: map()
```

Schedule the next flush timer.

# `wait_until_drained`

```elixir
@spec wait_until_drained(map(), timeout()) :: boolean()
```

Wait until push_counter == flush_counter or timeout.

Returns `true` if drained within timeout, `false` otherwise.

---

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