ActionCost measures the performance of a Rails 3 app controller actions in terms of number of calls to the database and to RecordCache.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
lib
test
.document
.gitignore
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
action_cost.gemspec

README.rdoc

ActionCost

ActionCost is a Rails 3 engine implemented as a gem. It hooks into ActiveRecord (and RecordCache if used) and counts the number of SQL queries per controller action and per table.

Setup

Simply include action_cost into your Rails 3 application Gemfile.

gem 'action_cost', '0.0.1'

In some applications it's also necessary to add routes in #{Rails.root}/config/routes.rb for the ActionCost dashboard pages:

namespace :action_cost do
  get '/' => 'dashboards#index'
  match '/ca/:ca' => 'dashboards#ca', :as => 'ca', :constraints => { :ca => /.*/ }
end

Where is the data stored?

In the Rails process memory. The data goes away when the process dies.

Where is the data visible?

  1. Go to yourapp/action_cost, it will display a page with a list of controller action and the average number of queries made in each one of them. Click on a controller action to find which tables were queried.

  2. After each controller action completes, an action_cost summary is #{Rails.root}/log/action_cost.log