parent
42eb1fa775
commit
f921d1c547
|
@ -15,6 +15,9 @@ if defined?(Rack::MiniProfiler)
|
||||||
(env['PATH_INFO'] !~ /commits-widget/)
|
(env['PATH_INFO'] !~ /commits-widget/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# without a user provider our results will use the ip address for namespacing
|
||||||
|
# with a load balancer in front this becomes really bad as some results can
|
||||||
|
# be stored associated with ip1 as the user and retrieved using ip2 causing 404s
|
||||||
Rack::MiniProfiler.config.user_provider = lambda do |env|
|
Rack::MiniProfiler.config.user_provider = lambda do |env|
|
||||||
user = CurrentUser.lookup_from_env(env)
|
user = CurrentUser.lookup_from_env(env)
|
||||||
user ? user.id.to_s : Rack::Request.new(env).ip
|
user ? user.id.to_s : Rack::Request.new(env).ip
|
||||||
|
@ -25,28 +28,27 @@ if defined?(Rack::MiniProfiler)
|
||||||
Rack::MiniProfiler.config.backtrace_ignores << /lib\/rack\/message_bus.rb/
|
Rack::MiniProfiler.config.backtrace_ignores << /lib\/rack\/message_bus.rb/
|
||||||
Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/silence_logger/
|
Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/silence_logger/
|
||||||
Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/quiet_logger/
|
Rack::MiniProfiler.config.backtrace_ignores << /config\/initializers\/quiet_logger/
|
||||||
#Rack::MiniProfiler.config.style = :awesome_bar
|
|
||||||
|
|
||||||
# require "#{Rails.root}/vendor/backports/notification"
|
# require "#{Rails.root}/vendor/backports/notification"
|
||||||
|
|
||||||
inst = Class.new
|
# inst = Class.new
|
||||||
class << inst
|
# class << inst
|
||||||
def start(name,id,payload)
|
# def start(name,id,payload)
|
||||||
if Rack::MiniProfiler.current && name !~ /(process_action.action_controller)|(render_template.action_view)/
|
# if Rack::MiniProfiler.current && name !~ /(process_action.action_controller)|(render_template.action_view)/
|
||||||
@prf ||= {}
|
# @prf ||= {}
|
||||||
@prf[id] ||= []
|
# @prf[id] ||= []
|
||||||
@prf[id] << Rack::MiniProfiler.start_step("#{payload[:serializer] if name =~ /serialize.serializer/} #{name}")
|
# @prf[id] << Rack::MiniProfiler.start_step("#{payload[:serializer] if name =~ /serialize.serializer/} #{name}")
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
def finish(name,id,payload)
|
# def finish(name,id,payload)
|
||||||
if Rack::MiniProfiler.current && name !~ /(process_action.action_controller)|(render_template.action_view)/
|
# if Rack::MiniProfiler.current && name !~ /(process_action.action_controller)|(render_template.action_view)/
|
||||||
t = @prf[id].pop
|
# t = @prf[id].pop
|
||||||
@prf.delete id unless t
|
# @prf.delete id unless t
|
||||||
Rack::MiniProfiler.finish_step t
|
# Rack::MiniProfiler.finish_step t
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
# disabling for now cause this slows stuff down too much
|
# disabling for now cause this slows stuff down too much
|
||||||
# ActiveSupport::Notifications.subscribe(/.*/, inst)
|
# ActiveSupport::Notifications.subscribe(/.*/, inst)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue