bullet icon indicating copy to clipboard operation
bullet copied to clipboard

Missing Call Stack

Open gdgp opened this issue 7 years ago • 10 comments

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

gdgp avatar Feb 05 '18 08:02 gdgp

I'm wondering the same thing.

jasonadkison avatar Jun 13 '18 17:06 jasonadkison

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.

andi-dev avatar Jun 24 '18 08:06 andi-dev

Same issue here

bkazez avatar Aug 13 '18 16:08 bkazez

Same issue here. Rails 5.1.4, ruby 2.4.2, bullet 5.7.6

kleinjm avatar Oct 09 '18 15:10 kleinjm

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?

DannyBen avatar Oct 15 '18 10:10 DannyBen

Any updates here?

usmanasif avatar Oct 23 '18 13:10 usmanasif

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.

flyerhzm avatar Oct 29 '18 14:10 flyerhzm

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)

gustavoaborges avatar Jul 12 '19 22:07 gustavoaborges

This makes "avoid eager loading" basically useless. It needs to keep track of where the loading occurred.

danny-pflughoeft avatar Mar 10 '22 20:03 danny-pflughoeft

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

wjessop avatar Dec 02 '22 22:12 wjessop