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:
parent
2bb901873f
commit
3367b95b91
4 changed files with 34 additions and 3 deletions
|
|
@ -22,6 +22,7 @@ defmodule ProxmoxAgent.Diagnostics do
|
|||
case File.mkdir_p(dir) do
|
||||
:ok ->
|
||||
Application.put_env(:agent, :dump_dir, dir)
|
||||
Logger.info("diagnostics: enabled, writing to #{dir}")
|
||||
:ok
|
||||
|
||||
{:error, reason} ->
|
||||
|
|
@ -46,6 +47,11 @@ defmodule ProxmoxAgent.Diagnostics do
|
|||
cast({:sample, kind, payload})
|
||||
end
|
||||
|
||||
@spec log_read(Path.t(), command_result(), non_neg_integer()) :: :ok
|
||||
def log_read(path, result, duration_us) do
|
||||
log_command("cat", [to_string(path)], result, duration_us)
|
||||
end
|
||||
|
||||
defp disable do
|
||||
Application.delete_env(:agent, :dump_dir)
|
||||
:ok
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue