LetItCrash.Async.Report (let_it_crash v0.6.0)

View Source

Result of a LetItCrash.Async.observe_async/1,2 block.

A Report records the async work that happened inside an observer block: which Tasks/processes were spawned, which completed, which crashed, which exceptions were caught by telemetry, plus timing data. The struct is the API — its fields are public and stable.

Three named assertions consume a Report:

(Idempotency uses a function-form assertion that does not consume a Report; see LetItCrash.Async.assert_idempotent/2.)

Fields

  • :spawned — list of {pid, kind, started_at} for processes observed during the block. kind is :task | :unknown. started_at is in monotonic milliseconds.
  • :completed — list of {pid, result, finished_at} for spawned work that finished cleanly. For trace-sourced entries (trace: true) result is the process exit reason (:normal / :shutdown / {:shutdown, _}), not the task's return value — tracing observes exits, not return values.
  • :crashed — list of {pid, reason, finished_at} for spawned work that exited abnormally. reason is the exit reason, typically {exception, stacktrace} for a raised error.
  • :exceptions — list of exception events seen during the block. Each entry is {event_name, measurements, metadata}. Telemetry events keep their upstream shape; trace-observed crashes are synthesized as {[:task, :exit], %{}, %{pid: pid, reason: reason}}.
  • :warnings — list of atom hints from the observer. Includes :trace_unavailable when trace: true was requested but the owner was already traced by another tool. Usually empty.
  • :duration_ms — wall-clock duration of the block in milliseconds.
  • :started_at — monotonic time (ms) when the block started.
  • :ended_at — monotonic time (ms) when the block ended.

Reports are pure data: no behavior beyond @type t/0.

Summary

Types

completed_entry()

@type completed_entry() :: {pid(), term(), integer()}

crashed_entry()

@type crashed_entry() :: {pid(), term(), integer()}

exception_entry()

@type exception_entry() :: {[atom()], map(), map()}

pid_kind()

@type pid_kind() :: :task | :unknown

spawned_entry()

@type spawned_entry() :: {pid(), pid_kind(), integer()}

t()

@type t() :: %LetItCrash.Async.Report{
  completed: [completed_entry()],
  crashed: [crashed_entry()],
  duration_ms: non_neg_integer(),
  ended_at: integer() | nil,
  exceptions: [exception_entry()],
  spawned: [spawned_entry()],
  started_at: integer() | nil,
  warnings: [atom()]
}