aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/caching.rb12
-rw-r--r--actionpack/lib/action_dispatch/caching/fragments.rb9
2 files changed, 14 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index e832f4adf4..999c2636da 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -29,5 +29,17 @@ module ActionController
included do
include ActionDispatch::Caching
end
+
+ def instrument_payload(key)
+ {
+ controller: controller_name,
+ action: action_name,
+ key: key
+ }
+ end
+
+ def instrument_name
+ "action_controller"
+ end
end
end
diff --git a/actionpack/lib/action_dispatch/caching/fragments.rb b/actionpack/lib/action_dispatch/caching/fragments.rb
index c410aaf03a..dcc490776e 100644
--- a/actionpack/lib/action_dispatch/caching/fragments.rb
+++ b/actionpack/lib/action_dispatch/caching/fragments.rb
@@ -135,13 +135,8 @@ module ActionDispatch
end
def instrument_fragment_cache(name, key) # :nodoc:
- payload = {
- controller: controller_name,
- action: action_name,
- key: key
- }
-
- ActiveSupport::Notifications.instrument("#{name}.action_controller", payload) { yield }
+ payload = instrument_payload(key)
+ ActiveSupport::Notifications.instrument("#{name}.#{instrument_name}", payload) { yield }
end
end
end