bullet
bullet copied to clipboard
Missing Call Stack
Recently when I added bullet to a current project I noticed that the call stack for removing/avoiding unused eager loading is not useful at all. It either appears empty or just shows the require in a rails app. Even when showing the fullpath (using Bullet.stacktrace_includes
), it really is not helpful at all, just showing the gem's stacktrace where the warning itself is issued.
However, the recommendation to add eager loading is working well and I do see a useful call stack in that case. See below an example log for a controller action I created with both an unused eager loading and and N+1 query:
2018-02-02 18:14:24[WARN] user: test
GET /
USE eager loading detected
Car => [:owner]
Add to your finder: :includes => [:owner]
Call stack
/projects/test_bullet/app/controllers/home_controller.rb:3:in `block in index'
/projects/test_bullet/app/controllers/home_controller.rb:3:in `index'
2018-02-02 18:14:24[WARN] user: test
GET /
AVOID eager loading detected
CarDealer => [:cars]
Remove from your finder: :includes => [:cars]
Call stack
2018-02-02 18:14:24[WARN] user: test
GET /
AVOID eager loading detected
Engine => [:parts]
Remove from your finder: :includes => [:parts]
Call stack
Is this a bug or a feature being developed or am I missing something?
Thanks
I'm wondering the same thing.
I'm having the same issue, using bullet-5.7.5 in a rails 4 app. It makes debugging the unused eager loading a bit difficult. If I find out more I will update here.
Same issue here
Same issue here. Rails 5.1.4, ruby 2.4.2, bullet 5.7.6
Same for me, Ruby 2.5.0, Rails, 5.2.1, Bullet 5.7.6 Anyone found a workaround? Perhaps earlier Bullet versions that work?
Any updates here?
Call stack is not supported for unused eager loading yet.
For "USE eager loading detected", it's triggered when the method is called. For "AVOID eager loading detected", it's triggered after the request is done.
I'm having that issue as well. Somehow it affects turbolinks and I end up with JS recursion error. If I make the code changes to not receive that message, turbolinks works as a charm. bullet (6.0.0) turbolinks (5.2.0) rails (5.2.3)
This makes "avoid eager loading" basically useless. It needs to keep track of where the loading occurred.
I'm getting a similar issue. Rails 7.0.4, Ruby 3.1.2, bullet (7.0.4), empty callstack:
config.after_initialize do
Bullet.enable = true
Bullet.alert = false # JS popup
Bullet.bullet_logger = true
Bullet.console = false # Browser console
Bullet.rails_logger = false
Bullet.add_footer = true
end
2022-12-02 19:26:42[WARN] user: will
GET /app/test-account-doyy5iuln/applications/test-app-1lgh5402jj
USE eager loading detected
Membership => [:account]
Add to your query: .includes([:account])
Call stack
2022-12-02 19:29:21[WARN] user: will
GET /app/test-account-doyy5iuln/applications/test-app-1lgh5402jj
USE eager loading detected
Membership => [:account]
Add to your query: .includes([:account])
Call stack
2022-12-02 19:30:11[WARN] user: will
GET /app/test-account-doyy5iuln/applications/test-app-1lgh5402jj/thing/1644
USE eager loading detected
Membership => [:account]
Add to your query: .includes([:account])
Call stack