add RackTimer
This commit is contained in:
parent
c194f25a24
commit
b731127ea8
16
config.ru
16
config.ru
|
@ -15,4 +15,20 @@ skip = ['Travis::Memory', 'GH::ResponseWrapper', 'Travis::NewRelic']
|
|||
target.load_constants! :only => only, :skip => skip, :debug => false
|
||||
end
|
||||
|
||||
# https://help.heroku.com/tickets/92756
|
||||
class RackTimer
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
start_request = Time.now
|
||||
status, headers, body = @app.call(env)
|
||||
elapsed = (Time.now - start_request) * 1000
|
||||
$stdout.puts("request-id=#{env['HTTP_HEROKU_REQUEST_ID']} measure.rack-request=#{elapsed.round}ms")
|
||||
[status, headers, body]
|
||||
end
|
||||
end
|
||||
|
||||
use RackTimer
|
||||
run Travis::Api::App.new
|
||||
|
|
Loading…
Reference in New Issue
Block a user