Heroku adds a HTTP header called X-Request-Start. Its a unix timestamp.
I have a Rails 3.2 application at Heroku and want to log response time for HTTP requests.
Whats the latest point of possible integration in Rails to do:
start = Time.at(env['HTTP_X_REQUEST_START'].to_f / 1000.0).utc
response_time = Time.now.utc - start
I’m thinking of implementing a Rack middleware to calculate the response time.
Are you aware that Heroku already logs your response time? In your terminal do
heroku logs -t --app your-app-nameand you’ll seeservice=xxxmswhich is the number of miliseconds each request takes.