# Tracking latency in rails

**URL:** <https://www.ruby-forum.com/t/tracking-latency-in-rails/94957>\
**Category:** Rails\
**Created:** [May 18, 2006, 4:54am UTC](https://www.ruby-forum.com/t/tracking-latency-in-rails/94957 "2006-05-18T04:54:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [May 18, 2006, 4:54am UTC](https://www.ruby-forum.com/t/tracking-latency-in-rails/94957/1 "2006-05-18T04:54:56Z")

</div>

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.
