Skip to content

Commit

Permalink
feat(service-provider-server): log more detailed information about DN…
Browse files Browse the repository at this point in the history
…S lookups (#1191)

In particular, include whether os-dns-native made lookups
using the native OS DNS APIs or not.
  • Loading branch information
addaleax authored Jan 17, 2022
1 parent cac1523 commit 9b01e48
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 29 deletions.
14 changes: 7 additions & 7 deletions packages/logging/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"node": ">=12.4.0"
},
"dependencies": {
"@mongodb-js/devtools-connect": "^1.0.0",
"@mongodb-js/devtools-connect": "^1.1.1",
"@mongosh/errors": "0.0.0-dev.0",
"@mongosh/history": "0.0.0-dev.0",
"@mongosh/types": "0.0.0-dev.0",
Expand Down
17 changes: 13 additions & 4 deletions packages/logging/src/setup-logger-and-telemetry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ describe('setupLoggerAndTelemetry', () => {
bus.emit('devtools-connect:connect-heartbeat-succeeded', { connectionId: 'localhost' });
bus.emit('devtools-connect:connect-fail-early');
bus.emit('devtools-connect:connect-attempt-finished');
bus.emit('devtools-connect:resolve-srv-error', { from: 'mongodb+srv://foo:[email protected]/', error: new Error('failed'), duringLoad: false });
bus.emit('devtools-connect:resolve-srv-succeeded', { from: 'mongodb+srv://foo:[email protected]/', to: 'mongodb://foo:[email protected]/' });
bus.emit('devtools-connect:resolve-srv-error', {
from: 'mongodb+srv://foo:[email protected]/',
error: new Error('failed'),
duringLoad: false,
resolutionDetails: []
});
bus.emit('devtools-connect:resolve-srv-succeeded', {
from: 'mongodb+srv://foo:[email protected]/',
to: 'mongodb://foo:[email protected]/',
resolutionDetails: []
});
bus.emit('devtools-connect:missing-optional-dependency', { name: 'kerberos', error: new Error('no kerberos') });
bus.emit('mongosh-sp:reset-connection-options');

Expand Down Expand Up @@ -201,9 +210,9 @@ describe('setupLoggerAndTelemetry', () => {
expect(logOutput[i++].msg).to.equal('Aborting connection attempt as irrecoverable');
expect(logOutput[i++].msg).to.equal('Connection attempt finished');
expect(logOutput[i].msg).to.equal('Resolving SRV record failed');
expect(logOutput[i++].attr).to.deep.equal({ from: 'mongodb+srv://<credentials>@hello.world/', error: 'failed', duringLoad: false });
expect(logOutput[i++].attr).to.deep.equal({ from: 'mongodb+srv://<credentials>@hello.world/', error: 'failed', duringLoad: false, resolutionDetails: [] });
expect(logOutput[i].msg).to.equal('Resolving SRV record succeeded');
expect(logOutput[i++].attr).to.deep.equal({ from: 'mongodb+srv://<credentials>@hello.world/', to: 'mongodb://<credentials>@db.hello.world/' });
expect(logOutput[i++].attr).to.deep.equal({ from: 'mongodb+srv://<credentials>@hello.world/', to: 'mongodb://<credentials>@db.hello.world/', resolutionDetails: [] });
expect(logOutput[i].msg).to.equal('Missing optional dependency');
expect(logOutput[i++].attr).to.deep.equal({ name: 'kerberos', error: 'no kerberos' });
expect(logOutput[i++].msg).to.equal('Reconnect because of changed connection options');
Expand Down
3 changes: 2 additions & 1 deletion packages/node-runtime-worker-thread/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const config = {
'mongodb-client-encryption': 'commonjs2 mongodb-client-encryption',
kerberos: 'commonjs2 kerberos',
snappy: 'commonjs2 snappy',
interruptor: 'commonjs2 interruptor'
interruptor: 'commonjs2 interruptor',
'os-dns-native': 'commonjs2 os-dns-native',
}
};

Expand Down
14 changes: 7 additions & 7 deletions packages/service-provider-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/service-provider-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
]
},
"dependencies": {
"@mongodb-js/devtools-connect": "^1.0.0",
"@mongodb-js/devtools-connect": "^1.1.1",
"@mongosh/errors": "0.0.0-dev.0",
"@mongosh/service-provider-core": "0.0.0-dev.0",
"@mongosh/types": "0.0.0-dev.0",
Expand Down
14 changes: 7 additions & 7 deletions packages/types/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"unitTestsOnly": true
},
"dependencies": {
"@mongodb-js/devtools-connect": "^1.0.0"
"@mongodb-js/devtools-connect": "^1.1.1"
}
}

0 comments on commit 9b01e48

Please sign in to comment.