From e8c1be4ae7797f3ede588d2cf04a0155b4d6ce4a Mon Sep 17 00:00:00 2001 From: Eileen Uchitelle Date: Tue, 9 Oct 2018 14:08:25 -0400 Subject: Add allocations to template renderer subscription This PR adds the allocations to the instrumentation for template and partial rendering. Before: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (9.7ms) Rendered posts/new.html.erb within layouts/application (10.9ms) Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms) ``` After: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004) Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654) Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564) ``` --- actionview/lib/action_view/log_subscriber.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionview/lib/action_view/log_subscriber.rb') diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index db07b9d7fb..227f025385 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -18,7 +18,7 @@ module ActionView info do message = +" Rendered #{from_rails_root(event.payload[:identifier])}" message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] - message << " (#{event.duration.round(1)}ms)" + message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})" end end @@ -26,7 +26,7 @@ module ActionView info do message = +" Rendered #{from_rails_root(event.payload[:identifier])}" message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] - message << " (#{event.duration.round(1)}ms)" + message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})" message << " #{cache_message(event.payload)}" unless event.payload[:cache_hit].nil? message end @@ -37,7 +37,7 @@ module ActionView info do " Rendered collection of #{from_rails_root(identifier)}" \ - " #{render_count(event.payload)} (#{event.duration.round(1)}ms)" + " #{render_count(event.payload)} (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})" end end -- cgit v1.2.3