Sha256: 26b6bf028d46b14520bb4a55a7a798dc18678e7020a5d287b7571f796a7c0cb7
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'load_speed' require 'stopwatch_log' require 'stopwatch_event' module Stopwatch class Railtie < Rails::Railtie initializer "newplugin.initialize" do |app| app.config.middleware.use "Rack::LoadSpeed" ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |*args| StopwatchLog.reset_query_count StopwatchLog.reset_events end ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args| StopwatchLog.event = ActiveSupport::Notifications::Event.new(*args) end ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload| StopwatchLog.increment_query_count if payload[:name] != "CACHE" StopwatchLog.increment_sub_query_count if payload[:name] != "CACHE" end ActiveSupport::Notifications.subscribe "render_partial.action_view" do |*args| event = ActiveSupport::Notifications::Event.new(*args) stopwatch_event = StopwatchEvent.new(event) stopwatch_event.query_count = StopwatchLog.sub_query_count StopwatchLog.events << stopwatch_event StopwatchLog.reset_sub_query_count end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stopwatch-0.0.3 | lib/stopwatch.rb |