Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rack-mini-profiler is showing profiling static files

I'm using rack-mini-profiler after watching it's railscast (http://railscasts.com/episodes/368-miniprofiler).

I added it to my Gemfile:

gem 'rack-mini-profiler'

Installed it using bundler and started my dev environment using "rails s". The profilling works, it shows up at the left upper corner of the web page, but it happens to profile all the static files (js, css, images, etc). It also seems that it has a limit of 10 lines, so the actual request is hidden.

enter image description here

enter image description here

Is it possible to configure it so it will avoid profiling static files?

like image 238
razenha Avatar asked Jul 29 '12 19:07

razenha


People also ask

How do I disable 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. So, http://localhost:3000/articles?pp=disable would disable the profiler until it was re-enabled.

What is MiniProfiler C#?

MiniProfiler is a library and UI for profiling your application. By letting you see where your time is spent, which queries are run, and any other custom timings you want to add, MiniProfiler helps you debug issues and optimize performance.


1 Answers

Ok, here's how I have done it:

Used the 0.0.18 version of the gem (which is not on rubygems.org, you'll have to install it from the project's git repo) and created a config file at /config/initializers/miniprofiler.rb:

Rack::MiniProfiler.config.skip_paths << "/images/"
Rack::MiniProfiler.config.skip_paths << "/stylesheets/"
Rack::MiniProfiler.config.skip_paths << "/javascripts/"
Rack::MiniProfiler.config.skip_paths << "/favicon.ico"

That did the trick

like image 155
razenha Avatar answered Sep 21 '22 13:09

razenha