module Mongoid::Railties::ControllerRuntime::ControllerExtension
This extension mimics the Rails’ internal method to measure ActiveRecord runtime during request processing. It appends MongoDB runtime value (‘mongoid_runtime`) into payload of instrumentation event `process_action.action_controller`.
Protected Instance Methods
Source
# File lib/mongoid/railties/controller_runtime.rb, line 35 def append_info_to_payload(payload) super payload[:mongoid_runtime] = (mongoid_runtime || 0) + Collector.reset_runtime end
Add the measurement to the instrumentation event payload.
Calls superclass method
Source
# File lib/mongoid/railties/controller_runtime.rb, line 26 def cleanup_view_runtime mongo_rt_before_render = Collector.reset_runtime runtime = super mongo_rt_after_render = Collector.reset_runtime self.mongoid_runtime = mongo_rt_before_render + mongo_rt_after_render runtime - mongo_rt_after_render end
Override to collect the measurements.
Calls superclass method
Source
# File lib/mongoid/railties/controller_runtime.rb, line 20 def process_action(action, *args) Collector.reset_runtime super end
Reset the runtime before each action.
Calls superclass method