-
Notifications
You must be signed in to change notification settings - Fork 247
chore(data-service): add a log whenever connecting throws and include connection id COMPASS-9404 #6953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
chore(data-service): add a log whenever connecting throws and include connection id COMPASS-9404 #6953
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c3ceb9
chore(data-service): add a log whenever connecting throws and include…
nbbeeken b5ef25d
chore: update test
nbbeeken 2e76580
chore: messages
nbbeeken 77d1208
chore: fix test
nbbeeken c946f79
test: ids
nbbeeken d9a3d24
test: fix lint and timeout
nbbeeken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1579,7 +1579,8 @@ class DataServiceImpl extends WithLogContext implements DataService { | |
| debug('connecting...'); | ||
| this._isConnecting = true; | ||
|
|
||
| this._logger.info(mongoLogId(1_001_000_014), 'Connecting', { | ||
| this._logger.info(mongoLogId(1_001_000_014), 'Connecting Started', { | ||
| connectionId: this._id, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC this _id is per attempt not per cluster, but that's fine for the use case in mms. LMK if "connectionId" isn't clear, I think its just important to not conflate that with a clusterId of some kind |
||
| url: redactConnectionString(this._connectionOptions.connectionString), | ||
| csfle: this._csfleLogInformation(this._connectionOptions.fleOptions), | ||
| }); | ||
|
|
@@ -1599,11 +1600,16 @@ class DataServiceImpl extends WithLogContext implements DataService { | |
| }); | ||
|
|
||
| const attr = { | ||
| connectionId: this._id, | ||
| isWritable: this.isWritable(), | ||
| isMongos: this.isMongos(), | ||
| }; | ||
|
|
||
| this._logger.info(mongoLogId(1_001_000_015), 'Connected', attr); | ||
| this._logger.info( | ||
| mongoLogId(1_001_000_015), | ||
| 'Connecting Succeeded', | ||
| attr | ||
| ); | ||
| debug('connected!', attr); | ||
|
|
||
| state.oidcPlugin.logger.on('mongodb-oidc-plugin:state-updated', () => { | ||
|
|
@@ -1626,6 +1632,15 @@ class DataServiceImpl extends WithLogContext implements DataService { | |
| this, | ||
| this._crudClient | ||
| ); | ||
| } catch (error) { | ||
| this._logger.info(mongoLogId(1_001_000_359), 'Connecting Failed', { | ||
| connectionId: this._id, | ||
| error: | ||
| error && typeof error === 'object' && 'message' in error | ||
| ? error?.message | ||
| : 'unknown error', | ||
| }); | ||
| throw error; | ||
| } finally { | ||
| this._isConnecting = false; | ||
| } | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am inspired here by the driver's commandStarted/Succeeded/Failed. But the message changes aren't necessary so happy to undo.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the log id stays the same and conceptually it's the same event I think that's fine (but you will need to figure out all the tests that might be checking this 🙂)