Skip to content

Commit

Permalink
chore(mongo): add condition in case cmd=unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
haddasbronfman committed Dec 6, 2022
1 parent 78e9bf2 commit 0b96a62
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,13 @@ export class MongoDBInstrumentation extends InstrumentationBase {
const span = instrumentation.tracer.startSpan(`mongodb.${type}`, {
kind: SpanKind.CLIENT,
});
instrumentation._populateV3Attributes(span, ns, server, cmd, type);
instrumentation._populateV3Attributes(
span,
ns,
server,
cmd,
commandType === MongodbCommandType.UNKNOWN ? undefined : commandType
);
const patchedCallback = instrumentation._patchEnd(span, resultHandler);
// handle when options is the callback to send the correct number of args
if (typeof options === 'function') {
Expand Down Expand Up @@ -521,7 +527,7 @@ export class MongoDBInstrumentation extends InstrumentationBase {
ns: string,
topology: MongoInternalTopology,
command?: MongoInternalCommand,
operation?: string
operation?: string | undefined
) {
// add network attributes to determine the remote server
let host: undefined | string;
Expand Down Expand Up @@ -565,7 +571,7 @@ export class MongoDBInstrumentation extends InstrumentationBase {
host?: undefined | string,
port?: undefined | string,
commandObj?: any,
operation?: string
operation?: string | undefined
) {
// add database related attributes
span.setAttributes({
Expand Down

0 comments on commit 0b96a62

Please sign in to comment.