benjaminzz

benjaminzz

Application using GenStage with pretty tracing for studying purposes

Hey!

I created a simple project using GenStage only to study more deeply how the processes comunicate with each other. Instead of using the default erlang tracer, I implemented a prettier tracer and also added some extra logging stuff, that help me understand better how the stages behave with different max_demand and min_demand configurations.

The Stages

[Stock] ----------> [Chef] ------------> [Checkout] >>>>>>>>> Checkout.Task

A example of the tracing logs

15:50.768 trace: :chef      => :stock                    {:subscribe, nil, [min_demand: 3, max_demand: 5]}
15:50.768 trace: :chef      => :stock                    {:ask, 5}
15:50.769 trace: :checkout  => :chef                     {:subscribe, nil, [min_demand: 0, max_demand: 2]}
15:50.769 trace: :checkout  => :chef                     {:ask, 2}
15:52.031 trace: :stock     => :chef                     {:snt, 5}
15:53.037 trace: :chef      => :checkout                 {:snt, 2}
15:53.038 trace: :chef      => :stock                    {:ask, 2}
15:53.039 trace: :checkout  => {:task, #PID<0.255.0>}    :acai1029
15:53.039 trace: :checkout  => {:task, #PID<0.256.0>}    :acai1093
15:53.543 trace: :stock     => :chef                     {:snt, 2}
15:54.039 trace: :checkout  => :chef                     {:ask, 1}
...

Repository: https://github.com/HugoLnx/acai-restaurant

Hope it help. :wink:

PS.: I created a few issues with some ideas.

Where Next?

Popular in Discussions Top

vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
Donovan
Hello everyone, I’m so glad to have discovered this awesome community. Thanks for creating it! This is my second post, and apologies for...
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New

Other popular topics Top

Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement