Thomas Depierre
@DianaO
Diana Olympos
Twitter :
Github :
The art of asking questions
The art of not making hypotheses
Writing software that works in production is really close to the art of debugging
To be able to ask questions, you need tools to answer
If noone touch your system, how long will it still run ?
Debugging everyday is what keep your system running
Production is the best place where you can get meaningful information about your system
I can just go check my logs ! I am going to grep it with regex !
PS: use ripgrep
I can just run it under a debrgger! I am going to check what is happening !
:dbg.start
:dbg.tracer(:process, {fn _, 5 -> :dbg.stop_clear()
msg, n -> IO.inspect(msg); n+1 end, 0})
:dbg.tpl(Enum, :map, [])
:dbg.p(:all, :c)
# With trace
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
# No more trace
Enum.map([1,2,3,4], & &1 + 1)
Let's bring a dependency
:recon_trace.calls({Enum, :map, :_}, 5)
# With trace
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
# No more trace
Enum.map([1,2,3,4], & &1 + 1)
With Recon
Let's bring a dependency, Ex2ms
import Ex2Ms
# Ex2Ms define the "fun" macro
match_spec = fun do _ -> return_trace() end
:recon_trace.calls({Enum, :map, match_spec}, 10)
# With trace
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
Enum.map([1,2,3,4], & &1 + 1)
# No more trace
Enum.map([1,2,3,4], & &1 + 1)
With Recon
Live Demo :)