From 2d0c703c922758dc36df8a20a56894484013b0f1 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 22 Dec 2009 16:18:22 -0600 Subject: [PATCH] Use Rack::Runtime middleware so the reported time includes the entire middleware stack --- actionpack/lib/action_controller/metal/benchmarking.rb | 1 - railties/lib/rails/application.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/benchmarking.rb b/actionpack/lib/action_controller/metal/benchmarking.rb index e58df69172d4c..f73f635b0d28b 100644 --- a/actionpack/lib/action_controller/metal/benchmarking.rb +++ b/actionpack/lib/action_controller/metal/benchmarking.rb @@ -53,7 +53,6 @@ def process_action(*args) log_message << " [#{complete_request_uri rescue "unknown"}]" logger.info(log_message) - response.headers["X-Runtime"] = "%.0f" % ms else super end diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index e6f2d304291e4..d7a89ba2be02e 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -208,6 +208,7 @@ def call(env) initializer :initialize_middleware_stack do if config.frameworks.include?(:action_controller) config.middleware.use(::Rack::Lock, :if => lambda { ActionController::Base.allow_concurrency }) + config.middleware.use(::Rack::Runtime) config.middleware.use(ActionDispatch::ShowExceptions, lambda { ActionController::Base.consider_all_requests_local }) config.middleware.use(ActionDispatch::Callbacks, lambda { ActionController::Dispatcher.prepare_each_request }) config.middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options })