fix(server): app initialization starts metrics after multiregion #3697
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description & motivation
The knex & high frequency metrics were initialized before the multiregion module. These metrics query clients related to multi-region databases. When getting the clients, they will be initialized if they are not already. This initialization process starts the database migration for the multiregion database.
As metrics runs concurrently, the error would throw at a random time during the startup process and was unrelated to the log messages immediately prior which was confusing.
To avoid confusion the multiregion database migrations should remain the responsibility of the multiregion module.
The application may ultimately run into the same error, but it is then clearer as to what module has encountered the error and for what purpose.
Changes:
To-do before merge:
Screenshots:
Validation of changes:
/metrics
endpoint.Checklist:
References