-
Notifications
You must be signed in to change notification settings - Fork 225
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
fix(instr-mongodb): fix instr to no longer break mongodb >=6.4.0 #3897
Conversation
Bumps [mongodb](https://github.com/mongodb/node-mongodb-native) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/mongodb/node-mongodb-native/releases) - [Changelog](https://github.com/mongodb/node-mongodb-native/blob/main/HISTORY.md) - [Commits](mongodb/node-mongodb-native@v6.3.0...v6.4.0) --- updated-dependencies: - dependency-name: mongodb dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
run docs-build |
symptomThe mongodb tests are failing here with:
i.e. the bugIIUC, this is a bug caused by our instrumentation of class ConnectionPoolTraced extends mod.ConnectionPool {
checkOut(callback) {
return super.checkOut(AsyncResource.bind(callback));
}
} However, mongodb@6.4.0 includes mongodb/node-mongodb-native@ff8b5f5#diff-c464ff2f674f52c3696a24e1a90ef79e3f300a4fed92884a8c3cb6a1d0d143a5L353-R360 which changes the signature of that - checkOut(callback: Callback<Connection>): void {
+ async checkOut(): Promise<Connection> { fixI'd started out with this change: diff --git a/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js b/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js
index 22089015..a8a5b09a 100644
--- a/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js
+++ b/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js
@@ -23,7 +23,14 @@ module.exports = (mod, agent, { version, enabled }) => {
if (mod.ConnectionPool) {
class ConnectionPoolTraced extends mod.ConnectionPool {
checkOut(callback) {
- return super.checkOut(AsyncResource.bind(callback));
+ if (typeof callback === 'function') {
+ return super.checkOut(AsyncResource.bind(callback));
+ } else {
+ // mongodb@>=6.4.0
+ // - checkOut(callback: Callback<Connection>): void {
+ // + async checkOut(): Promise<Connection> {
+ return super.checkOut();
+ }
}
}
This fixes the crash, but I expected that we'd again then get the async context tracking issue that #3665 fixed. So now I think we should have that ConnectionPool instrumentation only apply to the earlier mongodb versions. - if (!semver.satisfies(version, '>=3.3 <7.0')) {
+ if (!semver.satisfies(version, '>=3.3 <6.4.0')) { Qs@david-luna Do you recall if you/we ever opened a node-mongodb-native issue about this AsyncResource.bind usage? I couldn't find anything searching https://jira.mongodb.org/projects/NODE/issues |
run docs-build |
run docs-build |
Ah here it is: https://jira.mongodb.org/browse/NODE-5639 And TAV tests are failing for otel-js-contrib as well: open-telemetry/opentelemetry-js-contrib#1978 (comment) |
…stic#3897) * chore(deps-dev): bump mongodb from 6.3.0 to 6.4.0 Co-authored-by: Trent Mick <trent.mick@elastic.co>
Bumps mongodb from 6.3.0 to 6.4.0.
Release notes
Sourced from mongodb's releases.
... (truncated)
Changelog
Sourced from mongodb's changelog.
Commits
9ac2e38
chore(main): release 6.4.0 [skip-ci] (#3935)5f62f56
docs: generate docs from latest main [skip-ci] (#3977)90f2f70
feat(NODE-5978): upgrade BSON to ^6.4.0 (#4007)99a0059
test(NODE-5731): add serverless proxy testing (#4003)1ca6269
test(NODE-5929): convert txn legacy spec tests (#3987)f26de76
fix(NODE-5944): make AWS session token optional (#4002)09c9b0b
chore(NODE-5972): specify TS 5.0 in package.json and package-lock (#4004)eb5e2ab
chore(NODE-5829): update driver dependencies (#3994)233a2e0
refactor(NODE-5964): clean up prepareHandshakeDocument (#4001)ff8b5f5
refactor(NODE-5912): make server.command an async function (#3986)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)