module DatastaxRails::Instrumentation::ControllerRuntime

Hooks into ActionController to display Solr and CQL runtime

@see github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/controller_runtime.rb

Protected Instance Methods

append_info_to_payload(payload) click to toggle source
Calls superclass method
# File lib/datastax_rails/instrumentation/controller_runtime.rb, line 36
def append_info_to_payload(payload)
  super
  payload[:solr_runtime] = (solr_runtime || 0) + DatastaxRails::Instrumentation::LogSubscriber.reset_solr_runtime
  payload[:cql_runtime] = (cql_runtime || 0) + DatastaxRails::Instrumentation::LogSubscriber.reset_cql_runtime
end
cleanup_view_runtime() click to toggle source
Calls superclass method
# File lib/datastax_rails/instrumentation/controller_runtime.rb, line 23
def cleanup_view_runtime
  solr_rt_before_render = DatastaxRails::Instrumentation::LogSubscriber.reset_solr_runtime
  cql_rt_before_render = DatastaxRails::Instrumentation::LogSubscriber.reset_cql_runtime
  self.solr_runtime = (solr_runtime || 0) + solr_rt_before_render
  self.cql_runtime = (cql_runtime || 0) + cql_rt_before_render
  runtime = super
  solr_rt_after_render = DatastaxRails::Instrumentation::LogSubscriber.reset_solr_runtime
  cql_rt_after_render = DatastaxRails::Instrumentation::LogSubscriber.reset_cql_runtime
  self.solr_runtime += solr_rt_after_render
  self.cql_runtime += cql_rt_after_render
  runtime - solr_rt_after_render - cql_rt_after_render
end
process_action(action, *args) click to toggle source
Calls superclass method
# File lib/datastax_rails/instrumentation/controller_runtime.rb, line 17
def process_action(action, *args)
  DatastaxRails::Instrumentation::LogSubscriber.reset_solr_runtime
  DatastaxRails::Instrumentation::LogSubscriber.reset_cql_runtime
  super
end