Allow to better debug initialize connection
What does this MR do and why?
Allow to better debug initialize connection
Enable optional debugging of unexpected DB connections during route
initialization. The backtrace was only logged if rails was not in
production mode. This can now be overriden by setting
SKIP_DEBUG_INITIALIZE_CONNECTIONS as envionment variable.
Relates https://gitlab.com/gitlab-com/request-for-help/-/work_items/4019
Testing
- Set rails into production mode
- Add
Project.firstsomewhere inconfig/routes/api.rb. - Confirm the startup fails with
RuntimeError: Database connection should not be called during initializers. - Set
SKIP_DEBUG_INITIALIZE_CONNECTIONS=offandGITLAB_LOG_LEVEL=debug - Confirm startup continues to fail, but with a
- Confirm
"InitializerConnections Backtraceis logged
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Clemens Beck