| Path: | README |
| Last Update: | Tue Jul 22 22:44:14 -0700 2008 |
XRay provides a lightweight yet powerful toolbox for troubleshooting Ruby applications when things stop making sense. XRay includes GDB and DTrace tooling as well as a Thread Dump utility that can dump the stack trace of all the thread in your Ruby VM when you send a QUIT signal.
Copy the gdb_macros file provided in the gem as your ~/.gdbinit file. You will find more details on how to use them, in my Troubleshooting Ruby Shortcut
After patching your Ruby VM with caller_for_all_threads_patch_for_MRI_1.8.6.diff (or caller_for_all_threads_patch_for_MRI_1.8.7.diff) as explained in this document, you can install a signal handler in charge of dumping the stack trace for all the threads in your Ruby VM with:
require "rubygems" require "xray/thread_dump_signal_handler"
You can then trigger a thread dump at any time with
kill -QUIT <pid of your ruby process>
You are one require away from triggering automatically DTrace events for Rails requests, database access and template rendering. As simple as
# environment.rb
Rails::Initializer.run do |config|
...
config.after_initialize do
require "xray/dtrace/rails/enable_tracing"
end
end
See
Philippe Hanrigou, ph7spot.com