ObserverWeb.Crashdump.Server (Observer Web v0.2.6)

View Source

Owns the interaction with OTP's :crashdump_viewer parser (a globally named gen_server): starts it on demand, serializes dump loads, receives the parser's progress reports and broadcasts them, and decodes its records into maps for the Crashdump page.

Progress: while loading, this server registers itself under the name the parser reports to (:cdv_progress_handler, a no-op destination when unregistered) and receives {:progress, {:ok, phase | percent | :done}} / {:progress, {:error, reason}} messages, re-broadcast on the "crashdump" PubSub topic.

Decoding: #general_info{}/#proc{} records are converted by zipping their documented field order over the tuple - a dump/record from a different OTP release with more or fewer fields degrades to the fields both sides know instead of crashing.

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

general_info()

@spec general_info() :: {:ok, map()} | {:error, :no_dump_loaded}

load(path)

@spec load(String.t()) :: :ok | {:error, term()}

proc_details(pid_string)

@spec proc_details(String.t()) ::
  {:ok, map()} | {:error, :no_dump_loaded | :not_found}

processes()

@spec processes() :: {:ok, [map()]} | {:error, :no_dump_loaded}

start_link(args)

status()

@spec status() ::
  :idle | {:loading, String.t(), non_neg_integer()} | {:loaded, String.t()}