MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.7k stars 402 forks source link

Unable to set `enable_advanced_debugging_tools` to true for Rails app running in production #515

Closed wmene closed 2 years ago

wmene commented 2 years ago

I have a rails app running in production mode that I would like to analyze with memory profiling. In my config/intializers/profiler.rb file, I have:

if Rails.env.production?
  include RedisHelper
  Rack::MiniProfiler.config.storage_options = redis_opts
  Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore

  # Temporarily enable memory profiling in production
  Rack::MiniProfiler.config.enable_advanced_debugging_tools = true
end

However, whenever I try to view the profiling pages, I get the following:

This feature is disabled by default, to enable set the enable_advanced_debugging_tools option to true in Mini Profiler config.

If I start a rails console on the production instance, the enable_advanced_debugging_tools is set to false. It's as if setting it was ignored.

I know my initializer is running because Rack::MiniProfiler.config.storage is set to Rack::MiniProfiler::RedisStore when I check rails console

Am I setting this value incorrectly? Should it be done in another spot?

wmene commented 2 years ago

Still do not understand why the rack-mini-profiler railtie initializer ran after our app's initializer, but found a work-around. I now set Rack::MiniProfiler.config.enable_advanced_debugging_tools = true in a Rails.config.to_prepare block