Chasing Real-Time Observability for CRuby

Understanding how a program behaves is hard. You need to understand what happens inside the methods being executed and in Ruby, which method is actually called is often not obvious from reading the source code. On top of that, CRuby performs runtime work that never appears in your program, such as GVL-driven thread scheduling and garbage collection.

CRuby does provide observability APIs, including TracePoint. In this talk, I will present rrtrace, an attempt at chasing real-time observability for CRuby: a system that captures instrumentation events in a CRuby C-extension, streams them to a dedicated external process, reconstructs thread/stack state, and visualizes execution in near real time as a 3D space: time × thread × call stack. With this view, you can literally see GVL thread switches and GC runs as they happen.

I will also cover the engineering required to make this feasible while disturbing the observed Ruby process as little as possible.