@@ -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