<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:14pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 14pt;"><span><br></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">I am writing a distributed application and could not seem to find a way to get Observer's Applications pane to show the registered name of a process when that process is globally registered (as in gen_server:start_link({global, Name}, ?MODULE, [],[])).</div><div style="font-family: arial, helvetica, sans-serif; font-size: 14pt;"><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 19px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I also couldn't find a global method which returned a registered name given a pid. S<span style="background-color: transparent;">o, I added a function go the global module</span></div><div
style="font-family: arial, helvetica, sans-serif; font-size: 19px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="background-color: transparent;"><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;">pid_2_name(Pid) -></span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"> case ets:lookup(global_pid_names, Pid) of</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>[{Pid, Name}] -> </span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> if
node(Pid) == node() -></span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> case is_process_alive(Pid) of</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>true -> Name;</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>false -> undefined</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> end;</span></font></div><div
style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> true -></span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> Name</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> end;</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>[] -> undefined</span></font></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span
style="font-size: 19px;"> end.</span></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 19px; font-family: arial, helvetica, sans-serif; font-style: normal;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;"><br></span></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 19px; font-family: arial, helvetica, sans-serif; font-style: normal;"><font face="arial, helvetica, sans-serif"><span style="font-size: 19px;">and then I modified appmon_info and observer_procinfo to make use of this function when process_info failed to return a {registered_info, _} tuple. I did this sort of thing:</span></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 19px; font-family: arial, helvetica, sans-serif; font-style: normal;"><font face="arial, helvetica, sans-serif"><br></font></div><div style="background-color:
transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"> case process_info(P, registered_name) of</span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>{registered_name, Name} -> atom_to_list(Name);</span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>_ -></span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> case global:pid_2_name(P) of</span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span"
style="white-space:pre"> </span>undefined -> pid_to_list(P);</span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span>Name -> "*" ++ atom_to_list(Name)</span></div><div style="background-color: transparent;"><span style="font-family: arial, helvetica, sans-serif; font-size: 19px;"><span class="Apple-tab-span" style="white-space:pre"> </span> end</span></div><div style="background-color: transparent;"><font face="arial, helvetica, sans-serif"><span><span style="background-color: transparent; font-size: 19px;"> end;</span></span></font></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 19px; font-family: arial, helvetica, sans-serif; font-style: normal;"><font face="arial, helvetica, sans-serif"><br></font></div><div style="background-color: transparent;"><span
style="font-family: arial, helvetica, sans-serif; font-size: 19px;">So was this a totally unsafe and / or unnecessary thing to do; or, is this for the most part an okay thing to do?</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 19px; font-family: arial, helvetica, sans-serif; font-style: normal;"><font face="arial, helvetica, sans-serif"><span><span class="Apple-tab-span" style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 19px; font-style: normal; white-space: pre;"> </span></span></font></div></div> <style type="text/css">#yiv434908651 p {margin:0;}</style></div></body></html>