Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Fix a remote and a local crash scenario #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/epl_ets/src/epl_ets_metric.erl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ calculate_memory_percent(MemoryData) ->

get_ets_info(Node, Tab) ->
{ok, Info} = epl:command(Node, fun ets:info/1, [Tab]),
InfoMap = proplist_to_map(Info),
{Tab, InfoMap}.
if
Info == undefined -> {Tab, #{}};
true -> InfoMap = proplist_to_map(Info),
{Tab, InfoMap}
end.

transform_traces_by_pid(Traces) ->
TracesByPid = split_traces_by_pid(Traces),
Expand Down Expand Up @@ -211,6 +214,9 @@ namify_val(Val) ->
namify(Name) ->
epl_viz_map:namify(Name).


proplist_to_map({'EXIT', _reason}) -> #{};

proplist_to_map(Proplist) ->
lists:foldl(fun({Prop, Val}, Map) -> maps:put(namify(Prop), namify_val(Val),
Map) end, #{}, Proplist).
Expand Down
9 changes: 8 additions & 1 deletion apps/epl_st/src/epl_st.erl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ code_change(_OldVsn, State, _Extra) ->
%%% Internal functions
%%%===================================================================

is_supervisor(Pid) ->
element(1, proc_lib:initial_call(Pid)) == supervisor.

generate_sup_tree({_Name, Pid, worker, _Mods}) ->
worker_node(Pid);
generate_sup_tree({_Name, Pid, supervisor, _Mods}) ->
Expand All @@ -101,7 +104,11 @@ generate_sup_tree(undefined) ->
#{};
generate_sup_tree(MasterPid) ->
{SupPid, _SupName} = command(fun application_master:get_child/1, [MasterPid]),
Children = command(fun supervisor:which_children/1, [SupPid]),
IsSupervisor = is_supervisor(SupPid),
Children = if
IsSupervisor -> command(fun supervisor:which_children/1, [SupPid]);
true -> []
end,
sup_node(SupPid, generate_children(Children)).

generate_children(Children) ->
Expand Down