Bellwether (bellwether v0.1.0)

Copy Markdown

Reporting something the automatic capture would not have seen.

Most of what reaches Bellwether arrives without a call site: the :logger handler picks up every supervised crash, and the Agent explains each boot on its own. These are the escape hatches for the rest — a fault caught and handled, or a domain event that matters to you and means nothing to the runtime.

Everything here goes through Bellwether.Shape first. That is not a convenience. Every payload leaving a device is a Shape, and a public function that skipped that would be a hole in the one guarantee the whole thing rests on. Pass whatever you like — the values become their types before they reach the socket.

Summary

Functions

Report something that is not a crash.

Report an exception that was caught rather than allowed to crash.

Functions

capture_event(domain, kind, payload, opts \\ [])

@spec capture_event(atom(), atom(), term(), keyword()) :: :ok

Report something that is not a crash.

domain is one of :otp, :vm, :kernel, :native, :coproc, :agent; kind one of :crash, :trace, :alarm, :selftest, :reboot, :revert. The payload is Shaped before it leaves.

Bellwether.capture_event(:coproc, :alarm, %{radio: :zwave, fault: :no_response})

Pass :fingerprint to control grouping. Without one the server cannot group these into an Issue, which is usually what you want for a one-off and not what you want for anything recurring.

capture_exception(exception, stacktrace, opts \\ [])

@spec capture_exception(Exception.t() | term(), Exception.stacktrace(), keyword()) ::
  :ok

Report an exception that was caught rather than allowed to crash.

Goes through the Reporter, so the blocklist, dedupe and Fingerprint apply exactly as they would to an unhandled crash.

try do
  risky()
rescue
  e -> Bellwether.capture_exception(e, __STACKTRACE__)
end