API Reference MetrixWire v#0.2.4

Copy Markdown View Source

Modules

Zero-config APM SDK for Elixir.

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.

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.

Process-dictionary holder for the "current trace".

Best-effort file:line of the application frame that issued a span, so the dashboard can point at the line that ran a query / HTTP call.

Minimal, dependency-free JSON encoder — a fallback used only when neither the built-in JSON module (OTP 27+/Elixir 1.18+) nor Jason is available.

Drop-in Plug for bare Plug apps (no Phoenix). Add one line to your pipeline

A single unit of work within a trace (db_query | http_call | custom). Users never build these — instrumentation creates them. Serialized to the exact ingest wire shape.

The single set of :telemetry handlers that instruments the whole Elixir ecosystem. Attached once at boot by MetrixWire.Application via :telemetry.attach_many/4, so no framework code changes are needed.

One request / unit of work. Holds its spans and trace-level meta. Serialized to the exact ingest wire shape. Not part of any public API — instrumentation opens a trace on request start, accumulates spans, and closes it on request stop.

Batches finished traces in a GenServer and flushes them to the ingest endpoint on a timer + once a max-batch threshold is reached. Delivery uses the built-in :httpc / :inets (no external HTTP client dependency).