提交 e5a2a9fc 编写于 作者: J José Valim

Remove URI object from ActiveResource notification, send the :mailer class in...

Remove URI object from ActiveResource notification, send the :mailer class in AM (like in AP#process_action) and remove locale instrumentation.
上级 4598d887
......@@ -510,7 +510,7 @@ def deliver!(mail = @mail)
begin
ActiveSupport::Notifications.instrument("action_mailer.deliver",
:template => template, :mailer_name => mailer_name) do |payload|
:template => template, :mailer => self.class.name) do |payload|
self.class.set_payload_for_mail(payload, mail)
self.delivery_method.perform_delivery(mail) if perform_deliveries
end
......
......@@ -109,10 +109,7 @@ def _render_template(template, layout = nil, options = {})
end
def _render_layout(layout, locals, &block)
ActiveSupport::Notifications.instrument("action_view.render_layout",
:identifier => layout.identifier) do
layout.render(self, locals){ |*name| _layout_for(*name, &block) }
end
layout.render(self, locals){ |*name| _layout_for(*name, &block) }
end
end
end
......@@ -106,9 +106,10 @@ def head(path, headers = {})
private
# Makes a request to the remote service.
def request(method, path, *arguments)
result = ActiveSupport::Notifications.instrument("active_resource.request",
:method => method, :path => path, :site => site) do |payload|
payload[:result] = http.send(method, path, *arguments)
result = ActiveSupport::Notifications.instrument("active_resource.request") do |payload|
payload[:method] = method
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
payload[:result] = http.send(method, path, *arguments)
end
handle_response(result)
rescue Timeout::Error => e
......
......@@ -2,8 +2,8 @@ module ActiveResource
module Railties
class Subscriber < Rails::Subscriber
def request(event)
result, site = event.payload[:result], event.payload[:site]
info "#{event.payload[:method].to_s.upcase} #{site.scheme}://#{site.host}:#{site.port}#{event.payload[:path]}"
result = event.payload[:result]
info "#{event.payload[:method].to_s.upcase} #{event.payload[:request_uri]}"
info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册