MetrixWire.Application (MetrixWire v0.2.1)

Copy Markdown View Source

The SDK's OTP application. Declared as mod: in mix.exs, so it starts automatically the moment :metrixwire is a dependency of the host app.

On boot it:

  1. resolves MetrixWire.Config (app env + ENV fallbacks),
  2. starts :inets and the :metrixwire httpc profile (transport HTTP client),
  3. starts a Task.Supervisor (fire-and-forget batch sends) and the MetrixWire.Transport GenServer (batching + flushing),
  4. attaches every :telemetry handler.

Result: adding the dep + setting METRIXWIRE_KEY makes Phoenix fully automatic — zero code changes. With no API key the SDK boots in disabled mode (a warning is logged) and attaches nothing, so it's inert.