ObserverWeb.Mnesia (Observer Web v0.2.6)

View Source

Lists a node's Mnesia tables and (optionally) previews their contents - the Mnesia side of the observer GUI's Table Viewer, sharing the Tables page (and its safety gating) with ObserverWeb.Ets.

Table listing delegates to :observer_backend.get_table_list/2 (runtime_tools, already required on every node for :dbg tracing). Nodes where Mnesia isn't running - or whose release doesn't ship the :mnesia application at all - report {:error, :mnesia_not_running} instead of crashing.

Content inspection

Bounded, read-only previews reuse the same opt-in as ETS tables (config :observer_web, table_content_inspection: true). Reads go straight to the table's storage layer: ram_copies/disc_copies tables are backed by an ETS table of the same name, disc_only_copies by a DETS table - both support bounded object fetches, so a preview never scans a whole table. Tables with no copy on the selected node report as not accessible.

Summary

Functions

Lists every Mnesia table on node (including Mnesia's own system tables; the schema table is not listed by the collector).

Reads the first objects of a table straight from its storage layer (bounded, read-only), rendered as inspected strings. Same gating and limits as ObserverWeb.Ets.table_content/2.

Types

table()

@type table() :: %{
  name: atom(),
  storage: atom(),
  size: non_neg_integer(),
  type: atom(),
  memory: non_neg_integer(),
  owner_label: String.t(),
  index: list()
}

Functions

list_tables(node)

@spec list_tables(node()) :: {:ok, [table()]} | {:error, :mnesia_not_running | term()}

Lists every Mnesia table on node (including Mnesia's own system tables; the schema table is not listed by the collector).

table_content(node, table)

@spec table_content(node(), atom()) ::
  {:ok, [String.t()]} | {:error, :content_inspection_disabled | :not_accessible}

Reads the first objects of a table straight from its storage layer (bounded, read-only), rendered as inspected strings. Same gating and limits as ObserverWeb.Ets.table_content/2.