From 58b8e8c52982a7af3e9b6b7a703dcd9f16a6a3de Mon Sep 17 00:00:00 2001 From: haddasb Date: Tue, 6 Dec 2022 17:49:07 +0200 Subject: [PATCH] chore(mongo): make code more readable --- .../src/instrumentation.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts index 0d3d6079dd..8361de772c 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts @@ -256,13 +256,9 @@ export class MongoDBInstrumentation extends InstrumentationBase { const span = instrumentation.tracer.startSpan(`mongodb.${type}`, { kind: SpanKind.CLIENT, }); - instrumentation._populateV3Attributes( - span, - ns, - server, - cmd, - commandType === MongodbCommandType.UNKNOWN ? undefined : commandType - ); + const operation = + commandType === MongodbCommandType.UNKNOWN ? undefined : commandType; + instrumentation._populateV3Attributes(span, ns, server, cmd, operation); const patchedCallback = instrumentation._patchEnd(span, resultHandler); // handle when options is the callback to send the correct number of args if (typeof options === 'function') {