Live data from Hacker News

How to spy on a Ruby program

jvns.ca

1–10 of 28 posts

Re: How to spy on a Ruby program

#4
> maybe it doesn't exist because a Linux-only Ruby debugging tool is sort of a weird thing?

Linux-only seems perfectly acceptable, especially as more and more development moves to Docker containers.

Great write up, looking forward to seeing a completed tool!

Re: How to spy on a Ruby program

#5
post #3
post #2

One issue I've run across is spying on JRuby's native Java classes. Anyone have a solution?

I've only ever used VirtualVM, maybe Charles Nutter or Chris Seaton will appear and enlighten us both.

I'm not sure what you want to do. Is your problem that you do want to see the native Java classes, or you want to hide them and focus on the Ruby code? Or is the key thing you want a Java flame graph?

Re: How to spy on a Ruby program

#6
For Python, you can just use Pyrasite (https://github.com/lmacken/pyrasite) and inject a script which prints a stack trace for all threads.

I've done this to debug OpenStack in the past and it worked very well. There are many similar projects for Python, I used this one since it's in the RHEL repo.

Useful summary on StackOverflow: https://stackoverflow.com/questions/4163964/python-is-it-pos...

Re: How to spy on a Ruby program

#8

> maybe it doesn't exist because a Linux-only Ruby debugging tool is sort of a weird thing? Linux-only seems perfectly acceptable, especially as more and more development moves to Docker containers. Great write up, looking forward to seeing a completed tool!

Windows Docker is just around the corner!

Re: How to spy on a Ruby program

#9
post #3

Earlier quoted context omitted.

I've only ever used VirtualVM, maybe Charles Nutter or Chris Seaton will appear and enlighten us both.

I'm not sure what you want to do. Is your problem that you do want to see the native Java classes, or you want to hide them and focus on the Ruby code? Or is the key thing you want a Java flame graph?

Java classes and a flame graph would be nice sometimes. I really only know how to use pry and Virtual VM with JRuby.

Re: How to spy on a Ruby program

#10
post #3

Earlier quoted context omitted.

I've only ever used VirtualVM, maybe Charles Nutter or Chris Seaton will appear and enlighten us both.

I'm not sure what you want to do. Is your problem that you do want to see the native Java classes, or you want to hide them and focus on the Ruby code? Or is the key thing you want a Java flame graph?

Interesting, it looks like Sam Saffron's FlameGraph gem https://github.com/SamSaffron/flamegraph has worked with JRuby for about a year and I hadn't noticed.
Post reply on HN