@opentelemetry/instrumentation-ioredis 0.29.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +6 -5
- package/build/src/utils.js +40 -3
- package/build/src/utils.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.32.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.31.0...instrumentation-ioredis-v0.32.0) (2022-09-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update experimental Otel deps to ^0.31.0 ([#1096](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1096)) ([4c8843b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/4c8843be14896d1159a622c07eb3a049401ccba1))
|
|
9
|
+
* update experimental Otel deps to ^0.32.0 ([#1143](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1143)) ([6fb1911](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/6fb191139aed2ca763300dcf9adb51121a88f97e))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* The following workspace dependencies were updated
|
|
15
|
+
* devDependencies
|
|
16
|
+
* @opentelemetry/contrib-test-utils bumped from ^0.31.0 to ^0.32.0
|
|
17
|
+
|
|
18
|
+
## [0.31.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.30.0...instrumentation-ioredis-v0.31.0) (2022-06-17)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **ioredis:** only serialize non sensitive arguments in db statement attribute ([#1052](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1052)) ([375dfe0](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/375dfe07bcd88b8cfb0e6dc291dcc9fd3fba2f9e))
|
|
24
|
+
|
|
25
|
+
## [0.30.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.29.0...instrumentation-ioredis-v0.30.0) (2022-06-08)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* update core dependencies stable ^1.3.1 experimental ^0.29.2 ([141b155](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/141b155e344980b51264e26b26c117b2113bcef6))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Dependencies
|
|
34
|
+
|
|
35
|
+
* The following workspace dependencies were updated
|
|
36
|
+
* devDependencies
|
|
37
|
+
* @opentelemetry/contrib-test-utils bumped from ^0.30.0 to ^0.31.0
|
|
38
|
+
|
|
3
39
|
## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.28.0...instrumentation-ioredis-v0.29.0) (2022-05-14)
|
|
4
40
|
|
|
5
41
|
|
package/README.md
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
4
|
[![Apache License][license-image]][license-image]
|
|
5
5
|
|
|
6
|
-
This module provides automatic instrumentation for [`ioredis`](https://github.com/luin/ioredis).
|
|
6
|
+
This module provides automatic instrumentation for the [`ioredis`](https://github.com/luin/ioredis) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
[@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package.
|
|
8
|
+
If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience.
|
|
10
9
|
|
|
11
10
|
Compatible with OpenTelemetry JS API and SDK `1.0+`.
|
|
12
11
|
|
|
@@ -18,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-ioredis
|
|
|
18
17
|
|
|
19
18
|
### Supported Versions
|
|
20
19
|
|
|
21
|
-
- `>=2.0.0`
|
|
20
|
+
- `>=2.0.0 <5`
|
|
22
21
|
|
|
23
22
|
## Usage
|
|
24
23
|
|
|
@@ -56,7 +55,9 @@ IORedis instrumentation has few options available to choose from. You can set th
|
|
|
56
55
|
|
|
57
56
|
#### Custom db.statement Serializer
|
|
58
57
|
|
|
59
|
-
The instrumentation serializes the
|
|
58
|
+
The instrumentation serializes the command into a Span attribute called `db.statement`. The standard serialization format attempts to be as informative
|
|
59
|
+
as possible while avoiding the export of potentially sensitive data. The number of serialized arguments depends on the specific command, see the configuration
|
|
60
|
+
list in `src/utils.ts`.
|
|
60
61
|
It is also possible to define a custom serialization function. The function will receive the command name and arguments and must return a string.
|
|
61
62
|
|
|
62
63
|
Here is a simple example to serialize the command name skipping arguments:
|
package/build/src/utils.js
CHANGED
|
@@ -17,6 +17,32 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.defaultDbStatementSerializer = exports.endSpan = void 0;
|
|
19
19
|
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
/**
|
|
21
|
+
* List of regexes and the number of arguments that should be serialized for matching commands.
|
|
22
|
+
* For example, HSET should serialize which key and field it's operating on, but not its value.
|
|
23
|
+
* Setting the subset to -1 will serialize all arguments.
|
|
24
|
+
* Commands without a match will have their first argument serialized.
|
|
25
|
+
*
|
|
26
|
+
* Refer to https://redis.io/commands/ for the full list.
|
|
27
|
+
*/
|
|
28
|
+
const serializationSubsets = [
|
|
29
|
+
{
|
|
30
|
+
regex: /^ECHO/i,
|
|
31
|
+
args: 0,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
regex: /^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,
|
|
35
|
+
args: 1,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
regex: /^(HSET|HMSET|LSET|LINSERT)/i,
|
|
39
|
+
args: 2,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
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,
|
|
43
|
+
args: -1,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
20
46
|
const endSpan = (span, err) => {
|
|
21
47
|
if (err) {
|
|
22
48
|
span.recordException(err);
|
|
@@ -28,8 +54,19 @@ const endSpan = (span, err) => {
|
|
|
28
54
|
span.end();
|
|
29
55
|
};
|
|
30
56
|
exports.endSpan = endSpan;
|
|
31
|
-
const defaultDbStatementSerializer = (cmdName, cmdArgs) =>
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
const defaultDbStatementSerializer = (cmdName, cmdArgs) => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
if (Array.isArray(cmdArgs) && cmdArgs.length) {
|
|
60
|
+
const nArgsToSerialize = (_b = (_a = serializationSubsets.find(({ regex }) => {
|
|
61
|
+
return regex.test(cmdName);
|
|
62
|
+
})) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : 0;
|
|
63
|
+
const argsToSerialize = nArgsToSerialize >= 0 ? cmdArgs.slice(0, nArgsToSerialize) : cmdArgs;
|
|
64
|
+
if (cmdArgs.length > argsToSerialize.length) {
|
|
65
|
+
argsToSerialize.push(`[${cmdArgs.length - nArgsToSerialize} other arguments]`);
|
|
66
|
+
}
|
|
67
|
+
return `${cmdName} ${argsToSerialize.join(' ')}`;
|
|
68
|
+
}
|
|
69
|
+
return cmdName;
|
|
70
|
+
};
|
|
34
71
|
exports.defaultDbStatementSerializer = defaultDbStatementSerializer;
|
|
35
72
|
//# sourceMappingURL=utils.js.map
|
package/build/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0D;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0D;AAG1D;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAG;IAC3B;QACE,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,8DAA8D;QACrE,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EACH,kLAAkL;QACpL,IAAI,EAAE,CAAC,CAAC;KACT;CACF,CAAC;AAEK,MAAM,OAAO,GAAG,CACrB,IAAU,EACV,GAA6C,EAC7C,EAAE;IACF,IAAI,GAAG,EAAE;QACP,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,oBAAc,CAAC,KAAK;YAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC;KACJ;IACD,IAAI,CAAC,GAAG,EAAE,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,OAAO,WAYlB;AAEK,MAAM,4BAA4B,GAA0B,CACjE,OAAO,EACP,OAAO,EACP,EAAE;;IACF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;QAC5C,MAAM,gBAAgB,GACpB,MAAA,MAAA,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YACtC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,0CAAE,IAAI,mCAAI,CAAC,CAAC;QAChB,MAAM,eAAe,GACnB,gBAAgB,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACvE,IAAI,OAAO,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE;YAC3C,eAAe,CAAC,IAAI,CAClB,IAAI,OAAO,CAAC,MAAM,GAAG,gBAAgB,mBAAmB,CACzD,CAAC;SACH;QACD,OAAO,GAAG,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KAClD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAnBW,QAAA,4BAA4B,gCAmBvC"}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.32.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-ioredis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "OpenTelemetry ioredis automatic instrumentation package.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@opentelemetry/api": "^1.0.0",
|
|
54
|
-
"@opentelemetry/context-async-hooks": "1.
|
|
55
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
56
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
57
|
-
"@opentelemetry/sdk-trace-node": "1.
|
|
54
|
+
"@opentelemetry/context-async-hooks": "^1.3.1",
|
|
55
|
+
"@opentelemetry/contrib-test-utils": "^0.32.0",
|
|
56
|
+
"@opentelemetry/sdk-trace-base": "^1.3.1",
|
|
57
|
+
"@opentelemetry/sdk-trace-node": "^1.3.1",
|
|
58
58
|
"@types/mocha": "7.0.2",
|
|
59
59
|
"@types/node": "16.11.21",
|
|
60
60
|
"@types/sinon": "10.0.9",
|
|
@@ -64,15 +64,16 @@
|
|
|
64
64
|
"mocha": "7.2.0",
|
|
65
65
|
"nyc": "15.1.0",
|
|
66
66
|
"rimraf": "3.0.2",
|
|
67
|
-
"sinon": "
|
|
67
|
+
"sinon": "14.0.0",
|
|
68
68
|
"test-all-versions": "5.0.1",
|
|
69
|
-
"ts-mocha": "
|
|
69
|
+
"ts-mocha": "10.0.0",
|
|
70
70
|
"typescript": "4.3.5"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@opentelemetry/instrumentation": "^0.
|
|
73
|
+
"@opentelemetry/instrumentation": "^0.32.0",
|
|
74
74
|
"@opentelemetry/semantic-conventions": "^1.0.0",
|
|
75
75
|
"@types/ioredis": "4.26.6"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
77
|
+
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-ioredis#readme",
|
|
78
|
+
"gitHead": "4a9442ceea7f8555ad6e5f731f92834f3398d5b9"
|
|
78
79
|
}
|