Sha256: ace83e2853ce8b8ff7fb8aa657c229952a34ec6d17406560c549f9bcd1fc11a9
Contents?: true
Size: 1.47 KB
Versions: 18
Compression:
Stored size: 1.47 KB
Contents
require 'active_support/core_ext/module/attr_internal' require 'superstore/log_subscriber' module Superstore module Railties # :nodoc: module ControllerRuntime #:nodoc: extend ActiveSupport::Concern module ClassMethods # :nodoc: def log_process_action(payload) messages, cassandra_object_runtime = super, payload[:cassandra_object_runtime] if cassandra_object_runtime.to_i > 0 messages << ("Superstore: %.1fms" % cassandra_object_runtime.to_f) end messages end end #private attr_internal :cassandra_object_runtime def process_action(action, *args) # We also need to reset the runtime before each action # because of queries in middleware or in cases we are streaming # and it won't be cleaned up by the method below. Superstore::LogSubscriber.reset_runtime super end def cleanup_view_runtime runtime_before_render = Superstore::LogSubscriber.reset_runtime runtime = super runtime_after_render = Superstore::LogSubscriber.reset_runtime self.cassandra_object_runtime = runtime_before_render + runtime_after_render runtime - runtime_after_render end def append_info_to_payload(payload) super payload[:cassandra_object_runtime] = (cassandra_object_runtime || 0) + Superstore::LogSubscriber.reset_runtime end end end end
Version data entries
18 entries across 18 versions & 1 rubygems