diff --git a/.tav.yml b/.tav.yml index 954150abc1..e4b498b2a2 100644 --- a/.tav.yml +++ b/.tav.yml @@ -131,7 +131,7 @@ mongodb: node: '>=14.20.1' commands: node test/instrumentation/modules/mongodb/mongodb.test.js - versions: '>=6 <7' - node: '>=15.0.0' + node: '>=16.20.1' commands: node test/instrumentation/modules/mongodb/mongodb.test.js # Bluebird is effectively deprecated (https://github.com/petkaantonov/bluebird#%EF%B8%8Fnote%EF%B8%8F). diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 57f999b11d..256c88f0ce 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -46,6 +46,10 @@ See the <> guide. [float] ===== Bug fixes +* Fix instrumentation of mongodb to not break mongodb@6.4.0. Mongodb v6.4.0 + included changes that resulted in the APM agent's instrumentation breaking it. + ({pull}3897[#3897]) + [float] ===== Chores diff --git a/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js b/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js index 22089015b2..0dfb25e84c 100644 --- a/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js +++ b/lib/instrumentation/modules/mongodb/lib/cmap/connection_pool.js @@ -12,13 +12,14 @@ const semver = require('semver'); module.exports = (mod, agent, { version, enabled }) => { if (!enabled) return mod; - if (!semver.satisfies(version, '>=3.3 <7.0')) { - agent.logger.debug( - 'mongodb version %s not instrumented (mongodb <3.3 is instrumented via mongodb-core)', - version, - ); + if (!semver.satisfies(version, '>=3.3 <6.4.0')) { + // - mongodb <3.3 is instrumented via mongodb-core + // - mongodb >=6.4.0 now longer requires ConnectionPool#checkOut to be + // patched to fix async context tracking. See discussion at + // https://github.com/elastic/apm-agent-nodejs/pull/3897 return mod; } + agent.logger.debug('instrumenting mongodb ConnectionPool#checkOut'); if (mod.ConnectionPool) { class ConnectionPoolTraced extends mod.ConnectionPool { diff --git a/package-lock.json b/package-lock.json index 001b0b2a35..2017c40d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7730,9 +7730,9 @@ } }, "node_modules/bson": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz", - "integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.4.0.tgz", + "integrity": "sha512-6/gSSEdbkuFlSb+ufj5jUSU4+wo8xQOwm2bDSqwmxiPE17JTpsP63eAwoN8iF8Oy4gJYj+PAL3zdRCTdaw5Y1g==", "dev": true, "engines": { "node": ">=16.20.1" @@ -13503,13 +13503,13 @@ "integrity": "sha1-EUyUlnPiqKNenTV4hSeqN7Z52is=" }, "node_modules/mongodb": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz", - "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.4.0.tgz", + "integrity": "sha512-MdFHsyb1a/Ee0H3NmzWTSLqchacDV/APF0H6BNQvraWrOiIocys2EmTFZPgHxWhcfO94c1F34I9MACU7x0hHKA==", "dev": true, "dependencies": { "@mongodb-js/saslprep": "^1.1.0", - "bson": "^6.2.0", + "bson": "^6.4.0", "mongodb-connection-string-url": "^3.0.0" }, "engines": { @@ -24404,9 +24404,9 @@ } }, "bson": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz", - "integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.4.0.tgz", + "integrity": "sha512-6/gSSEdbkuFlSb+ufj5jUSU4+wo8xQOwm2bDSqwmxiPE17JTpsP63eAwoN8iF8Oy4gJYj+PAL3zdRCTdaw5Y1g==", "dev": true }, "buffer": { @@ -28755,13 +28755,13 @@ "integrity": "sha1-EUyUlnPiqKNenTV4hSeqN7Z52is=" }, "mongodb": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz", - "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.4.0.tgz", + "integrity": "sha512-MdFHsyb1a/Ee0H3NmzWTSLqchacDV/APF0H6BNQvraWrOiIocys2EmTFZPgHxWhcfO94c1F34I9MACU7x0hHKA==", "dev": true, "requires": { "@mongodb-js/saslprep": "^1.1.0", - "bson": "^6.2.0", + "bson": "^6.4.0", "mongodb-connection-string-url": "^3.0.0" } }, diff --git a/test/_is_mongodb_incompat.js b/test/_is_mongodb_incompat.js index 6f547b9f74..615df86bea 100644 --- a/test/_is_mongodb_incompat.js +++ b/test/_is_mongodb_incompat.js @@ -39,7 +39,7 @@ function isMongodbIncompat() { return msg; } } else if (semver.satisfies(mongodbVer, '>=6.0.0')) { - if (!semver.satisfies(nodeVer, '>=15.0.0')) { + if (!semver.satisfies(nodeVer, '>=16.20.1')) { return msg; } }