public
Description: Inspect a rails application's log file to find slow actions
Homepage:
Clone URL: git://github.com/ngauthier/slow-actions.git
Click here to lend your support to: slow-actions and make a donation at www.pledgie.com !
name age message
file .gitignore Tue Mar 24 10:54:18 -0700 2009 updated gitignore to ignore rdoc [ngauthier]
file LICENSE Wed Feb 25 12:56:58 -0800 2009 Initial commit to slow-actions. [ngauthier]
file README.rdoc Fri Oct 09 12:23:47 -0700 2009 updated readme for gemcutter installation [ngauthier]
file Rakefile Tue Oct 20 07:36:41 -0700 2009 updated summary and description in rakefile [ngauthier]
file VERSION.yml Tue Oct 20 07:33:35 -0700 2009 Version bump to 0.3.4 [ngauthier]
directory bin/ Thu Feb 26 13:18:00 -0800 2009 date filtering [ngauthier]
directory lib/ Tue Oct 20 07:33:15 -0700 2009 support for old rails log files with time in se... [ngauthier]
file slow-actions.gemspec Tue Oct 20 07:35:59 -0700 2009 added summary in gemspec [ngauthier]
directory test/ Tue Oct 20 07:33:15 -0700 2009 support for old rails log files with time in se... [ngauthier]
README.rdoc

Slow Actions

Nick Gauthier (nick@smartlogicsolutions.com)

Description

Reads a rails app’s log file for slow actions

Installation

You will need to have Gemcutter in your list of gem sources.

  gem install slow-actions

Usage

Command line

  slow-actions (--actions | --controllers | --sessions) log_file [log_file ...]
    You may also specify:
      --min-cost=FLOAT
      --min-avg=FLOAT
      --min-max=FLOAT
      --start-date=YYYY-MM-DD
      --end-date=YYYY-MM-DD

Ruby Code

  require 'rubygems'
  require 'slow_actions'
  @sa = SlowActions.new
  @sa.parse_file(file_path)
  puts @sa.print_actions

Sample output:

  $> slow-actions --actions --min-cost=2 test/data/development.log
             Cost    Average Max
  - UsersController : game_history (22 entries, 0% Error)
    Total:   11275.447 3642.437 12728.0
    Render:  7.20300 2.32700 17.2450
    DB:      10.5020 3.39200 10.0000

  - QuestionsController : refresh_index_table (89 entries, 0% Error)
    Total:   908.494 202.348 307.000
    Render:  0.00000 0.00000 0.00000
    DB:      32.5880 7.25800 10.0000

  - UsersController : show (128 entries, 0% Error)
    Total:   664.292 136.888 2680.00
    Render:  0.33500 0.06900 3.41000
    DB:      18.2330 3.75700 114.000

  $> slow-actions --controllers --min-cost=2 test/data/development.log > ~/Desktop/sa-controllers.txt
               Cost    Average Max
  + UsersController (236 entries, 0% Error)
  | Total:     2165.375 396.279 12728.0
  | Render:    1.63400 0.29900 17.2450
  | DB:        7.03400 1.28700 114.000
  |-+ game_history (22 entries, 0% Error)
  | | Total:   11275.447 3642.437 12728.0
  | | Render:  7.20300 2.32700 17.2450
  | | DB:      10.5020 3.39200 10.0000
  |-+ show (128 entries, 0% Error)
  | | Total:   664.292 136.888 2680.00
  | | Render:  0.33500 0.06900 3.41000
  | | DB:      18.2330 3.75700 114.000
  |-+ index (812 entries, 51% Error)
  | | Total:   465.660 69.5050 1922.00
  | | Render:  0.30100 0.04500 2.39600
  | | DB:      40.9320 6.10900 1164.00

  $> slow-actions --sessions --min-cost=2 test/data/development.log > ~/Desktop/sa-sessions.txt
             Cost    Average Max
  + d2dac54dc3816195ed9ef083e2811c61 (89 entries, 60% Error)
  | Total:   10923.296 2432.935 12603.0
  | Render:  0.00000 0.00000 0.00000
  | DB:      51.9520 11.5710 53.0000

  + 3283ca1f8b1039f8c4403cbc7f9941c9 (18 entries, 5% Error)
  | Total:   2179.158 752.494 12728.0
  | Render:  9.70500 3.35100 17.2450
  | DB:      2.93100 1.01200 10.0000

  + 867bc340e6d65e673f29c57189feaf2b (133 entries, 0% Error)
  | Total:   1083.138 221.450 386.000
  | Render:  0.00000 0.00000 0.00000
  | DB:      44.2030 9.03700 90.0000