module ActionController::Instrumentation
def append_info_to_payload(payload) #:nodoc:
:api: plugin
with the payload, so you can add more information.
Everytime after an action is processed, this method is invoked
def append_info_to_payload(payload) #:nodoc: payload[:view_runtime] = view_runtime end
def cleanup_view_runtime #:nodoc:
:api: plugin
end
super - time_taken_in_something_expensive
def cleanup_view_runtime
views wrongly, like database querying time.
A hook which allows you to clean up any time taken into account in
def cleanup_view_runtime #:nodoc: yield end
def process_action(action, *args)
def process_action(action, *args) raw_payload = { :controller => self.class.name, :action => self.action_name, :params => request.filtered_parameters, :formats => request.formats.map(&:to_sym), :method => request.method, :path => (request.fullpath rescue "unknown") } ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup) ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload| result = super payload[:status] = response.status append_info_to_payload(payload) result end end
def redirect_to(*args)
def redirect_to(*args) ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload| result = super payload[:status] = self.status payload[:location] = self.location result end end
def render(*args)
def render(*args) render_output = nil self.view_runtime = cleanup_view_runtime do Benchmark.ms { render_output = super } end render_output end
def send_data(data, options = {})
def send_data(data, options = {}) ActiveSupport::Notifications.instrument("send_data.action_controller", options) do super end end
def send_file(path, options={})
def send_file(path, options={}) ActiveSupport::Notifications.instrument("send_file.action_controller", options.merge(:path => path)) do super end end