Skip to content

Commit a550e66

Browse files
m-bucherekohl
andcommitted
Fixes #36898 - add rack-mini-profiler
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
1 parent 9a8cb28 commit a550e66

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

bundler.d/profiling.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
group :profiling, optional: true do
2+
gem 'rack-mini-profiler'
3+
4+
# For memory profiling
5+
gem 'memory_profiler'
6+
7+
# For call-stack profiling flamegraphs
8+
gem 'stackprof'
9+
end

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
Bundler.ui = Bundler::UI::Silent.new if Rails.env.production?
4242

4343
Bundler.require(*Rails.groups)
44-
optional_bundler_groups = %w[assets ec2 fog libvirt openstack vmware redis]
44+
optional_bundler_groups = %w[assets ec2 fog libvirt openstack profiling vmware redis]
4545
optional_bundler_groups.each do |group|
4646
Bundler.require(group)
4747
rescue LoadError
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if defined? Rack::MiniProfiler
2+
# enable profiling for all pages; per-default it is disabled on production-env
3+
Rack::MiniProfiler.config.authorization_mode = SETTINGS.fetch(:profiler_authorization_mode, :allow_all)
4+
5+
# enable additional profiling-features
6+
Rack::MiniProfiler.config.enable_advanced_debugging_tools = true
7+
end

config/settings.yaml.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@
144144
# :options:
145145
# :compress: true
146146
# :namespace: foreman
147+
148+
# set to :allow_authorized to not run rack-mini-profiler on all pages
149+
# see https://github.com/MiniProfiler/rack-mini-profiler#access-control-in-non-development-environments
150+
# :profiler_authorization_mode: :allow_all

0 commit comments

Comments
 (0)