# `Insider.Recorder.Config`
[🔗](https://github.com/hiivemarkets/insider/blob/v0.1.0/lib/insider/recorder/config.ex#L1)

Validated recorder configuration derived from `Insider.Recorder.start_link/1`
options: event, byte, trigger-window, rate-limit, admission-stall, and
source-share bounds plus the trusted classification binding. Hosts do not
construct it directly.

`admission_stall_ms` (0..5,000, default 1,000): a writer waiting for the
admission lock gives up when the lock has not changed hands for this long,
so a stuck holder fails later writers instead of blocking them; 0 makes a
single attempt. A queue that moves is waited out.

`source_shares` (a map of event source to a whole percentage, at most 16
sources) and `other_share` (the percentage shared by every source not in
the map): each source's reserved share of `max_events` and `max_bytes`,
rounded down. The percentages sum to at most 100. A share reserves room
without holding it: a source may use any room no one else is using, and
only the entries of a source within its share in both events and bytes are
safe from other sources' writes. The default reserves Logger 25%,
Telemetry 15%, Poller 25%, otel 10%, inspection (`"inspect"`) 5%,
SystemMonitor 5%, and every other source together 5%; 10% is reserved by
no one.

# `reservation`

```elixir
@type reservation() :: {0..100, non_neg_integer(), non_neg_integer()}
```

A source group's share as `{percent, reserved_events, reserved_bytes}`.

# `t`

```elixir
@type t() :: %Insider.Recorder.Config{
  admission_stall_ms: non_neg_integer(),
  classification: Insider.Recorder.Classification.Binding.t(),
  clock: (-&gt; integer()),
  group_indexes: %{required(String.t()) =&gt; pos_integer()},
  max_bytes: pos_integer(),
  max_events: pos_integer(),
  max_rate_keys: pos_integer(),
  other_share: 0..100,
  post_trigger_ms: non_neg_integer(),
  pre_trigger_ms: non_neg_integer(),
  rate_limit_count: pos_integer(),
  rate_window_ms: pos_integer(),
  reservations: %{required(String.t()) =&gt; reservation()},
  source_shares: %{required(String.t()) =&gt; 0..100}
}
```

# `default_other_share`

```elixir
@spec default_other_share() :: 0..100
```

The share every source without its own share draws on when none is given.

# `default_source_shares`

```elixir
@spec default_source_shares() :: %{required(String.t()) =&gt; 0..100}
```

The source shares a recorder reserves when none are given.

# `group`

```elixir
@spec group(t(), String.t()) :: String.t()
```

The share group an event source belongs to: the source itself when it has
a share, otherwise `"other"`.

# `new`

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

---

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