From 644b5eb06a8081e05cc194b5fe4ceb2670387694 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 5 Apr 2023 10:39:15 +0300 Subject: [PATCH] fix: loading of mongoose instrumentation due to invalid package name --- src/instrumentations/index.ts | 2 +- test/instrumentations.test.ts | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/instrumentations/index.ts b/src/instrumentations/index.ts index 8150826b..6fb7f108 100644 --- a/src/instrumentations/index.ts +++ b/src/instrumentations/index.ts @@ -39,6 +39,7 @@ const bundledInstrumentations: [string, string][] = [ ['@opentelemetry/instrumentation-koa', 'KoaInstrumentation'], ['@opentelemetry/instrumentation-memcached', 'MemcachedInstrumentation'], ['@opentelemetry/instrumentation-mongodb', 'MongoDBInstrumentation'], + ['@opentelemetry/instrumentation-mongoose', 'MongooseInstrumentation'], ['@opentelemetry/instrumentation-mysql', 'MySQLInstrumentation'], ['@opentelemetry/instrumentation-mysql2', 'MySQL2Instrumentation'], ['@opentelemetry/instrumentation-nestjs-core', 'NestInstrumentation'], @@ -56,7 +57,6 @@ const bundledInstrumentations: [string, string][] = [ 'ElasticsearchInstrumentation', ], ['opentelemetry-instrumentation-kafkajs', 'KafkaJsInstrumentation'], - ['opentelemetry-instrumentation-mongoose', 'MongooseInstrumentation'], ['opentelemetry-instrumentation-sequelize', 'SequelizeInstrumentation'], ['opentelemetry-instrumentation-typeorm', 'TypeormInstrumentation'], ]; diff --git a/test/instrumentations.test.ts b/test/instrumentations.test.ts index 40334123..ec928a36 100644 --- a/test/instrumentations.test.ts +++ b/test/instrumentations.test.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import * as sinon from 'sinon'; import * as assert from 'assert'; import * as rewire from 'rewire'; @@ -23,14 +22,8 @@ import * as loader from '../src/instrumentations/loader'; describe('instrumentations', () => { it('loads instrumentations if they are installed', () => { - const loadStub = sinon.stub(loader, 'load'); - try { - const inst = instrumentations.getInstrumentations(); - sinon.assert.callCount(loadStub, 36); - } finally { - loadStub.reset(); - loadStub.restore(); - } + const loadedInstrumentations = instrumentations.getInstrumentations(); + assert.equal(loadedInstrumentations.length, 36); }); it('loader silently fails when instrumentation is not installed', () => {