@opentelemetry/instrumentation-mongodb
Advanced tools
Comparing version 0.44.0 to 0.45.0
@@ -54,2 +54,3 @@ import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; | ||
private _defaultDbStatementSerializer; | ||
private _scrubStatement; | ||
/** | ||
@@ -56,0 +57,0 @@ * Triggers the response hook in case it is defined. |
@@ -467,2 +467,5 @@ "use strict"; | ||
} | ||
else if (command.aggregate !== undefined) { | ||
return internal_types_1.MongodbCommandType.AGGREGATE; | ||
} | ||
else { | ||
@@ -571,8 +574,18 @@ return internal_types_1.MongodbCommandType.UNKNOWN; | ||
? commandObj | ||
: Object.keys(commandObj).reduce((obj, key) => { | ||
obj[key] = '?'; | ||
return obj; | ||
}, {}); | ||
: this._scrubStatement(commandObj); | ||
return JSON.stringify(resultObj); | ||
} | ||
_scrubStatement(value) { | ||
if (Array.isArray(value)) { | ||
return value.map(element => this._scrubStatement(element)); | ||
} | ||
if (typeof value === 'object' && value !== null) { | ||
return Object.fromEntries(Object.entries(value).map(([key, element]) => [ | ||
key, | ||
this._scrubStatement(element), | ||
])); | ||
} | ||
// A value like string or number, possible contains PII, scrub it | ||
return '?'; | ||
} | ||
/** | ||
@@ -579,0 +592,0 @@ * Triggers the response hook in case it is defined. |
@@ -37,2 +37,3 @@ import { InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
count: boolean; | ||
aggregate: boolean; | ||
ismaster: boolean; | ||
@@ -90,2 +91,3 @@ indexes?: unknown[]; | ||
COUNT = "count", | ||
AGGREGATE = "aggregate", | ||
UNKNOWN = "unknown" | ||
@@ -92,0 +94,0 @@ } |
@@ -25,4 +25,5 @@ "use strict"; | ||
MongodbCommandType["COUNT"] = "count"; | ||
MongodbCommandType["AGGREGATE"] = "aggregate"; | ||
MongodbCommandType["UNKNOWN"] = "unknown"; | ||
})(MongodbCommandType = exports.MongodbCommandType || (exports.MongodbCommandType = {})); | ||
//# sourceMappingURL=internal-types.js.map |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.44.0"; | ||
export declare const PACKAGE_VERSION = "0.45.0"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-mongodb"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.44.0'; | ||
exports.PACKAGE_VERSION = '0.45.0'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-mongodb'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-mongodb", | ||
"version": "0.44.0", | ||
"version": "0.45.0", | ||
"description": "OpenTelemetry instrumentation for `mongodb` database client for MongoDB", | ||
@@ -74,3 +74,3 @@ "main": "build/src/index.js", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mongodb#readme", | ||
"gitHead": "0af1b70f7c3c9763c85ac51fa5e334c1e1512020" | ||
"gitHead": "93e7aab9a38e22c9ef6c0a9053f817e7e52a687c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129814
986