Skip to content

Commit ee85f3d

Browse files
authored
Merge pull request #47 from barkh-products/master
Fix error when some options where circular.
2 parents 8f1f390 + b75dfd6 commit ee85f3d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/mongoose.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export class MongoosePlugin extends BasePlugin<typeof mongoose> {
6161
let span = startSpan(thisPlugin._tracer, this._model?.modelName, 'aggregate', parentSpan);
6262
span.setAttributes(getAttributesFromCollection(this._model.collection));
6363
span.setAttribute(AttributeNames.DB_QUERY_TYPE, 'aggregate');
64-
span.setAttribute(AttributeNames.DB_OPTIONS, JSON.stringify(this.options));
65-
span.setAttribute(AttributeNames.DB_AGGREGATE_PIPELINE, JSON.stringify(this._pipeline));
64+
span.setAttribute(AttributeNames.DB_OPTIONS, safeStringify(this.options));
65+
span.setAttribute(AttributeNames.DB_AGGREGATE_PIPELINE, safeStringify(this._pipeline));
6666

6767
const aggregateResponse = originalExec.apply(this, arguments);
6868
return handleExecResponse(aggregateResponse, span, thisPlugin?._config?.enhancedDatabaseReporting);
@@ -81,9 +81,9 @@ export class MongoosePlugin extends BasePlugin<typeof mongoose> {
8181
span.setAttributes(getAttributesFromCollection(this.mongooseCollection));
8282

8383
span.setAttribute(AttributeNames.DB_QUERY_TYPE, this.op)
84-
span.setAttribute(AttributeNames.DB_STATEMENT, JSON.stringify(this._conditions))
85-
span.setAttribute(AttributeNames.DB_OPTIONS, JSON.stringify(this.options))
86-
span.setAttribute(AttributeNames.DB_UPDATE, JSON.stringify(this._update))
84+
span.setAttribute(AttributeNames.DB_STATEMENT, safeStringify(this._conditions))
85+
span.setAttribute(AttributeNames.DB_OPTIONS, safeStringify(this.options))
86+
span.setAttribute(AttributeNames.DB_UPDATE, safeStringify(this._update))
8787

8888
const queryResponse = originalExec.apply(this, arguments)
8989
return handleExecResponse(queryResponse, span, thisPlugin?._config?.enhancedDatabaseReporting);

0 commit comments

Comments
 (0)