Tracking latency in rails

I’ve built a web-app and i want to start tracking request latencies so
that
i can see how the app handles more and more people using it. However,
i’m
not sure how this can be done.

I’d like to be able to log the start-time when the request comes in and
then
log the end time as the response gets sent out. Do i need to bookend
each
action with a before-filter and after-filter? Also, how could i track
these
numbers independent of caching? From my understanding, if i use rails
caching, it will not go into the code if the page exists in the cache.

I know that if i use caches_action, then the filters will be run,
however,
its important that i can log the times as close to the use as possible.
I
think this means either just before it hits dispatch.fcgi or just after.
For certain actions i’d also like to log request information (referer
urls,
IP address, etc). Does this mean i always have to go into the code and
not
serve files straight from disk?

If anyone has implemented a good system for tracking real-time
latencies,
i’d greatly appreciate hearing about it.

Thanks in advance.