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

Links

Tracing on the shoulders of giants

By Jacek Królikowski

Tracing on the shoulders of giants

The Erlang ecosystem comes with many almost magical tools. But sometimes using them in the Elixir context is less than straightforward... Or is it?

  • 899

More from Jacek Królikowski