@opentelemetry/instrumentation-ioredis
Advanced tools
Comparing version 0.33.0 to 0.33.1
@@ -24,2 +24,3 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
const redis_common_1 = require("@opentelemetry/redis-common"); | ||
const version_1 = require("./version"); | ||
@@ -39,3 +40,3 @@ const DEFAULT_CONFIG = { | ||
const config = instrumentation.getConfig(); | ||
const dbStatementSerializer = (config === null || config === void 0 ? void 0 : config.dbStatementSerializer) || utils_1.defaultDbStatementSerializer; | ||
const dbStatementSerializer = (config === null || config === void 0 ? void 0 : config.dbStatementSerializer) || redis_common_1.defaultDbStatementSerializer; | ||
const hasNoParentSpan = api_1.trace.getSpan(api_1.context.active()) === undefined; | ||
@@ -42,0 +43,0 @@ if ((config === null || config === void 0 ? void 0 : config.requireParentSpan) === true && hasNoParentSpan) { |
/// <reference types="node" /> | ||
/// <reference types="mocha" /> | ||
import { Span } from '@opentelemetry/api'; | ||
import { DbStatementSerializer } from './types'; | ||
export declare const endSpan: (span: Span, err: NodeJS.ErrnoException | null | undefined) => void; | ||
export declare const defaultDbStatementSerializer: DbStatementSerializer; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -18,30 +18,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultDbStatementSerializer = exports.endSpan = void 0; | ||
exports.endSpan = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
/** | ||
* List of regexes and the number of arguments that should be serialized for matching commands. | ||
* For example, HSET should serialize which key and field it's operating on, but not its value. | ||
* Setting the subset to -1 will serialize all arguments. | ||
* Commands without a match will have their first argument serialized. | ||
* | ||
* Refer to https://redis.io/commands/ for the full list. | ||
*/ | ||
const serializationSubsets = [ | ||
{ | ||
regex: /^ECHO/i, | ||
args: 0, | ||
}, | ||
{ | ||
regex: /^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i, | ||
args: 1, | ||
}, | ||
{ | ||
regex: /^(HSET|HMSET|LSET|LINSERT)/i, | ||
args: 2, | ||
}, | ||
{ | ||
regex: /^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i, | ||
args: -1, | ||
}, | ||
]; | ||
const endSpan = (span, err) => { | ||
@@ -58,17 +32,2 @@ if (err) { | ||
exports.endSpan = endSpan; | ||
const defaultDbStatementSerializer = (cmdName, cmdArgs) => { | ||
var _a, _b; | ||
if (Array.isArray(cmdArgs) && cmdArgs.length) { | ||
const nArgsToSerialize = (_b = (_a = serializationSubsets.find(({ regex }) => { | ||
return regex.test(cmdName); | ||
})) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : 0; | ||
const argsToSerialize = nArgsToSerialize >= 0 ? cmdArgs.slice(0, nArgsToSerialize) : cmdArgs; | ||
if (cmdArgs.length > argsToSerialize.length) { | ||
argsToSerialize.push(`[${cmdArgs.length - nArgsToSerialize} other arguments]`); | ||
} | ||
return `${cmdName} ${argsToSerialize.join(' ')}`; | ||
} | ||
return cmdName; | ||
}; | ||
exports.defaultDbStatementSerializer = defaultDbStatementSerializer; | ||
//# sourceMappingURL=utils.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.33.0"; | ||
export declare const VERSION = "0.33.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.33.0'; | ||
exports.VERSION = '0.33.1'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-ioredis", | ||
"version": "0.33.0", | ||
"version": "0.33.1", | ||
"description": "OpenTelemetry ioredis automatic instrumentation package.", | ||
@@ -74,2 +74,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/instrumentation": "^0.34.0", | ||
"@opentelemetry/redis-common": "^0.34.0", | ||
"@opentelemetry/semantic-conventions": "^1.0.0", | ||
@@ -79,3 +80,3 @@ "@types/ioredis": "4.26.6" | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-ioredis#readme", | ||
"gitHead": "59fa57cfd0dff4ae0e6f3833dff73c55dfd79ee5" | ||
"gitHead": "8472e8273d14993a13f921b6f8173b20fb37a383" | ||
} |
@@ -60,3 +60,4 @@ # OpenTelemetry ioredis Instrumentation for Node.js | ||
as possible while avoiding the export of potentially sensitive data. The number of serialized arguments depends on the specific command, see the configuration | ||
list in `src/utils.ts`. | ||
list in `@opentelemetry/redis-common`. | ||
It is also possible to define a custom serialization function. The function will receive the command name and arguments and must return a string. | ||
@@ -63,0 +64,0 @@ |
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
116
41306
5
333
+ Added@opentelemetry/redis-common@0.34.0(transitive)