Skip to content
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

feat!: Updated mongodb instrumentation to drop support for versions 2 and 3 #2398

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,11 @@ services:
ports:
- "11211:11211"

mongodb_3:
container_name: nr_node_mongodb
platform: ${DOCKER_PLATFORM:-linux/amd64}
image: library/mongo:3
ports:
- "27017:27017"
healthcheck:
test: ["CMD", "mongo", "--quiet"]
interval: 1s
timeout: 10s
retries: 30

mongodb_5:
container_name: nr_node_mongodb_5
image: library/mongo:5
ports:
- "27018:27017"
- "27017:27017"
healthcheck:
test: ["CMD", "mongo", "--quiet"]
interval: 1s
Expand Down
9 changes: 4 additions & 5 deletions lib/instrumentation/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
'use strict'

const semver = require('semver')
const instrument = require('./mongodb/v2-mongo')
const instrumentV3 = require('./mongodb/v3-mongo')
const instrumentV4 = require('./mongodb/v4-mongo')

// XXX: When this instrumentation is modularized, update this thread
Expand Down Expand Up @@ -39,9 +37,10 @@ function initialize(agent, mongodb, moduleName, shim) {
const mongoVersion = shim.pkgVersion
if (semver.satisfies(mongoVersion, '>=4.0.0')) {
instrumentV4(shim, mongodb)
} else if (semver.satisfies(mongoVersion, '>=3.0.6')) {
instrumentV3(shim, mongodb)
} else {
instrument(shim, mongodb)
shim.logger.warn(
bizob2828 marked this conversation as resolved.
Show resolved Hide resolved
'New Relic Node.js agent no longer supports mongodb < 4, current version %s. Please downgrade to v11 for support, if needed',
mongoVersion
)
}
}
118 changes: 0 additions & 118 deletions lib/instrumentation/mongodb/v2-mongo.js

This file was deleted.

85 changes: 0 additions & 85 deletions lib/instrumentation/mongodb/v3-mongo.js

This file was deleted.

5 changes: 0 additions & 5 deletions test/lib/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ module.exports = {
mongodb_host: process.env.NR_NODE_TEST_MONGODB_HOST || 'localhost',
mongodb_port: process.env.NR_NODE_TEST_MONGODB_PORT || 27017,

// mongodb 4.2.0 does not allow mongo server v2.
// There is now a separate container that maps 27018 to mongo:5
mongodb_v4_host: process.env.NR_NODE_TEST_MONGODB_V4_HOST || 'localhost',
mongodb_v4_port: process.env.NR_NODE_TEST_MONGODB_V4_PORT || 27018,

mysql_host: process.env.NR_NODE_TEST_MYSQL_HOST || 'localhost',
mysql_port: process.env.NR_NODE_TEST_MYSQL_PORT || 3306,

Expand Down
Loading
Loading