-
Notifications
You must be signed in to change notification settings - Fork 82
chore(deps): bump mongodb-build-info
#2563
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| // ^ segment data is in snake_case: forgive me javascript, for i have sinned. | ||||||
|
|
||||||
| import getBuildInfo from 'mongodb-build-info'; | ||||||
| import * as getBuildInfo from 'mongodb-build-info'; | ||||||
| import type { ConnectionString } from 'mongodb-connection-string-url'; | ||||||
|
|
||||||
| export type ConnectionExtraInfo = { | ||||||
|
|
@@ -65,44 +65,43 @@ export default function getConnectExtraInfo({ | |||||
| atlasVersion, | ||||||
| resolvedHostname, | ||||||
| isLocalAtlas, | ||||||
| serverName = 'unknown', | ||||||
| }: { | ||||||
| connectionString?: ConnectionString; | ||||||
| buildInfo: any; | ||||||
| atlasVersion: any; | ||||||
| resolvedHostname?: string; | ||||||
| isLocalAtlas: boolean; | ||||||
| serverName?: string; | ||||||
| }): ConnectionExtraInfo { | ||||||
| const auth_type = | ||||||
| connectionString?.searchParams.get('authMechanism') ?? undefined; | ||||||
| const uri = connectionString?.toString() ?? ''; | ||||||
|
|
||||||
| buildInfo ??= {}; // We're currently not getting buildInfo with --apiStrict. | ||||||
| const { isGenuine: is_genuine, serverName: non_genuine_server_name } = | ||||||
| getBuildInfo.getGenuineMongoDB(uri); | ||||||
| // Atlas Data Lake has been renamed to Atlas Data Federation | ||||||
| const { isDataLake: is_data_federation, dlVersion: dl_version } = | ||||||
| const { isDataLake: is_data_federation, dlVersion } = | ||||||
| getBuildInfo.getDataLake(buildInfo); | ||||||
|
|
||||||
| const { serverOs: server_os, serverArch: server_arch } = | ||||||
| getBuildInfo.getBuildEnv(buildInfo); | ||||||
| const { serverOs, serverArch } = getBuildInfo.getBuildEnv(buildInfo); | ||||||
| const isAtlas = !!atlasVersion?.atlasVersion || getBuildInfo.isAtlas(uri); | ||||||
|
|
||||||
| return { | ||||||
| ...getHostInformation(resolvedHostname || uri), | ||||||
| is_atlas: isAtlas, | ||||||
| server_version: buildInfo.version, | ||||||
| node_version: process.version, | ||||||
| server_os, | ||||||
| server_os: serverOs || undefined, | ||||||
| uri, | ||||||
| server_arch, | ||||||
| server_arch: serverArch || undefined, | ||||||
| is_enterprise: getBuildInfo.isEnterprise(buildInfo), | ||||||
| auth_type, | ||||||
| is_data_federation, | ||||||
| is_stream: getBuildInfo.isAtlasStream(uri), | ||||||
| dl_version, | ||||||
| dl_version: dlVersion || undefined, | ||||||
| atlas_version: atlasVersion?.atlasVersion ?? null, | ||||||
| is_genuine, | ||||||
| non_genuine_server_name, | ||||||
| is_genuine: serverName === 'mongodb' || serverName === 'unknown', | ||||||
|
||||||
| is_genuine: serverName === 'mongodb' || serverName === 'unknown', | |
| is_genuine: serverName === 'unknown' ? undefined : serverName === 'mongodb', |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,7 @@ import { | |
| ClientEncryption, | ||
| } from 'mongodb'; | ||
| import { connectMongoClient } from '@mongodb-js/devtools-connect'; | ||
| import { identifyServerName } from 'mongodb-build-info'; | ||
|
|
||
| const bsonlib = () => { | ||
| const { | ||
|
|
@@ -472,27 +473,47 @@ export class NodeDriverServiceProvider | |
| } | ||
|
|
||
| async getConnectionInfo(): Promise<ConnectionInfo> { | ||
| const [buildInfo = null, atlasVersion = null, fcv = null, atlascliInfo] = | ||
| await Promise.all([ | ||
| this.runCommandWithCheck( | ||
| 'admin', | ||
| { buildInfo: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => {}), | ||
| this.runCommandWithCheck( | ||
| 'admin', | ||
| { atlasVersion: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => {}), | ||
| this.runCommandWithCheck( | ||
| 'admin', | ||
| { getParameter: 1, featureCompatibilityVersion: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => {}), | ||
| this.countDocuments('admin', 'atlascli', { | ||
| managedClusterType: 'atlasCliLocalDevCluster', | ||
| }).catch(() => 0), | ||
| ]); | ||
| const buildInfoPromise = this.runCommandWithCheck( | ||
| 'admin', | ||
| { buildInfo: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => ({})); | ||
|
|
||
| const [ | ||
| buildInfo, | ||
| atlasVersion = null, | ||
| fcv = null, | ||
| atlascliInfo, | ||
| serverName, | ||
| ] = await Promise.all([ | ||
|
Comment on lines
+482
to
+488
|
||
| buildInfoPromise, | ||
| this.runCommandWithCheck( | ||
| 'admin', | ||
| { atlasVersion: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => {}), | ||
| this.runCommandWithCheck( | ||
| 'admin', | ||
| { getParameter: 1, featureCompatibilityVersion: 1 }, | ||
| this.baseCmdOptions | ||
| ).catch(() => {}), | ||
| this.countDocuments('admin', 'atlascli', { | ||
| managedClusterType: 'atlasCliLocalDevCluster', | ||
| }).catch(() => 0), | ||
| identifyServerName({ | ||
| connectionString: this.uri?.toString() ?? '', | ||
| adminCommand: (command) => { | ||
| if (command.buildInfo) { | ||
| return buildInfoPromise; | ||
| } | ||
| return this.runCommandWithCheck( | ||
| 'admin', | ||
| command, | ||
| this.baseCmdOptions | ||
| ); | ||
| }, | ||
| }), | ||
| ]); | ||
|
|
||
| const resolvedHostname = this._getHostnameForConnection( | ||
| this._lastSeenTopology | ||
|
|
@@ -504,6 +525,7 @@ export class NodeDriverServiceProvider | |
| atlasVersion, | ||
| resolvedHostname, | ||
| isLocalAtlas: !!atlascliInfo, | ||
| serverName, | ||
| }); | ||
|
|
||
| return { | ||
|
|
||
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.
All the 💙 for moving towards correct imports!