Skip to content

Commit

Permalink
feat: add mongoose instrumentation (open-telemetry#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Blum authored Sep 22, 2022
1 parent 01d6e95 commit b35277b
Show file tree
Hide file tree
Showing 23 changed files with 1,773 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ components:
- rauno56
plugins/node/opentelemetry-instrumentation-mongodb:
- osherv
plugins/node/opentelemetry-instrumentation-mongoose:
- blumamir
plugins/node/opentelemetry-instrumentation-nestjs-core:
- rauno56
plugins/node/opentelemetry-instrumentation-redis:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.27.2","detectors/node/opentelemetry-resource-detector-aws":"1.1.2","detectors/node/opentelemetry-resource-detector-gcp":"0.27.2","detectors/node/opentelemetry-resource-detector-github":"0.27.0","metapackages/auto-instrumentations-node":"0.32.1","metapackages/auto-instrumentations-web":"0.30.0","packages/opentelemetry-host-metrics":"0.30.0","packages/opentelemetry-id-generator-aws-xray":"1.1.0","packages/opentelemetry-test-utils":"0.32.0","plugins/node/instrumentation-amqplib":"0.31.0","plugins/node/instrumentation-fs":"0.5.0","plugins/node/instrumentation-tedious":"0.4.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.33.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.9.1","plugins/node/opentelemetry-instrumentation-bunyan":"0.30.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.30.0","plugins/node/opentelemetry-instrumentation-connect":"0.30.0","plugins/node/opentelemetry-instrumentation-dns":"0.30.0","plugins/node/opentelemetry-instrumentation-express":"0.31.1","plugins/node/opentelemetry-instrumentation-generic-pool":"0.30.0","plugins/node/opentelemetry-instrumentation-graphql":"0.31.0","plugins/node/opentelemetry-instrumentation-hapi":"0.30.0","plugins/node/opentelemetry-instrumentation-ioredis":"0.32.1","plugins/node/opentelemetry-instrumentation-knex":"0.30.0","plugins/node/opentelemetry-instrumentation-koa":"0.32.0","plugins/node/instrumentation-lru-memoizer":"0.31.0","plugins/node/opentelemetry-instrumentation-memcached":"0.30.0","plugins/node/opentelemetry-instrumentation-mongodb":"0.32.0","plugins/node/opentelemetry-instrumentation-mysql":"0.31.1","plugins/node/opentelemetry-instrumentation-mysql2":"0.32.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.31.0","plugins/node/opentelemetry-instrumentation-net":"0.30.1","plugins/node/opentelemetry-instrumentation-pg":"0.31.1","plugins/node/opentelemetry-instrumentation-pino":"0.32.0","plugins/node/opentelemetry-instrumentation-redis":"0.33.0","plugins/node/opentelemetry-instrumentation-redis-4":"0.33.0","plugins/node/opentelemetry-instrumentation-restify":"0.30.0","plugins/node/opentelemetry-instrumentation-router":"0.30.0","plugins/node/opentelemetry-instrumentation-winston":"0.30.0","plugins/web/opentelemetry-instrumentation-document-load":"0.30.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.31.0","plugins/web/opentelemetry-plugin-react-load":"0.28.0","propagators/opentelemetry-propagator-aws-xray":"1.1.0","propagators/opentelemetry-propagator-grpc-census-binary":"0.26.0","propagators/opentelemetry-propagator-instana":"0.2.0","propagators/opentelemetry-propagator-ot-trace":"0.26.1","plugins/node/opentelemetry-instrumentation-fastify":"0.29.0","packages/opentelemetry-propagation-utils":"0.28.0","plugins/web/opentelemetry-instrumentation-long-task":"0.31.0","detectors/node/opentelemetry-resource-detector-docker":"0.1.2","detectors/node/opentelemetry-resource-detector-instana":"0.3.0"}
{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.27.2","detectors/node/opentelemetry-resource-detector-aws":"1.1.2","detectors/node/opentelemetry-resource-detector-gcp":"0.27.2","detectors/node/opentelemetry-resource-detector-github":"0.27.0","metapackages/auto-instrumentations-node":"0.32.1","metapackages/auto-instrumentations-web":"0.30.0","packages/opentelemetry-host-metrics":"0.30.0","packages/opentelemetry-id-generator-aws-xray":"1.1.0","packages/opentelemetry-test-utils":"0.32.0","plugins/node/instrumentation-amqplib":"0.31.0","plugins/node/instrumentation-fs":"0.5.0","plugins/node/instrumentation-tedious":"0.4.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.33.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.9.1","plugins/node/opentelemetry-instrumentation-bunyan":"0.30.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.30.0","plugins/node/opentelemetry-instrumentation-connect":"0.30.0","plugins/node/opentelemetry-instrumentation-dns":"0.30.0","plugins/node/opentelemetry-instrumentation-express":"0.31.1","plugins/node/opentelemetry-instrumentation-generic-pool":"0.30.0","plugins/node/opentelemetry-instrumentation-graphql":"0.31.0","plugins/node/opentelemetry-instrumentation-hapi":"0.30.0","plugins/node/opentelemetry-instrumentation-ioredis":"0.32.1","plugins/node/opentelemetry-instrumentation-knex":"0.30.0","plugins/node/opentelemetry-instrumentation-koa":"0.32.0","plugins/node/instrumentation-lru-memoizer":"0.31.0","plugins/node/opentelemetry-instrumentation-memcached":"0.30.0","plugins/node/opentelemetry-instrumentation-mongodb":"0.32.0","plugins/node/opentelemetry-instrumentation-mongoose":"0.30.0","plugins/node/opentelemetry-instrumentation-mysql":"0.31.1","plugins/node/opentelemetry-instrumentation-mysql2":"0.32.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.31.0","plugins/node/opentelemetry-instrumentation-net":"0.30.1","plugins/node/opentelemetry-instrumentation-pg":"0.31.1","plugins/node/opentelemetry-instrumentation-pino":"0.32.0","plugins/node/opentelemetry-instrumentation-redis":"0.33.0","plugins/node/opentelemetry-instrumentation-redis-4":"0.33.0","plugins/node/opentelemetry-instrumentation-restify":"0.30.0","plugins/node/opentelemetry-instrumentation-router":"0.30.0","plugins/node/opentelemetry-instrumentation-winston":"0.30.0","plugins/web/opentelemetry-instrumentation-document-load":"0.30.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.31.0","plugins/web/opentelemetry-plugin-react-load":"0.28.0","propagators/opentelemetry-propagator-aws-xray":"1.1.0","propagators/opentelemetry-propagator-grpc-census-binary":"0.26.0","propagators/opentelemetry-propagator-instana":"0.2.0","propagators/opentelemetry-propagator-ot-trace":"0.26.1","plugins/node/opentelemetry-instrumentation-fastify":"0.29.0","packages/opentelemetry-propagation-utils":"0.28.0","plugins/web/opentelemetry-instrumentation-long-task":"0.31.0","detectors/node/opentelemetry-resource-detector-docker":"0.1.2","detectors/node/opentelemetry-resource-detector-instana":"0.3.0"}
1 change: 1 addition & 0 deletions metapackages/auto-instrumentations-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ registerInstrumentations({
- [@opentelemetry/instrumentation-koa](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-koa)
- [@opentelemetry/instrumentation-memcached](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-memcached)
- [@opentelemetry/instrumentation-mongodb](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mongodb)
- [@opentelemetry/instrumentation-mongoose](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-mongoose)
- [@opentelemetry/instrumentation-mysql2](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql2)
- [@opentelemetry/instrumentation-mysql](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql)
- [@opentelemetry/instrumentation-nestjs-core](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-nestjs-core)
Expand Down
3 changes: 2 additions & 1 deletion metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"@opentelemetry/instrumentation-lru-memoizer": "^0.31.0",
"@opentelemetry/instrumentation-memcached": "^0.30.0",
"@opentelemetry/instrumentation-mongodb": "^0.32.0",
"@opentelemetry/instrumentation-mysql": "^0.31.1",
"@opentelemetry/instrumentation-mongoose": "^0.30.0",
"@opentelemetry/instrumentation-mysql": "^0.31.0",
"@opentelemetry/instrumentation-mysql2": "^0.32.0",
"@opentelemetry/instrumentation-nestjs-core": "^0.31.0",
"@opentelemetry/instrumentation-net": "^0.30.1",
Expand Down
2 changes: 2 additions & 0 deletions metapackages/auto-instrumentations-node/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';
import { LruMemoizerInstrumentation } from '@opentelemetry/instrumentation-lru-memoizer';
import { MemcachedInstrumentation } from '@opentelemetry/instrumentation-memcached';
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';
import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';
import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';
Expand Down Expand Up @@ -69,6 +70,7 @@ const InstrumentationMap = {
'@opentelemetry/instrumentation-lru-memoizer': LruMemoizerInstrumentation,
'@opentelemetry/instrumentation-memcached': MemcachedInstrumentation,
'@opentelemetry/instrumentation-mongodb': MongoDBInstrumentation,
'@opentelemetry/instrumentation-mongoose': MongooseInstrumentation,
'@opentelemetry/instrumentation-mysql2': MySQL2Instrumentation,
'@opentelemetry/instrumentation-mysql': MySQLInstrumentation,
'@opentelemetry/instrumentation-nestjs-core': NestInstrumentation,
Expand Down
3 changes: 2 additions & 1 deletion metapackages/auto-instrumentations-node/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('utils', () => {
'@opentelemetry/instrumentation-lru-memoizer',
'@opentelemetry/instrumentation-memcached',
'@opentelemetry/instrumentation-mongodb',
'@opentelemetry/instrumentation-mongoose',
'@opentelemetry/instrumentation-mysql2',
'@opentelemetry/instrumentation-mysql',
'@opentelemetry/instrumentation-nestjs-core',
Expand All @@ -56,7 +57,7 @@ describe('utils', () => {
'@opentelemetry/instrumentation-restify',
'@opentelemetry/instrumentation-winston',
];
assert.strictEqual(instrumentations.length, 30);
assert.strictEqual(instrumentations.length, 31);
for (let i = 0, j = instrumentations.length; i < j; i++) {
assert.strictEqual(
instrumentations[i].instrumentationName,
Expand Down
1 change: 1 addition & 0 deletions plugins/node/instrumentation-mongoose/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/instrumentation-mongoose/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 4 additions & 0 deletions plugins/node/instrumentation-mongoose/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/bin
/coverage
/doc
/test
4 changes: 4 additions & 0 deletions plugins/node/instrumentation-mongoose/.tav.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'mongoose':
versions: ">=5.9.7 <7"
commands:
- npm run test
Loading

0 comments on commit b35277b

Please sign in to comment.