TIL: Ruby's TracePoint A developer discovered Ruby's TracePoint class while investigating cryptic CI warnings. TracePoint provides a powerful API for instrumenting key Ruby program events like method calls and raises without modifying the source code. The developer demonstrated how to use TracePoint to trace specific method calls, noting its potential for advanced metaprogramming. Today I was looking into some cryptic warnings we're getting on CI, and querying GPT about possible ways to understand where they're being emitted from I was pointed to TracePoint https://docs.ruby-lang.org/en/master/TracePoint.html class. It's an extremely powerful API that allows instrumenting many key Ruby program events such as raises, method calls, block entries etc. see docs for the full list without polluting or knowing, hehe the defining code. For example, we know an offending instance method name example method , but naught else. We can instrument all method calls and look for a match def example method "yay" end TracePoint.new :call do |tp| puts tp.lineno, tp.defined class, tp.method id, tp.event .to s if tp.method id == :example method end.enable do example method end 1, Object, :example method, :call = "yay" I imagine you could ab use this for some fancy framework meta- programming to gracefully achieve reactions to macro calls etc.