Tracing on the shoulders of giants
Jacek Królikowski
Story time!
"The eager rate-limter"
"Standard approach"
def suspicious_function(arg1, arg2, opts \\ []) do
IO.inspect {arg1, arg2, opts} # Logging the arguments
# do some work here
# ret = do_some_more_work()
IO.inspect ret
end
Debugging, the Erlang way
- "trace bifs" (erlang:trace_pattern/3)
- very powerful
- very not user friendly
- OTP dbg
- still not very user friendly
- it's easy to overload the node
-
redbug (!)
- easy to use
- production-friendly
- still very powerful
:redbug example in Erlang
(Audience participation)
-
:ets.lookup
-
Acme.Palindrome.is_palindrome?("don't nod")
Rate-limiting story conclusion
redbug is great anyways!
Birth of
- Elixir syntax
- the same redbug power*
- argument matching
- remote nodes
- targetting individual processes
- analogous API, you can use them interchangeably
- now available on hex.pm!
Takeaways
- It's worth it to know Erlang syntax sometimes
- redbug is awesome
- Rexbug is a thing
- There are other tracing debuggers (!)
- fishcakez/dbg
- liveforeverx/exrun
- andytill/erlyberly (GUI)
- ferd/recon (Erlang)
Links
- https://github.com/massemanet/redbug
- https://massemanet.github.io/eper/redbug
-
https://github.com/nietaki/rexbug
- (almost feature complete, feel free to contribute)
- https://slides.com/nietaki/tracing-on-the-shoulders-of-giants