RUBY-1933 Add debug level logging around initial DNS seed list query #2904
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.
When a
mongodb+srv
URI is parsed, it attempts to resolve the hostname and fetch the DNS records associated with it. This occurs synchronously, which can cause the application to seem to pause at that point if there is any delay in fetching the DNS records. That pause can be difficult to troubleshot, because no logging was done to indicate that the DNS records were being queried.This PR adds a debug line just before fetching the DNS records for the given hostname, which will hopefully add some transparency when debugging network issues.
NOTE: This PR also refactors some of the constructor for
Mongo::Client
. I initially considered adding the logging there, and so did the refactoring in preparation, but later decided to log closer to the actual issue. As the refactoring was also an improvement, I opted to leave it, though it was ultimately unrelated to this change.