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
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

View file

@ -109,10 +109,7 @@ module ActionView
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

View file

@ -106,9 +106,10 @@ module ActiveResource
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

View file

@ -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