Reputation: 1672
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.
Upvotes: 4
Views: 765
Reputation: 8836
Are you aware that Heroku already logs your response time? In your terminal do heroku logs -t --app your-app-name
and you'll see service=xxxms
which is the number of miliseconds each request takes.
Upvotes: 5