chore(agent): log /proc reads, log diagnostics enable, comment trap_exit

Addresses final code review:
- Host collector's /proc reads now go through Diagnostics.log_read/3,
  appearing in commands.log formatted as `$ cat /proc/loadavg`
- configure/1 logs an info line on successful enable so the operator
  has a breadcrumb in the journal
- Writer.init/1 documents the deliberate trap_exit omission
This commit is contained in:
Carsten 2026-04-22 22:29:26 +02:00
parent 2bb901873f
commit 3367b95b91
4 changed files with 34 additions and 3 deletions

View file

@ -19,6 +19,9 @@ defmodule ProxmoxAgent.Diagnostics.Writer do
def init(opts) do
dir = Keyword.fetch!(opts, :dir)
# No trap_exit: the Writer owns no linked processes other than the supervisor.
# If you add a linked port/task, restore Process.flag(:trap_exit, true) and
# add a matching handle_info({:EXIT, _, _}, state) clause.
with {:ok, commands} <- open(Path.join(dir, "commands.log")),
{:ok, samples} <- open(Path.join(dir, "samples.log")) do
{:ok, %{dir: dir, commands: commands, samples: samples}}