<div dir="ltr"><div>In my original example, the "db_connection" processes are created by a library. Ideally any solution to this problem would be something standardized so that library authors can use it and their users don't have to do anything special to see the labels.<br><br></div>A global name like "db_connection_(UUID)" would work, but is a hack, since all we really want is to say what sort of process this is.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 7, 2021 at 7:54 AM Loïc Hoguin <<a href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I don't know what makes you think that. What I linked to does not <br>
eliminate global atoms like we have today, it just adds local atoms <br>
which are GC. Global atoms still go into the atom table and are never <br>
GC. They are the atoms used for modules, functions and literals in the <br>
code. Local atoms would only be used when generating atoms. The <br>
performance cost would certainly not be devastating.<br>
<br>
On 07/05/2021 11:03, Stanislav Ledenev wrote:<br>
> As far as I understand how VM works implementation of the idea of <br>
> garbage collectable atoms will lead to devastating consequences. And <br>
> performance will be the first victim.<br>
> <br>
> IMHO cheapest implementation of process labels can be achieved on top of <br>
> process dictionary (oh, slippery) through some special value. Plus <br>
> modification of observer app.<br>
> <br>
> пт, 7 мая 2021 г. в 11:24, Loïc Hoguin <<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a> <br>
> <mailto:<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>>>:<br>
> <br>
>     What you want is to be able to either:<br>
> <br>
>     * register processes using any term and not just atoms<br>
>     * have garbage collectable atoms<br>
> <br>
>     That way Observer will always show the proper name.<br>
> <br>
>     Then for logs all you need is for <0.2555.0> to be identified at some<br>
>     point (in other logs with its registered name + pid for example). Or<br>
>     hook into logger as others have pointed out.<br>
> <br>
>     GC atoms has long been on the wishlist of many people:<br>
> <br>
>     * <a href="https://www.erlang.org/erlang-enhancement-proposals/eep-0020.html" rel="noreferrer" target="_blank">https://www.erlang.org/erlang-enhancement-proposals/eep-0020.html</a><br>
>     *<br>
>     <a href="https://github.com/nox/otp/commit/bf3334c1d2c0e404abaec72a985134def158afcf" rel="noreferrer" target="_blank">https://github.com/nox/otp/commit/bf3334c1d2c0e404abaec72a985134def158afcf</a><br>
> <br>
>     It would be fantastic if this could get traction.<br>
> <br>
>     Cheers,<br>
> <br>
>     On 06/05/2021 16:06, Nathan Long wrote:<br>
>      > Is there a way to add a non-unique label to a process? If not, I<br>
>     would<br>
>      > like to propose that it be added.<br>
>      ><br>
>      > The label could be shown with or instead of a PID. I think this<br>
>     would be<br>
>      > useful in at least two areas.<br>
>      ><br>
>      > First, when observing a running system, the PID is not<br>
>     descriptive. I<br>
>      > have Observer open right now looking at part of my system, and I<br>
>     can see<br>
>      > one globally registered process name displayed, but everything<br>
>     else is a<br>
>      > PID. What are those processes? I might be able to figure it out by<br>
>      > clicking the process and seeing what its initial call was, but<br>
>     often I<br>
>      > can tell is "it's a GenServer." The structure of the system would be<br>
>      > much more apparent if I saw labels like "db_connection" or<br>
>      > "request_queue_worker".<br>
>      ><br>
>      > Second, when reading error messages in logs or an exception<br>
>     tracker, the<br>
>      > PID is not useful. For example, I'm looking at an error in Sentry<br>
>     right<br>
>      > now that says "Sentry.CrashError error ** (exit) 'stopping because<br>
>      > dependent process <0.2255.0> died: killed'". I have no idea what<br>
>      > `<0.2555.0>` was, so I don't know what to debug.<br>
>      ><br>
>      > Does this exist or would others support it being added to the BEAM?<br>
>      ><br>
>      > -- Nathan<br>
> <br>
>     -- <br>
>     Loïc Hoguin<br>
>     <a href="https://ninenines.eu" rel="noreferrer" target="_blank">https://ninenines.eu</a><br>
> <br>
<br>
-- <br>
Loïc Hoguin<br>
<a href="https://ninenines.eu" rel="noreferrer" target="_blank">https://ninenines.eu</a><br>
</blockquote></div>