Sha256: 5ae0edc2b9fec3d22e3d616cc0e5e17eaff961c0862d58af948642dfd2ac47cd
Contents?: true
Size: 1.2 KB
Versions: 19
Compression:
Stored size: 1.2 KB
Contents
require 'benchmark' module Errplane module Rails module Benchmarking def self.included(base) base.send(:alias_method_chain, :perform_action, :instrumentation) base.send(:alias_method_chain, :view_runtime, :instrumentation) base.send(:alias_method_chain, :active_record_runtime, :instrumentation) end private def perform_action_with_instrumentation ms = Benchmark.ms { perform_action_without_instrumentation } if Errplane.configuration.instrumentation_enabled Errplane.report "controllers/#{params[:controller]}/#{params[:action]}", :value => ms.ceil end end def view_runtime_with_instrumentation runtime = view_runtime_without_instrumentation if Errplane.configuration.instrumentation_enabled Errplane.report "views", :value => runtime.split.last.to_f.ceil end runtime end def active_record_runtime_with_instrumentation runtime = active_record_runtime_without_instrumentation if Errplane.configuration.instrumentation_enabled Errplane.report "db", :value => runtime.split.last.to_f.ceil end runtime end end end end
Version data entries
19 entries across 19 versions & 1 rubygems