/monitor

Monitor gem can display ruby methods call stack on browser based on unroller

Primary LanguageJavaScriptMIT LicenseMIT

monitor

Monitor gem can display ruby methods call stack on browser based on unroller


Install


gem install monitor --source http://gemcutter.org

Usage

  • Start a server for monitoring ruby methods call

$ monitor
  • Add monitor to source codes

require 'rubygems'
require 'monitor/unroller'

Unroller::trace :display_style => :concise
  • Then run the source codes and see the methods call stack on browser http://localhost:9090

Example

1. start monitor server


$ monitor

2. create an example test.rb


require 'monitor/unroller'
Unroller::trace :display_style => :concise
class Test
  def test
    a = 1
    b = 2
    another
  end
  def another
    b = 2
    a = 1
  end
end
t = Test.new
t.test

3. run the example


ruby test.rb

4. check in browser http://localhost:9090

See the result


Advance

1. monitor is a server based on Sinatra, you can change default port (9090) and server (thin) by


$ monitor -p 8080 -s mongrel

2. monitor uses sockets to communicate to source codes, you can change default socket port (9099) by


$ monitor -u 8088

and meantime change the client socket port by


Unroller::trace :display_style => :concise, :unroller_port => 9099

3. There’re also a lot of options for unroller gem, check them on http://unroller.rubyforge.org/


Copyright © 2009 Richard Huang (flyerhzm@gmail.com), released under the MIT license