peek/peek-performance_bar

Bullet and Performance Bar Don't Get Along

Closed this issue · 3 comments

I have a Rails 3.2.18 app, with both peek-performance_bar (1.1.4) and [bullet](https://github.com/flyerhzm/bullet) (4.10.0) installed.

But when I have the peek-performance-bar gem in my Gemfile, bullet stops alerting. I've done some preliminary digging and can't see exactly where you're colliding, but it definitely seems you are.

My middleware stack:

$ rake middleware
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007f94e1f4b168>
use UTF8ParamValidator
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use BetterErrors::Middleware
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use CleanCookies::Rack
use ActionDispatch::Cookies
use ActiveRecord::SessionStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use ActionDispatch::Head
use Rack::ConditionalGet
use Rack::ETag
use ActionDispatch::BestStandardsSupport
use NewRelic::Rack::DeveloperMode
use NewRelic::Rack::BrowserMonitoring
use NewRelic::Rack::AgentHooks
use NewRelic::Rack::ErrorCollector
use Bullet::Rack
use ExceptionNotification::Rack
run Recruit::Application.routes

My bullet config is watching for N+1s and notifying using the the Rails logger, console, and alert, but changing that doesn't seem to matter.

My Peek config includes other views; they can be installed and bullet still works. But simply adding peek-performance-bar to the Gemfile is enough to kill Bullet.

Here's a thing that I'm trialling to see if it helps. At first blush, it does allow Bullet to raise errors when we take away a needed include line.

# config/application.rb
module MyRailsApp
  class Application < Rails::Application
    initializer "reorder_peek_and_bullet", after: %w(peek.performance_bar.mount_process_utilization bullet.configure_rails_initialization) do |app|
      app.config.middleware.delete Bullet::Rack
      app.config.middleware.insert_after Peek::Views::PerformanceBar::ProcessUtilization, Bullet::Rack
    end
  end
end

This can be closed since #22 has been merged. If you've stumbled across this issue, be sure you're on v1.2.0 or later.