BeamConsole (beam_console v0.4.0)

Copy Markdown View Source

Read-only access to sampled BEAM runtime topology.

The public API returns bounded normalized data. It never accepts PID strings, atom names, or encoded Erlang terms from clients.

Summary

Functions

Acknowledges the caller's outstanding snapshot notification.

Returns the directly following bounded diff or a full snapshot resync instruction.

Loads allowlisted details for an opaque process entity ID.

Returns the latest completed snapshot, or nil before the first scan.

Requests a new bounded runtime scan.

Searches process labels and safe metadata in a snapshot.

Returns bounded collector health and snapshot freshness information.

Subscribes the calling process to sampled snapshot notifications.

Stops snapshot notifications for the calling process.

Functions

acknowledge(sequence, server \\ Collector)

@spec acknowledge(non_neg_integer(), GenServer.server()) :: :ok

Acknowledges the caller's outstanding snapshot notification.

changes_since(sequence, server \\ Collector)

Returns the directly following bounded diff or a full snapshot resync instruction.

detail(snapshot, entity_id)

@spec detail(BeamConsole.Snapshot.t() | nil, String.t()) ::
  {:ok, BeamConsole.ProcessDetail.t()} | {:error, :unknown | :unavailable}

Loads allowlisted details for an opaque process entity ID.

Unknown IDs return {:error, :unknown}. A process that has exited or is not local to the inspected snapshot returns {:error, :unavailable}.

latest_snapshot(server \\ Collector)

@spec latest_snapshot(GenServer.server()) :: BeamConsole.Snapshot.t() | nil

Returns the latest completed snapshot, or nil before the first scan.

refresh(server \\ Collector)

@spec refresh(GenServer.server()) :: :ok | {:error, :rate_limited}

Requests a new bounded runtime scan.

Concurrent requests are coalesced so the collector never overlaps scans. Rapid operator requests return {:error, :rate_limited}.

search(snapshot, query, limit \\ 100)

Searches process labels and safe metadata in a snapshot.

Matching is case-insensitive and the result count is bounded by limit. A missing snapshot returns an empty list.

status(server \\ Collector)

Returns bounded collector health and snapshot freshness information.

subscribe(server \\ Collector)

@spec subscribe(GenServer.server()) :: {:ok, BeamConsole.Snapshot.t() | nil}

Subscribes the calling process to sampled snapshot notifications.

The return value contains the latest snapshot when one has already completed. Subscribers receive {:beam_console_snapshot, sequence} version-invalidating messages and are removed automatically when they terminate. A subscriber must acknowledge each delivered sequence after reading the latest bounded state.

unsubscribe(server \\ Collector)

@spec unsubscribe(GenServer.server()) :: :ok

Stops snapshot notifications for the calling process.