Commit Graph

1 Commits

Author SHA1 Message Date
Spencer Olson 205fe619a3 add prosopite n+1 query detection
Detection is disabled by default, but can be enabled by setting the
N_PLUS_ONE_DETECTION environment variable to 'true'. For more information,
see doc/detect_n_plus_one_queries.md

closes EVAL-2973
flag=none

Test Plan:
1. Start rails
2. Create a coures with multiple assignments and go to
   /courses/:id/assignments
3. Notice there are no N+1 query warnings shown in log/development.log
   and that log/prosopite.log does not exist.
4. Run the `spec/models/grading_period_spec.rb` spec file and notice that
   no N+1 query warnings are shown in log/test.log
5. Set `N_PLUS_ONE_DETECTION: 'true'` in docker-compose.override.yml
   under web: :environment.
6. Stop/start rails
7. Go to /courses/:id/assignments
8. Notice there are N+1 query warnings shown in log/development.log
   and that log/prosopite.log exists and also has warnings in it.
9. Run the `spec/models/grading_period_spec.rb` spec file and notice that
   N+1 query warnings are shown in log/test.log (but not in
   log/prosopite.log)

Change-Id: I33f43e65df10e2161f1a0687eee3e0b7826bfe3d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/313592
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
2023-03-29 22:34:20 +00:00