Skip to content

Commit

Permalink
fix(mongodb-plugin): check currentSpan against undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Dec 10, 2019
1 parent 9db4bad commit c125012
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/opentelemetry-plugin-mongodb-core/src/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class MongoDBCorePlugin extends BasePlugin<typeof mongodb> {
const resultHandler =
typeof options === 'function' ? options : callback;
if (
currentSpan === null ||
currentSpan === undefined ||
typeof resultHandler !== 'function' ||
typeof commands !== 'object'
) {
Expand Down Expand Up @@ -208,7 +208,7 @@ export class MongoDBCorePlugin extends BasePlugin<typeof mongodb> {
): mongodb.Cursor {
const currentSpan = plugin._tracer.getCurrentSpan();
const resultHandler = args[0];
if (currentSpan === null || typeof resultHandler !== 'function') {
if (currentSpan === undefined || typeof resultHandler !== 'function') {
return original.apply(this, args);
}
const span = plugin._tracer.startSpan(`mongodb.query`, {
Expand Down

0 comments on commit c125012

Please sign in to comment.