-
Notifications
You must be signed in to change notification settings - Fork 8
Update connection string app name if not present #199
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the connection string handling by ensuring that a default app name is appended when it is missing, while also updating telemetry handling across various connection methods. Key changes include:
- Updating tests to validate the updated connection string behavior under various scenarios.
- Modifying connection methods (in Session, MongoDB tool, ConnectClusterTool, and Server) to pass telemetry to the underlying driver connection calls.
- Adjusting import paths for helper modules (packageInfo, deferred-promise, etc.) to align with the new directory structure.
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/unit/telemetry.test.ts | Added test suite and cases for connection string modification. |
tests/unit/deferred-promise.test.ts | Updated import path for DeferredPromise. |
src/tools/mongodb/mongodbTool.ts | Updated connectToMongoDB to pass telemetry parameter. |
src/tools/atlas/metadata/connectCluster.ts | Updated connectToMongoDB call with telemetry parameter. |
src/telemetry/telemetry.ts | Updated import path for DeferredPromise. |
src/telemetry/constants.ts | Updated packageInfo import path. |
src/session.ts | Modified connectToMongoDB signature and added appName logic. |
src/server.ts | Updated session connection call to include telemetry. |
src/index.ts | Updated packageInfo import path. |
src/helpers/packageInfo.ts | Updated packageJson import path. |
src/helpers/connectionOptions.ts | Added setAppNameParamIfMissing helper function. |
src/common/atlas/apiClient.ts | Updated packageInfo import path. |
Files not reviewed (1)
- package.json: Language not supported
} | ||
|
||
if (testCase.disableTelemetry) { | ||
expect(connectionString).not.toMatch(/appName=[^-]*-[^&]*/); |
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.
[nitpick] Consider extracting the regex pattern into a named constant or helper function to improve maintainability and clarity, in case the connection string format changes in the future.
expect(connectionString).not.toMatch(/appName=[^-]*-[^&]*/); | |
expect(connectionString).not.toMatch(APP_NAME_REGEX); |
Copilot uses AI. Check for mistakes.
No description provided.