OpentelemetryStatifier.Config (OpentelemetryStatifier v0.10.0)

Copy Markdown View Source

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:

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.

Summary

Functions

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

Types

t()

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

Functions

new(opts)

@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.