Agile Web Development

Build it. Launch it. Love it.

custom_benchmarks

Custom Benchmarks allow you to easily add your own information to the
benchmark line logged at the end of each request. e.g.,

Completed in 0.40306 (2 reqs/sec) | Rendering: 0.05003 (12%) | DB: 0.04571 (11%) | Search: 0.16429,1 (40%) | PID: 22426 | 200 OK [http://www.zvents.com/welcome/index]

Typically, the log line includes the latency associated with executing
specific parts of a request. In the example above, we have added a
measurement of search latency. But you can use Custom Benchmarks to add
any information to the log line. The example above also shows the ID of
the process (PID) that served this request. The PID is useful when parsing
information from logs that contain data from multiple processes.

Adding your own information is as easy as:

class ApplicationController < ActionController::Base
custom_benchmark {|runtime| " | PID: #{$$}" }
...
end

Vitals

Home http://blog.zvents.com/2006/10/31/rails-plugin-custom-benchmarks
Repository svn://rubyforge.org/var/svn/zventstools/projects/custom_benchmarks
License Rails' (MIT)
Rating (2 votes)
Owner Tyler Kovacs
Created 1 November 2006

Comments

Add a comment