Minga.SystemObserver.TreeNode (Minga v0.1.0)

Copy Markdown View Source

Render-oriented tree node derived from flat SystemObserver snapshots.

SystemObserver keeps snapshots in a flat map keyed by PID because that is cheap to collect and easy to sample over time. The Observatory derives this tree when it needs hierarchy for rendering.

Summary

Functions

Builds a supervision tree from a flat %{pid => ProcessSnapshot.t()} map.

Returns the tree as a pre-order list of nodes.

Types

t()

@type t() :: %Minga.SystemObserver.TreeNode{
  children: [t()],
  depth: non_neg_integer(),
  pid: pid(),
  snapshot: Minga.SystemObserver.ProcessSnapshot.t()
}

Functions

build_tree(snapshots)

@spec build_tree(%{required(pid()) => Minga.SystemObserver.ProcessSnapshot.t()}) ::
  t() | nil

Builds a supervision tree from a flat %{pid => ProcessSnapshot.t()} map.

Returns nil when the snapshot has no root process. Children whose parent is missing from the map are ignored because they cannot be placed in the rendered tree safely.

flatten(node)

@spec flatten(t() | nil) :: [t()]

Returns the tree as a pre-order list of nodes.