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