razenha
razenha

Reputation: 7742

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?

Upvotes: 14

Views: 2378

Answers (1)

razenha
razenha

Reputation: 7742

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

Upvotes: 14

Related Questions