Rails Metrics: know what is happening inside your Rails 3 application

RailsMetrics is a new Rails engine which stores everything that is happening inside your application in the database, so you can profile each request, besides creating charts, statistics and extract useful information.

I’ve been working on it for the last couple months in parallel with ActiveSupport::Notifications, which is the foundation for RailsMetrics, and it was open sourced today by Engine Yard!

It was a challenging project due to its threaded nature and I will share a couple things I learned during the process in this blog later. For now, you can watch the screencast below to see what it does and how to install it:

Rails Metrics Screencast – Feb/2010 from PlataformaTec on Vimeo.

As said in the video, getting it released is just the first step and now it’s your turn to fork and improve it by providing a better layout, creating new reports, charts, etc!

In case you are interested here are some screenshots that I tweeted earlier: http://twitpic.com/13e7fn/full and http://twitpic.com/13e7h2/full.

The javascript novell

A week ago I asked what people uses to create charts in Rails so I could evaluate what would be the best library to use in RailsMetrics. There were three types of libraries: server side ones, flash and javascript. Since I don’t want to depend on having neither RMagick nor Flash installed on the developer machine, I chose the javascript kind.

After some research I ended up with three libraries: g.raphael, flot and jqplot.

For RailsMetrics, I chose to use g.raphael since I can easily manipulate the objects it creates and it is the one which looks better (at least imho ;)). However it has poor documentation and the default charts have poor customization options compared to the other two libraries, so you end up tweaking the chart by hand (which was fine in my experience).

I’m waiting for your pull requests, enjoy!

18 responses to “Rails Metrics: know what is happening inside your Rails 3 application”

  1. Matt Todd says:

    I had my volume up to 100% and the video volume up to 100% and I couldn’t hear a single word that was said 🙁

  2. Matt Todd says:

    I had my volume up to 100% and the video volume up to 100% and I couldn’t hear a single word that was said 🙁

  3. José Valim says:

    This is odd, I just tried here and I could hear nicely with the volume around 70%. 🙁

  4. José Valim says:

    This is odd, I just tried here and I could hear nicely with the volume around 70%. 🙁

  5. Boblin says:

    Hi Jose,
    Rails Metrics looks promising. Thank’s for sharing.

    BTW Video volume is OK.

  6. Boblin says:

    Hi Jose,
    Rails Metrics looks promising. Thank’s for sharing.

    BTW Video volume is OK.

  7. José Valim says:

    Awesome Boblin! Thanks for the feedback! 🙂

  8. José Valim says:

    Awesome Boblin! Thanks for the feedback! 🙂

  9. grimen says:

    Nice, is this the same as “instrumentation” that’ve seen around in commits here and there?

    P.S. Nothing wrong with the sound.

  10. grimen says:

    Nice, is this the same as “instrumentation” that’ve seen around in commits here and there?

    P.S. Nothing wrong with the sound.

  11. José Valim says:

    @grimen, yes, it’s!

    While we use “ActiveSupport::Notifications.subscribe” to consume notifications, we publish them this way:

    ActiveSupport::Notifications.instrument “my_gem.something_expensive” do
    # something expensive
    end

    Glad to know the sound works. 🙂

  12. José Valim says:

    @grimen, yes, it’s!

    While we use “ActiveSupport::Notifications.subscribe” to consume notifications, we publish them this way:

    ActiveSupport::Notifications.instrument “my_gem.something_expensive” do
    # something expensive
    end

    Glad to know the sound works. 🙂

  13. Jonathan Hicks says:

    Highcharts is a pretty good JS lib. Although, the licensing may not be to your liking.

    http://highcharts.com/

  14. Jonathan Hicks says:

    Highcharts is a pretty good JS lib. Although, the licensing may not be to your liking.

    http://highcharts.com/

  15. José Valim says:

    Yup! I took a look to highcharts and couldn’t choose it due to the licensing.

  16. José Valim says:

    Yup! I took a look to highcharts and couldn’t choose it due to the licensing.

  17. Diego Plentz says:

    Same problem with sound here. I think that the problem happens because of my ~3 years old macbook pro 🙁

  18. Diego Plentz says:

    Same problem with sound here. I think that the problem happens because of my ~3 years old macbook pro 🙁