# `OpentelemetryStatifier.Config`
[🔗](https://github.com/riddler/opentelemetry_statifier/blob/v0.10.0/lib/opentelemetry_statifier/config.ex#L1)

The validated result of the options `OpentelemetryStatifier.setup/1`,
`OpentelemetryStatifier.Persistence.setup/1` and
`OpentelemetryStatifier.Oban.setup/1` take, carried through
`:telemetry.attach/4` as each handler's `Config` argument (the family's
pattern for setup-time options).

Three keys are recognised:

  * `:record_datamodel_values` - defaults to `false`. When `true`,
    `OpentelemetryStatifier.Attributes` records the datamodel values an
    event carries (`:new_value`, `:prior_value` and `:datamodel`) as
    span-event attributes rendered with `inspect/1`; when `false`, they
    are left out.
  * `:table` - the name of the ETS span table the handlers read and
    write. Defaults to `OpentelemetryStatifier.SpanTable`, the named
    table the `OpentelemetryStatifier.SpanTable` process creates when the
    application starts and sweeps on a timer. Any other name must name a
    table that already exists, created with
    `OpentelemetryStatifier.SpanTable.new_table/1`; the timed sweep runs
    over the default table only.
  * `:adapter_calls` - `:nested_only` (the default) or `:all`. With
    `:nested_only`, an adapter call span is emitted only inside an
    enclosing span; with `:all`, every adapter call span is emitted.
    Only `OpentelemetryStatifier.Persistence.setup/1` reads it.

An unknown key is rejected rather than ignored: a typo'd
`record_datamodel_value` silently doing nothing is exactly the failure
the project's cardinality policy cannot afford.

# `t`

```elixir
@type t() :: %OpentelemetryStatifier.Config{
  adapter_calls: :nested_only | :all,
  record_datamodel_values: boolean(),
  table: atom()
}
```

# `new`

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

Validates a keyword list of setup options into a `t()`.

Returns `{:error, {:invalid_options, :not_a_keyword_list}}` when `opts` is
not even a keyword list, `{:error, {:unknown_options, keys}}` when it
contains keys outside `:record_datamodel_values`, `:table` and
`:adapter_calls`, and
`{:error, {:invalid_option, key, value}}` when a recognised key holds a
value of the wrong shape.

---

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