How to draw supervision trees?

I am wondering how to properly draw a supervision tree: I have earlier worked with UML diagrams, and I have used multiple computer tools in the past ( nomnoml, draw.io, and paid solutions like gliffy ), after sketching on paper by hand.

My question: Is there a good (maybe standardized?) way to draw supervision trees? Especially I am wondering how to indicate that something starts multiple processes, what processes communicate (even though they might not be siblings in the supervision-structure) and how to indicate the different supervision strategies that are used?

Also, are there any tools that are really good at making these kind of diagrams?

4 Likes

:observer will draw supervision trees for you in a running instance.

http://benjamintan.io/images/observer_3.png
There does seem to be a “standard” for graphing message flows among Erlang programmers.

http://erlang.org/doc/apps/megaco/MGC_startup_call_flow.gif

6 Likes

That 2nd image above is known as a UML Sequence Diagram – the most useful of them all.

I’ve used this online tool before: https://www.websequencediagrams.com

7 Likes

If you are more the “I like my fancy graphics generated from stupid ASCII-sourcefiles”-guy, there is a tool available called mscgen, which can produce graphics similar to the second image shown above.

Also there is currently no standardized way I am aware of to actually draw a supervision tree (or process tree in generall) for erlang or any other language. The way I do see it at most is a very simple view of just plain nodes and vertices. I haven’t seen any distictions so far between process “types” (Supervisor, GenServer or whatever we have in erlang and Elixir available).

For a documentation I am currently writing (erlang software) I do follow a very simple scheme so far.

Important for this documentation is only the distinction between application, supervisor, gen_server, and gen_fsm, everything else is just a process and remains a “plain” node. The other 4 are just annotated with an overlayed square icon in the upper right corner of the node, where the icon is in fact only a single letter: “A” for application, “V” for supervisor, “S” for gen_server and “F” for gen_fsm.

If someone does find a standard way to draw them I would be very glad to use it in my documentation :slight_smile:

4 Likes

These are some interesting resources so far!

One of the images i really liked, is from the the Zen of Erlang article:

This looks like it was also made with some kind of tool (rather than being human-drawn). I really like how it shows that something might have more siblings, and that something has multiple of a kind below it. It also designates supervisors as rounded rectangles while workers are circles.

5 Likes

Funny observer was the first thing that came into my mind when I read the question.

1 Like

Hmm. Maybe contact the author of Zen of Erlang and ask him or her which tool he or she used for that?

3 Likes

MermaidJS is a pretty good tool for this too.