1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove URI object from ActiveResource notification, send the :mailer class in AM (like in AP#process_action) and remove locale instrumentation.

This commit is contained in:
José Valim 2010-01-15 14:45:18 +01:00
parent 4598d88749
commit e5a2a9fced
4 changed files with 8 additions and 10 deletions

View file

@ -510,7 +510,7 @@ module ActionMailer #:nodoc:
begin begin
ActiveSupport::Notifications.instrument("action_mailer.deliver", 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.class.set_payload_for_mail(payload, mail)
self.delivery_method.perform_delivery(mail) if perform_deliveries self.delivery_method.perform_delivery(mail) if perform_deliveries
end end

View file

@ -109,10 +109,7 @@ module ActionView
end end
def _render_layout(layout, locals, &block) 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) } layout.render(self, locals){ |*name| _layout_for(*name, &block) }
end end
end end
end end
end

View file

@ -106,8 +106,9 @@ module ActiveResource
private private
# Makes a request to the remote service. # Makes a request to the remote service.
def request(method, path, *arguments) def request(method, path, *arguments)
result = ActiveSupport::Notifications.instrument("active_resource.request", result = ActiveSupport::Notifications.instrument("active_resource.request") do |payload|
:method => method, :path => path, :site => site) do |payload| payload[:method] = method
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
payload[:result] = http.send(method, path, *arguments) payload[:result] = http.send(method, path, *arguments)
end end
handle_response(result) handle_response(result)

View file

@ -2,8 +2,8 @@ module ActiveResource
module Railties module Railties
class Subscriber < Rails::Subscriber class Subscriber < Rails::Subscriber
def request(event) def request(event)
result, site = event.payload[:result], event.payload[:site] result = event.payload[:result]
info "#{event.payload[:method].to_s.upcase} #{site.scheme}://#{site.host}:#{site.port}#{event.payload[:path]}" 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] info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration]
end end