Disallow database N+1 queries in the test suite and log them in production
Similar to Gitaly I want to start banning N+1 database queries. For this to work our test suite needs to somehow throw an error whenever it encounters N+1 queries. In production however we want to log these instances somewhere, without the user knowing. This allows us to build a collection of offending code locations that we can then fix over time.
Steps:
- Enable Bullet in the test environment regardless of
ENABLE_BULLET
being set - Ensure Bullet raises for N+1 queries in the test environment
- Disable
Bullet.unused_eager_loading_enable
so we don't produce errors for unused eager loading - Enable Sentry notifications for production
Edited by Yorick Peterse