Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Engine for tracking various metrics related to a Rails 3 application

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 lib
Octocat-spinner-32 public
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG.rdoc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO.rdoc
Octocat-spinner-32 rails_metrics.gemspec
README.rdoc

RailsMetrics

RailsMetrics is an engine that hooks into your application to listen ActiveSupport::Notifications and show you statistics about them. RailsMetrics uses threads to save those notifications in the database through an in-process Queue. You can see charts based on each request and see what queries, actions, templates rendering, etc. are slow.

So far RailsMetrics supports only ActiveRecord as ORM but adding other datastore should be easy (take a look at lib/rails_metrics/orm/active_record.rb). Due to the threaded behavior in RailsMetrics, you cannot use SQLite as database, however MySQL and PostgreSQL work fine.

There's an example application at github.com/engineyard/rails_metrics_example .

Installation

Installing RailsMetrics is simple. Since it's a Rails::Engine, you need to install it as gem:

gem install rails_metrics

Then add it to your gemfile. So far, I recommend you to install it only on development:

group :development do
  gem "rails_metrics"
end

Finally, create your model using the built-in generator:

rails g rails_metrics Metric

You can choose another name than Metric as your rails metrics store. Run the created migration, restart your server and now you should be able to access “/rails_metrics”. Navigate on your application and head back to “/rails_metrics” to see the stored data.

Configuration

There are three parameters you can add to your application to configure RailsMetrics. The first one is to set the RailsMetrics store, which is done automatically when you use the generator:

config.rails_metrics.set_store = lambda { ::Metric }

The other parameters allows you to ignore an specific notification, based on a given block or on its name. Let's suppose you have a plugin in your application which is yielding an useless notification. You can silence it by doing:

config.rails_metrics.ignore_patterns << /verbose_plugin/

If you need to ignore a notification based on its payload, it's also easy:

config.rails_metrics.ignore_lambdas[:verbose_plugin] = lambda { |name, payload|
  payload[:some_value] =~ /some_expression/
}

Running the test suite

To run the test suite, please execute the following commands on the project root:

1) gem install bundler

2) bundle install

3) rake prepare

4) rake test

TODO

Please refer to TODO file.

Maintainers

Bugs and Feedback

If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.

github.com/engineyard/rails_metrics/issues

MIT License. Copyright 2010 Engine Yard. www.engineyard.com

Something went wrong with that request. Please try again.