提交 21a71cd5 编写于 作者: A Aaron Patterson

instrumenter can't be cached because the app could be called from

different threads.
上级 2ae9166d
......@@ -11,7 +11,6 @@ class Logger < ActiveSupport::LogSubscriber
def initialize(app, taggers = nil)
@app = app
@taggers = taggers || []
@instrumenter = ActiveSupport::Notifications.instrumenter
end
def call(env)
......@@ -33,7 +32,8 @@ def call_app(request, env)
logger.debug ''
end
@instrumenter.start 'request.action_dispatch', request: request
instrumenter = ActiveSupport::Notifications.instrumenter
instrumenter.start 'request.action_dispatch', request: request
logger.info started_request_message(request)
resp = @app.call(env)
resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
......@@ -70,7 +70,8 @@ def compute_tags(request)
private
def finish(request)
@instrumenter.finish 'request.action_dispatch', request: request
instrumenter = ActiveSupport::Notifications.instrumenter
instrumenter.finish 'request.action_dispatch', request: request
end
def development?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册