• Stars
    star
    105
  • Rank 328,196 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ActionCost measures the performance of a Rails 3 app controller actions in terms of number of calls to the database and to RecordCache.

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