BeamConsole.Recorder.Config (beam_console v0.3.0)

Copy Markdown View Source

Validates the hard resource limits used by the in-memory flight recorder.

Defaults keep recording bounded independently of browser count. The :subscribers mode activates recording only while the console has at least one subscriber; :always is an explicit higher-overhead choice.

Summary

Functions

Returns the recorder's conservative default limits.

Loads :beam_console, :recorder application configuration and applies overrides.

Builds recorder configuration from validated keyword overrides.

Builds recorder configuration and raises ArgumentError when it is invalid.

Types

mode()

@type mode() :: :subscribers | :always

t()

@type t() :: %BeamConsole.Recorder.Config{
  byte_limit: pos_integer(),
  chart_points_limit: pos_integer(),
  event_limit: pos_integer(),
  frame_limit: pos_integer(),
  mode: mode(),
  pending_slot_ms: pos_integer(),
  reconciliation_limit: pos_integer(),
  retention_ms: pos_integer(),
  timeline_limit: pos_integer(),
  watch_limit: pos_integer()
}

validation_error()

@type validation_error() ::
  {:invalid_options, term()}
  | {:unknown_options, [atom()]}
  | {atom(), :must_be_positive}
  | {:mode, :must_be_subscribers_or_always}
  | {:reconciliation_limit, :exceeds_watch_limit}
  | {:timeline_limit, :exceeds_event_limit}

Functions

defaults()

@spec defaults() :: t()

Returns the recorder's conservative default limits.

load(overrides \\ [])

@spec load(keyword()) :: t()

Loads :beam_console, :recorder application configuration and applies overrides.

Runtime overrides take precedence over application configuration.

new(options \\ [])

@spec new(keyword()) :: {:ok, t()} | {:error, validation_error()}

Builds recorder configuration from validated keyword overrides.

Unknown fields and internally inconsistent limits return structured errors.

new!(options \\ [])

@spec new!(keyword()) :: t()

Builds recorder configuration and raises ArgumentError when it is invalid.