Skip to content

Commit

Permalink
feat(instrumentation-mongodb): add support for mongodb v6 (#1760)
Browse files Browse the repository at this point in the history
* feat: add support for mongodb v6

* chore: lint fix

* chore: revert bump of mongodb

* chore: revert test script

* chore: revert changelog

* chore: filter node versions in TAV

* chore: fix .tav.yml

---------

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
  • Loading branch information
david-luna and dyladan committed Nov 28, 2023
1 parent f74bcc2 commit 660e37b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions plugins/node/opentelemetry-instrumentation-mongodb/.tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ mongodb:
- versions: ">=4 <5"
commands: npm run test-v4
- versions: ">=5 <6"
commands: npm run test-v5
commands: npm run test-v5-v6
- versions: ">=6 <7"
node: '>=15.0.0'
commands: npm run test-v5-v6

# Fix missing `contrib-test-utils` package
pretest: npm run --prefix ../../../ lerna:link
pretest: npm run --prefix ../../../ lerna:link
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-mongodb

### Supported Versions

- `>=3.3 <5`
- `>=3.3 <7`

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"docker:start": "docker run -e MONGODB_DB=opentelemetry-tests -e MONGODB_PORT=27017 -e MONGODB_HOST=127.0.0.1 -p 27017:27017 --rm mongo",
"test": "npm run test-v3",
"test-v3": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/**/mongodb-v3.test.ts'",
"test-v4": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/mongodb-v4-v5.metrics.test.ts' 'test/**/mongodb-v4.test.ts'",
"test-v5": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/mongodb-v4-v5.metrics.test.ts' 'test/**/mongodb-v5.test.ts'",
"test-v4": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/mongodb-v4-v5-v6.metrics.test.ts' 'test/**/mongodb-v4.test.ts'",
"test-v5-v6": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/mongodb-v4-v5-v6.metrics.test.ts' 'test/**/mongodb-v5-v6.test.ts'",
"test-all-versions": "tav",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,31 @@ export class MongoDBInstrumentation extends InstrumentationBase {
),
new InstrumentationNodeModuleDefinition<any>(
'mongodb',
['4.*', '5.*'],
['4.*', '5.*', '6.*'],
undefined,
undefined,
[
new InstrumentationNodeModuleFile<V4Connection>(
'mongodb/lib/cmap/connection.js',
['4.*', '5.*'],
['4.*', '5.*', '6.*'],
v4PatchConnection,
v4UnpatchConnection
),
new InstrumentationNodeModuleFile<V4ConnectionPool>(
'mongodb/lib/cmap/connection_pool.js',
['4.*', '5.*'],
['4.*', '5.*', '6.*'],
v4PatchConnectionPool,
v4UnpatchConnectionPool
),
new InstrumentationNodeModuleFile<V4Connect>(
'mongodb/lib/cmap/connect.js',
['4.*', '5.*'],
['4.*', '5.*', '6.*'],
v4PatchConnect,
v4UnpatchConnect
),
new InstrumentationNodeModuleFile<V4Session>(
'mongodb/lib/sessions.js',
['4.*', '5.*'],
['4.*', '5.*', '6.*'],
v4PatchSessions,
v4UnpatchSessions
),
Expand Down

0 comments on commit 660e37b

Please sign in to comment.