开发者

Showing response time in a rails app

开发者 https://www.devze.com 2022-12-24 14:07 出处:网络
I want to display a This page took x seconds widget at the bottom of every page in my rails application.I would like x to reflect the approximate amount of time the request spent on my server.What is

I want to display a This page took x seconds widget at the bottom of every page in my rails application. I would like x to reflect the approximate amount of time the request spent on my server. What is a good way of doing this?

Edit: My production server is on phusion passenger and development environment on mongerel. Would love to have a solution that works well with both.

Update:开发者_运维知识库 I think for the purpose of this question, the railscast solution is a bit overboard. I modified the middleware suggested in there to just set up a constant and used that in my layout. This way I won't have to change any content-length headers. Thanks again neutrino. Rack middleware are very interesting.


First I thought, that's a good use for a rack middleware. Then I thought uh, Ryan has got one on this. Then voila, a railscast on how to measure the response time via rack middleware :)

Obviously works with both mongrel and passenger.

0

精彩评论

暂无评论...
验证码 换一张
取 消