@opentelemetry/instrumentation-ioredis 0.28.0 → 0.31.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 +5 -10
- 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 +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **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))
|
|
9
|
+
|
|
10
|
+
## [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)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* update core dependencies stable ^1.3.1 experimental ^0.29.2 ([141b155](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/141b155e344980b51264e26b26c117b2113bcef6))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* devDependencies
|
|
22
|
+
* @opentelemetry/contrib-test-utils bumped from ^0.30.0 to ^0.31.0
|
|
23
|
+
|
|
24
|
+
## [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)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* add supported node versions for all packages ([#973](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/973)) ([baaacbd](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/baaacbdd35ca4baab0afae64647aa8c0380ee4b7))
|
|
30
|
+
* use Otel SDK 1.2/0.28 ([#984](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/984)) ([098c2ed](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/098c2ed6f9c5ab7bd865685018c0777245aab3b7))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Dependencies
|
|
34
|
+
|
|
35
|
+
* The following workspace dependencies were updated
|
|
36
|
+
* devDependencies
|
|
37
|
+
* @opentelemetry/contrib-test-utils bumped from 0.29.0 to ^0.30.0
|
|
38
|
+
|
|
3
39
|
## [0.28.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.27.1...instrumentation-ioredis-v0.28.0) (2022-03-02)
|
|
4
40
|
|
|
5
41
|
|
package/README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
# OpenTelemetry ioredis Instrumentation for Node.js
|
|
2
2
|
|
|
3
3
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
|
-
[![dependencies][dependencies-image]][dependencies-url]
|
|
5
|
-
[![devDependencies][devDependencies-image]][devDependencies-url]
|
|
6
4
|
[![Apache License][license-image]][license-image]
|
|
7
5
|
|
|
8
|
-
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.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
[@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-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.
|
|
12
9
|
|
|
13
10
|
Compatible with OpenTelemetry JS API and SDK `1.0+`.
|
|
14
11
|
|
|
@@ -58,7 +55,9 @@ IORedis instrumentation has few options available to choose from. You can set th
|
|
|
58
55
|
|
|
59
56
|
#### Custom db.statement Serializer
|
|
60
57
|
|
|
61
|
-
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`.
|
|
62
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.
|
|
63
62
|
|
|
64
63
|
Here is a simple example to serialize the command name skipping arguments:
|
|
@@ -111,9 +110,5 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
|
111
110
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
112
111
|
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
|
|
113
112
|
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
114
|
-
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis
|
|
115
|
-
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis
|
|
116
|
-
[devdependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis&type=dev
|
|
117
|
-
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis&type=dev
|
|
118
113
|
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-ioredis
|
|
119
114
|
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-ioredis.svg
|
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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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.31.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.31.0",
|
|
4
4
|
"description": "OpenTelemetry ioredis automatic instrumentation package.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"clean": "rimraf build/*",
|
|
16
16
|
"lint": "eslint . --ext .ts",
|
|
17
17
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
18
|
-
"precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-ioredis --include-dependencies",
|
|
18
|
+
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-ioredis --include-dependencies",
|
|
19
19
|
"prewatch": "npm run precompile",
|
|
20
20
|
"version:update": "node ../../../scripts/version-update.js",
|
|
21
|
-
"compile": "
|
|
21
|
+
"compile": "tsc -p .",
|
|
22
22
|
"prepare": "npm run compile"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "OpenTelemetry Authors",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=8.
|
|
36
|
+
"node": ">=8.12.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"build/src/**/*.js",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@opentelemetry/api": "^1.0.
|
|
50
|
+
"@opentelemetry/api": "^1.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@opentelemetry/api": "1.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.
|
|
53
|
+
"@opentelemetry/api": "^1.0.0",
|
|
54
|
+
"@opentelemetry/context-async-hooks": "^1.3.1",
|
|
55
|
+
"@opentelemetry/contrib-test-utils": "^0.31.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.29.2",
|
|
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": "8f95ee79a8c24600c7190e03ff2adfdcac6d6d38"
|
|
78
79
|
}
|