From 08ce87345a13a18842e8e436be3917da5cf27df4 Mon Sep 17 00:00:00 2001 From: Ziinc Date: Wed, 10 Jul 2024 09:54:18 +0800 Subject: [PATCH] chore: refine ErlSysMon logging (#2135) * chore: fix flaky schema check * Revert "fix: reduce exit trapping and error logging on supervision tree termination" This reverts commit e2fb447e56f6983d3527717bddcacb999193dc61. * chore: resolve flaky tests, remove unnecessary exit trapping * chore: refine ErlSysMon logging --- lib/logflare/erl_sys_mon.ex | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/logflare/erl_sys_mon.ex b/lib/logflare/erl_sys_mon.ex index 1a2ef6c18..a438f4204 100644 --- a/lib/logflare/erl_sys_mon.ex +++ b/lib/logflare/erl_sys_mon.ex @@ -22,15 +22,20 @@ defmodule Logflare.ErlSysMon do {:ok, []} end - def handle_info(msg, state) do + def handle_info({:monitor, pid, _type, _meta} = msg, state) do pid_info = - case msg do - {:monitor, pid, _type, _meta} -> - Process.info(pid, [:dictionary]) + pid + |> Process.info(:dictionary) + |> case do + {:dictionary, dict} when is_list(dict) -> + Keyword.take(dict, [:"$ancestors", :"$initial_call"]) + + other -> + other end Logger.warning( - "#{__MODULE__} message: " <> inspect(msg) <> " | process info: #{inspect(pid_info)}" + "#{__MODULE__} message: " <> inspect(msg) <> "|\n process info: #{inspect(pid_info)}" ) {:noreply, state}