Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Rack-Mini-Profiler temporarily?

I'm using rack mini profiler in rails just fine, but during some coding sessions especially where I'm working on a lot of different client side code, it gets in the way. (mainly in my client side debugging tools network graphs, etc.)

I'm trying to turn it off with a before filter, that also serves to see if the user is authorized to see the profile anyway, but "deauthorize" doesn't seem to do anything for me. Here's my code called as a before filter:

def miniprofiler    off = true  if off || !current_user   Rack::MiniProfiler.deauthorize_request   return  elsif current_user.role_symbols.include?(:view_page_profiles)       Rack::MiniProfiler.authorize_request   return  end  Rack::MiniProfiler.deauthorize_request end 

I also know there is a setting "Rack::MiniProfiler.config.authorization_mode" but I can't find docs on what the possible settings are, and not seeing it used in the code? Right now its telling me :allow_all, but :allow_none doesn't do anything either.

Even if I can just temporarily set a value in the dev environment file and restart the server, that would serve my purposes.

like image 536
Dave Sanders Avatar asked Sep 13 '12 15:09

Dave Sanders


People also ask

How do I turn off my rack mini profiler?

Skip, disable and enable the Rack Mini Profiler Entering a query with pp=skip prevents it from loading for a single page load. You can reload it by going back with your browser. To turn the profiler off, use disable.

What is rack mini profiler?

Rack Mini Profiler helps you to easily detect Database issues, Memory issues and Time spent by gems/libs. This tool was designed to run in production but it also works fine in development.


2 Answers

Get latest and type:

http://mysite.com?pp=disable

When you are done type

http://mysite.com?pp=enable

See ?pp=help for all the options:

 Append the following to your query string:    pp=help : display this screen   pp=env : display the rack environment   pp=skip : skip mini profiler for this request   pp=no-backtrace : don't collect stack traces from all the SQL executed (sticky, use pp=normal-backtrace to enable)   pp=normal-backtrace (*) : collect stack traces from all the SQL executed and filter normally   pp=full-backtrace : enable full backtraces for SQL executed (use pp=normal-backtrace to disable)    pp=sample : sample stack traces and return a report isolating heavy usage (experimental works best with the stacktrace gem)   pp=disable : disable profiling for this session    pp=enable : enable profiling for this session (if previously disabled)   pp=profile-gc: perform gc profiling on this request, analyzes ObjectSpace generated by request (ruby 1.9.3 only)   pp=profile-gc-time: perform built-in gc profiling on this request (ruby 1.9.3 only) 
like image 67
Sam Saffron Avatar answered Sep 22 '22 17:09

Sam Saffron


You can also use Alt+p to toggle.

like image 38
lobati Avatar answered Sep 24 '22 17:09

lobati