diff options
author | Daniel Schierbeck <dasch@zendesk.com> | 2013-05-03 14:28:16 +0200 |
---|---|---|
committer | Daniel Schierbeck <dasch@zendesk.com> | 2013-05-06 12:00:11 +0200 |
commit | d6b9e8e9319f2a568224456e3e15759b76581eed (patch) | |
tree | 3a53c767389529f29221189231d1b76e7d60fdf4 /actionpack/lib | |
parent | 6023a5049172e2222181881679b56c0e29034c96 (diff) | |
download | rails-d6b9e8e9319f2a568224456e3e15759b76581eed.tar.gz rails-d6b9e8e9319f2a568224456e3e15759b76581eed.tar.bz2 rails-d6b9e8e9319f2a568224456e3e15759b76581eed.zip |
Instrument template compilation
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 946db1df79..ebbc1c79d6 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -138,7 +138,7 @@ module ActionView # we use a bang in this instrumentation because you don't want to # consume this in production. This is only slow if it's being listened to. def render(view, locals, buffer=nil, &block) - ActiveSupport::Notifications.instrument("!render_template.action_view", virtual_path: @virtual_path, identifier: @identifier) do + instrument("!render_template") do compile!(view) view.send(method_name, locals, buffer, &block) end @@ -245,7 +245,9 @@ module ActionView mod = view.singleton_class end - compile(view, mod) + instrument("!compile_template") do + compile(view, mod) + end # Just discard the source if we have a virtual path. This # means we can get the template back. @@ -335,5 +337,10 @@ module ActionView def identifier_method_name #:nodoc: inspect.gsub(/[^a-z_]/, '_') end + + def instrument(action, &block) + payload = { virtual_path: @virtual_path, identifier: @identifier } + ActiveSupport::Notifications.instrument("#{action}.action_view", payload, &block) + end end end |