Skip to content

Commit 2916a10

Browse files
authored
log out mongosh_version to log file (#244)
1 parent 8949e04 commit 2916a10

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

packages/service-provider-browser/src/stitch-service-provider-browser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class StitchServiceProviderBrowser implements ServiceProvider {
7171
async getConnectionInfo(): Promise<any> {
7272
const buildInfo = await this.buildInfo();
7373
const topology = await this.getTopology();
74+
const { version } = require('../package.json');
7475
let cmdLineOpts = null;
7576
try {
7677
cmdLineOpts = await this.getCmdLineOpts();
@@ -79,6 +80,7 @@ class StitchServiceProviderBrowser implements ServiceProvider {
7980
}
8081
const connectInfo = getConnectInfo(
8182
'', // TODO: something more useful?
83+
version,
8284
buildInfo,
8385
cmdLineOpts,
8486
topology

packages/service-provider-core/src/connect-info.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('getConnectInfo', function() {
7878
is_atlas: true,
7979
is_localhost: false,
8080
server_version: '3.2.0-rc2',
81+
mongosh_version: '0.0.6',
8182
is_enterprise: true,
8283
auth_type: 'LDAP',
8384
is_data_lake: false,
@@ -91,6 +92,7 @@ describe('getConnectInfo', function() {
9192
};
9293
expect(getConnectInfo(
9394
ATLAS_URI,
95+
'0.0.6',
9496
BUILD_INFO,
9597
CMD_LINE_OPTS,
9698
TOPOLOGY_WITH_CREDENTIALS)).to.deep.equal(output);
@@ -101,6 +103,7 @@ describe('getConnectInfo', function() {
101103
is_atlas: true,
102104
is_localhost: false,
103105
server_version: '3.2.0-rc2',
106+
mongosh_version: '0.0.6',
104107
is_enterprise: true,
105108
auth_type: null,
106109
is_data_lake: false,
@@ -114,6 +117,7 @@ describe('getConnectInfo', function() {
114117
};
115118
expect(getConnectInfo(
116119
ATLAS_URI,
120+
'0.0.6',
117121
BUILD_INFO,
118122
CMD_LINE_OPTS,
119123
TOPOLOGY_NO_CREDENTIALS)).to.deep.equal(output);

packages/service-provider-core/src/connect-info.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface ConnectInfo {
77
is_atlas: boolean;
88
is_localhost: boolean;
99
server_version: string;
10+
mongosh_version: string;
1011
server_os?: string;
1112
server_arch?: string;
1213
is_enterprise: boolean;
@@ -19,7 +20,7 @@ interface ConnectInfo {
1920
uri: string;
2021
}
2122

22-
export default function getConnectInfo(uri: string, buildInfo: any, cmdLineOpts: any, topology: any): ConnectInfo {
23+
export default function getConnectInfo(uri: string, mongoshVersion: string, buildInfo: any, cmdLineOpts: any, topology: any): ConnectInfo {
2324
const { isGenuine: is_genuine, serverName: non_genuine_server_name } =
2425
getBuildInfo.getGenuineMongoDB(buildInfo, cmdLineOpts);
2526
const { isDataLake: is_data_lake, dlVersion: dl_version }
@@ -36,14 +37,15 @@ export default function getConnectInfo(uri: string, buildInfo: any, cmdLineOpts:
3637
is_atlas: getBuildInfo.isAtlas(uri),
3738
is_localhost: getBuildInfo.isLocalhost(uri),
3839
server_version: buildInfo.version,
40+
node_version: process.version,
41+
mongosh_version: mongoshVersion,
3942
server_os,
4043
uri,
4144
server_arch,
4245
is_enterprise: getBuildInfo.isEnterprise(buildInfo),
4346
auth_type,
4447
is_data_lake,
4548
dl_version,
46-
node_version: process.version,
4749
is_genuine,
4850
non_genuine_server_name
4951
};

packages/service-provider-server/src/cli-service-provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class CliServiceProvider implements ServiceProvider {
105105
async getConnectionInfo(): Promise<any> {
106106
const buildInfo = await this.buildInfo();
107107
const topology = await this.getTopology();
108+
const { version } = require('../package.json');
108109
let cmdLineOpts = null;
109110
try {
110111
cmdLineOpts = await this.getCmdLineOpts();
@@ -113,6 +114,7 @@ class CliServiceProvider implements ServiceProvider {
113114
}
114115
const connectInfo = getConnectInfo(
115116
this.uri,
117+
version,
116118
buildInfo,
117119
cmdLineOpts,
118120
topology

0 commit comments

Comments
 (0)