MetrixWire.Config (MetrixWire v0.2.2)

Copy Markdown View Source

Resolved configuration. Built once at application boot from config :metrixwire, ... merged with ENV fallbacks (METRIXWIRE_KEY, METRIXWIRE_ENDPOINT, METRIXWIRE_ENABLED). Nothing here throws — bad input degrades to a sensible default so instrumentation never breaks the host app.

Held in :persistent_term for lock-free, low-cost reads from the hot path (every telemetry event reads config).

Summary

Functions

Whether the SDK is enabled.

The current config struct (default if not yet loaded).

Build the config from application env + ENV fallbacks and store it. Idempotent — called once at boot. Returns the built struct.

Accept a base URL too: append /ingest when missing.

Types

t()

@type t() :: %MetrixWire.Config{
  api_key: term(),
  capture_source: term(),
  enabled: term(),
  endpoint: term(),
  flush_interval_ms: term(),
  max_batch: term(),
  timeout_ms: term()
}

Functions

enabled?()

Whether the SDK is enabled.

get()

The current config struct (default if not yet loaded).

load()

Build the config from application env + ENV fallbacks and store it. Idempotent — called once at boot. Returns the built struct.

normalize_endpoint(url)

Accept a base URL too: append /ingest when missing.