Slide 44
Slide 44 text
Performance*metrics
module MethodTracer
def trace_method(method, name=nil)
name ||= "#{self.name.underscore.gsub('/', '.')}.#{method}"
original_method = :"_untraced_method_#{method}"
return if method_defined?(original_method)
alias_method original_method, method
define_method method do |*args, &block|
ActiveSupport::Notifications.instrument("performance.#{name}") do
send(original_method, *args, &block)
end
end
end
end