Statify
Pop this gem in your rails >= 3 application. Simply give this gem the location of your statsd instance and it can seamlessly track the following:
- Performance stats broken down by controller and action and further broken down by view, database, and overall runtimes
- Overall SQL calls durations
- Ruby garbage collection stats (this will run after every controller response cycle)
- Cache hit and miss rates
Installation
Add this line to your application's Gemfile:
gem 'statify'
And then execute:
$ bundle
Or install it yourself as:
$ gem install statify
Pre-Requisities
You will need to have a statsd instance running somewhere that you can connect to. If you want to graph what is coming out of statsd there are different front ends to use with statsd. One of them is Graphite: http://graphite.wikidot.com/
Usage
In your Rails App put these following lines in your config/application.rb:
config.statify.categories = [:sql, :garbage_collection, :cache, :controller]
config.statify.statsd = Statsd.new('127.0.0.1', 8125)
Obviously put in the address of your own statsD ip address and port into the statsd.new call. The categories are opt-in, so put in what you want to use.
Ruby Notes
Ruby 1.8.7: 1.8.7 has a different call for GC stats that I haven't looked into it yet. You can install this gem on your 1.8.7 codebase for now just omit the garbage_collection category.
Supported categories
- garbage_collection
- controller
- cache
- sql
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request