@opentelemetry/instrumentation-ioredis 0.25.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/LICENSE +201 -0
- package/README.md +117 -0
- package/build/src/index.d.ts +3 -0
- package/build/src/index.js +29 -0
- package/build/src/index.js.map +1 -0
- package/build/src/instrumentation.d.ts +14 -0
- package/build/src/instrumentation.js +68 -0
- package/build/src/instrumentation.js.map +1 -0
- package/build/src/types.d.ts +54 -0
- package/build/src/types.js +18 -0
- package/build/src/types.js.map +1 -0
- package/build/src/utils.d.ts +6 -0
- package/build/src/utils.js +124 -0
- package/build/src/utils.js.map +1 -0
- package/build/src/version.d.ts +2 -0
- package/build/src/version.js +21 -0
- package/build/src/version.js.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# OpenTelemetry ioredis Instrumentation for Node.js
|
|
2
|
+
|
|
3
|
+
[![NPM Published Version][npm-img]][npm-url]
|
|
4
|
+
[![dependencies][dependencies-image]][dependencies-url]
|
|
5
|
+
[![devDependencies][devDependencies-image]][devDependencies-url]
|
|
6
|
+
[![Apache License][license-image]][license-image]
|
|
7
|
+
|
|
8
|
+
This module provides automatic instrumentation for [`ioredis`](https://github.com/luin/ioredis).
|
|
9
|
+
|
|
10
|
+
For automatic instrumentation see the
|
|
11
|
+
[@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-node) package.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install --save @opentelemetry/instrumentation-ioredis
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Supported Versions
|
|
20
|
+
|
|
21
|
+
- `>=2.0.0`
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
To load a specific instrumentation (**ioredis** in this case), specify it in the registerInstrumentations's configuration
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
29
|
+
const {
|
|
30
|
+
IORedisInstrumentation,
|
|
31
|
+
} = require('@opentelemetry/instrumentation-ioredis');
|
|
32
|
+
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
|
|
33
|
+
|
|
34
|
+
const provider = new NodeTracerProvider();
|
|
35
|
+
provider.register();
|
|
36
|
+
|
|
37
|
+
registerInstrumentations({
|
|
38
|
+
instrumentations: [
|
|
39
|
+
new IORedisInstrumentation({
|
|
40
|
+
// see under for available configuration
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### IORedis Instrumentation Options
|
|
47
|
+
|
|
48
|
+
IORedis instrumentation has few options available to choose from. You can set the following:
|
|
49
|
+
|
|
50
|
+
| Options | Type | Description |
|
|
51
|
+
| ----------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `dbStatementSerializer` | `DbStatementSerializer` | IORedis instrumentation will serialize db.statement using the specified function. |
|
|
53
|
+
| `requestHook` | `RedisRequestCustomAttributeFunction` (function) | Function for adding custom attributes on db request. Receives params: `span, { moduleVersion, cmdName, cmdArgs }` |
|
|
54
|
+
| `responseHook` | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response |
|
|
55
|
+
| `requireParentSpan` | `boolean` | Require parent to create ioredis span, default when unset is true |
|
|
56
|
+
|
|
57
|
+
#### Custom db.statement Serializer
|
|
58
|
+
|
|
59
|
+
The instrumentation serializes the whole command into a Span attribute called `db.statement`. The standard serialization format is `{cmdName} {cmdArgs.join(',')}`.
|
|
60
|
+
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
|
+
Here is a simple example to serialize the command name skipping arguments:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
const { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');
|
|
66
|
+
|
|
67
|
+
const ioredisInstrumentation = new IORedisInstrumentation({
|
|
68
|
+
dbStatementSerializer: function (cmdName, cmdArgs) {
|
|
69
|
+
return cmdName;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Using `requestHook`
|
|
75
|
+
|
|
76
|
+
Instrumentation user can configure a custom "hook" function which will be called on every request with the relevant span and request information. User can then set custom attributes on the span or run any instrumentation-extension logic per request.
|
|
77
|
+
|
|
78
|
+
Here is a simple example that adds a span attribute of `ioredis` instrumented version on each request:
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
const { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');
|
|
82
|
+
|
|
83
|
+
const ioredisInstrumentation = new IORedisInstrumentation({
|
|
84
|
+
requestHook: function (
|
|
85
|
+
span: Span,
|
|
86
|
+
requestInfo: IORedisRequestHookInformation
|
|
87
|
+
) {
|
|
88
|
+
if (requestInfo.moduleVersion) {
|
|
89
|
+
span.setAttribute(
|
|
90
|
+
'instrumented_library.version',
|
|
91
|
+
requestInfo.moduleVersion
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Useful links
|
|
100
|
+
|
|
101
|
+
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
102
|
+
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
|
103
|
+
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
108
|
+
|
|
109
|
+
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
110
|
+
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
|
|
111
|
+
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
112
|
+
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis
|
|
113
|
+
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis
|
|
114
|
+
[devdependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis&type=dev
|
|
115
|
+
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-ioredis&type=dev
|
|
116
|
+
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-ioredis
|
|
117
|
+
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-ioredis.svg
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./instrumentation"), exports);
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,oDAAkC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as ioredisTypes from 'ioredis';
|
|
2
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
3
|
+
import { IORedisInstrumentationConfig } from './types';
|
|
4
|
+
export declare class IORedisInstrumentation extends InstrumentationBase<typeof ioredisTypes> {
|
|
5
|
+
static readonly DB_SYSTEM = "redis";
|
|
6
|
+
constructor(_config?: IORedisInstrumentationConfig);
|
|
7
|
+
init(): InstrumentationNodeModuleDefinition<typeof ioredisTypes>[];
|
|
8
|
+
/**
|
|
9
|
+
* Patch send command internal to trace requests
|
|
10
|
+
*/
|
|
11
|
+
private _patchSendCommand;
|
|
12
|
+
private _patchConnection;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.IORedisInstrumentation = void 0;
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
21
|
+
const utils_1 = require("./utils");
|
|
22
|
+
const version_1 = require("./version");
|
|
23
|
+
const DEFAULT_CONFIG = {
|
|
24
|
+
requireParentSpan: true,
|
|
25
|
+
};
|
|
26
|
+
class IORedisInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
27
|
+
constructor(_config = {}) {
|
|
28
|
+
super('@opentelemetry/instrumentation-ioredis', version_1.VERSION, Object.assign({}, DEFAULT_CONFIG, _config));
|
|
29
|
+
}
|
|
30
|
+
init() {
|
|
31
|
+
return [
|
|
32
|
+
new instrumentation_1.InstrumentationNodeModuleDefinition('ioredis', ['>1 <5'], (moduleExports, moduleVersion) => {
|
|
33
|
+
api_1.diag.debug('Applying patch for ioredis');
|
|
34
|
+
if (instrumentation_1.isWrapped(moduleExports.prototype.sendCommand)) {
|
|
35
|
+
this._unwrap(moduleExports.prototype, 'sendCommand');
|
|
36
|
+
}
|
|
37
|
+
this._wrap(moduleExports.prototype, 'sendCommand', this._patchSendCommand(moduleVersion));
|
|
38
|
+
if (instrumentation_1.isWrapped(moduleExports.prototype.connect)) {
|
|
39
|
+
this._unwrap(moduleExports.prototype, 'connect');
|
|
40
|
+
}
|
|
41
|
+
this._wrap(moduleExports.prototype, 'connect', this._patchConnection());
|
|
42
|
+
return moduleExports;
|
|
43
|
+
}, moduleExports => {
|
|
44
|
+
if (moduleExports === undefined)
|
|
45
|
+
return;
|
|
46
|
+
api_1.diag.debug('Removing patch for ioredis');
|
|
47
|
+
this._unwrap(moduleExports.prototype, 'sendCommand');
|
|
48
|
+
this._unwrap(moduleExports.prototype, 'connect');
|
|
49
|
+
}),
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Patch send command internal to trace requests
|
|
54
|
+
*/
|
|
55
|
+
_patchSendCommand(moduleVersion) {
|
|
56
|
+
return (original) => {
|
|
57
|
+
return utils_1.traceSendCommand(this.tracer, original, this._config, moduleVersion);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
_patchConnection() {
|
|
61
|
+
return (original) => {
|
|
62
|
+
return utils_1.traceConnection(this.tracer, original);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.IORedisInstrumentation = IORedisInstrumentation;
|
|
67
|
+
IORedisInstrumentation.DB_SYSTEM = 'redis';
|
|
68
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAE1C,oEAIwC;AAExC,mCAA4D;AAC5D,uCAAoC;AAEpC,MAAM,cAAc,GAAiC;IACnD,iBAAiB,EAAE,IAAI;CAC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AEG;IACK,iBAAiB,CAAC,aAAsB;QAC9C,OAAO,CAAC,QAAkB,EAAE,EAAE;YAC5B,OAAO,wBAAgB,CACrB,IAAI,CAAC,MAAM,EACX,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,aAAa,CACd,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,OAAO,CAAC,QAAkB,EAAE,EAAE;YAC5B,OAAO,uBAAe,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC,CAAC;IACJ,CAAC;;AAlEH,wDAmEC;AAhEiB,gCAAS,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type * as ioredisTypes from 'ioredis';
|
|
3
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
4
|
+
import { Span } from '@opentelemetry/api';
|
|
5
|
+
export interface IORedisCommand {
|
|
6
|
+
reject: (err: Error) => void;
|
|
7
|
+
resolve: (result: {}) => void;
|
|
8
|
+
promise: Promise<{}>;
|
|
9
|
+
args: Array<string | Buffer | number>;
|
|
10
|
+
callback: ioredisTypes.CallbackFunction<unknown>;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Function that can be used to serialize db.statement tag
|
|
15
|
+
* @param cmdName - The name of the command (eg. set, get, mset)
|
|
16
|
+
* @param cmdArgs - Array of arguments passed to the command
|
|
17
|
+
*
|
|
18
|
+
* @returns serialized string that will be used as the db.statement attribute.
|
|
19
|
+
*/
|
|
20
|
+
export declare type DbStatementSerializer = (cmdName: IORedisCommand['name'], cmdArgs: IORedisCommand['args']) => string;
|
|
21
|
+
export interface IORedisRequestHookInformation {
|
|
22
|
+
moduleVersion?: string;
|
|
23
|
+
cmdName: IORedisCommand['name'];
|
|
24
|
+
cmdArgs: IORedisCommand['args'];
|
|
25
|
+
}
|
|
26
|
+
export interface RedisRequestCustomAttributeFunction {
|
|
27
|
+
(span: Span, requestInfo: IORedisRequestHookInformation): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Function that can be used to add custom attributes to span on response from redis server
|
|
31
|
+
* @param span - The span created for the redis command, on which attributes can be set
|
|
32
|
+
* @param cmdName - The name of the command (eg. set, get, mset)
|
|
33
|
+
* @param cmdArgs - Array of arguments passed to the command
|
|
34
|
+
* @param response - The response object which is returned to the user who called this command.
|
|
35
|
+
* Can be used to set custom attributes on the span.
|
|
36
|
+
* The type of the response varies depending on the specific command.
|
|
37
|
+
*/
|
|
38
|
+
export interface RedisResponseCustomAttributeFunction {
|
|
39
|
+
(span: Span, cmdName: IORedisCommand['name'], cmdArgs: IORedisCommand['args'], response: unknown): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Options available for the IORedis Instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-ioredis#ioredis-instrumentation-options))
|
|
43
|
+
*/
|
|
44
|
+
export interface IORedisInstrumentationConfig extends InstrumentationConfig {
|
|
45
|
+
/** Custom serializer function for the db.statement tag */
|
|
46
|
+
dbStatementSerializer?: DbStatementSerializer;
|
|
47
|
+
/** Function for adding custom attributes on db request */
|
|
48
|
+
requestHook?: RedisRequestCustomAttributeFunction;
|
|
49
|
+
/** Function for adding custom attributes on db response */
|
|
50
|
+
responseHook?: RedisResponseCustomAttributeFunction;
|
|
51
|
+
/** Require parent to create ioredis span, default when unset is true */
|
|
52
|
+
requireParentSpan?: boolean;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as ioredisTypes from 'ioredis';
|
|
2
|
+
import { Tracer } from '@opentelemetry/api';
|
|
3
|
+
import { IORedisCommand, IORedisInstrumentationConfig } from './types';
|
|
4
|
+
export declare const traceConnection: (tracer: Tracer, original: Function) => (this: ioredisTypes.Redis) => any;
|
|
5
|
+
export declare const traceSendCommand: (tracer: Tracer, original: Function, config?: IORedisInstrumentationConfig | undefined, moduleVersion?: string | undefined) => (this: ioredisTypes.Redis, cmd?: IORedisCommand | undefined) => any;
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.traceSendCommand = exports.traceConnection = void 0;
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const _1 = require("./");
|
|
21
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
22
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
23
|
+
const endSpan = (span, err) => {
|
|
24
|
+
if (err) {
|
|
25
|
+
span.recordException(err);
|
|
26
|
+
span.setStatus({
|
|
27
|
+
code: api_1.SpanStatusCode.ERROR,
|
|
28
|
+
message: err.message,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
span.end();
|
|
32
|
+
};
|
|
33
|
+
const traceConnection = (tracer, original) => {
|
|
34
|
+
return function () {
|
|
35
|
+
const span = tracer.startSpan('connect', {
|
|
36
|
+
kind: api_1.SpanKind.CLIENT,
|
|
37
|
+
attributes: {
|
|
38
|
+
[semantic_conventions_1.SemanticAttributes.DB_SYSTEM]: _1.IORedisInstrumentation.DB_SYSTEM,
|
|
39
|
+
[semantic_conventions_1.SemanticAttributes.DB_STATEMENT]: 'connect',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const { host, port } = this.options;
|
|
43
|
+
span.setAttributes({
|
|
44
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: host,
|
|
45
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: port,
|
|
46
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_IP]: `redis://${host}:${port}`,
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
const client = original.apply(this, arguments);
|
|
50
|
+
endSpan(span, null);
|
|
51
|
+
return client;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
endSpan(span, error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.traceConnection = traceConnection;
|
|
60
|
+
const defaultDbStatementSerializer = (cmdName, cmdArgs) => Array.isArray(cmdArgs) && cmdArgs.length
|
|
61
|
+
? `${cmdName} ${cmdArgs.join(' ')}`
|
|
62
|
+
: cmdName;
|
|
63
|
+
const traceSendCommand = (tracer, original, config, moduleVersion) => {
|
|
64
|
+
const dbStatementSerializer = (config === null || config === void 0 ? void 0 : config.dbStatementSerializer) || defaultDbStatementSerializer;
|
|
65
|
+
return function (cmd) {
|
|
66
|
+
if (arguments.length < 1 || typeof cmd !== 'object') {
|
|
67
|
+
return original.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
const hasNoParentSpan = api_1.trace.getSpan(api_1.context.active()) === undefined;
|
|
70
|
+
if ((config === null || config === void 0 ? void 0 : config.requireParentSpan) === true && hasNoParentSpan) {
|
|
71
|
+
return original.apply(this, arguments);
|
|
72
|
+
}
|
|
73
|
+
const span = tracer.startSpan(cmd.name, {
|
|
74
|
+
kind: api_1.SpanKind.CLIENT,
|
|
75
|
+
attributes: {
|
|
76
|
+
[semantic_conventions_1.SemanticAttributes.DB_SYSTEM]: _1.IORedisInstrumentation.DB_SYSTEM,
|
|
77
|
+
[semantic_conventions_1.SemanticAttributes.DB_STATEMENT]: dbStatementSerializer(cmd.name, cmd.args),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
if (config === null || config === void 0 ? void 0 : config.requestHook) {
|
|
81
|
+
instrumentation_1.safeExecuteInTheMiddle(() => config === null || config === void 0 ? void 0 : config.requestHook(span, {
|
|
82
|
+
moduleVersion,
|
|
83
|
+
cmdName: cmd.name,
|
|
84
|
+
cmdArgs: cmd.args,
|
|
85
|
+
}), e => {
|
|
86
|
+
if (e) {
|
|
87
|
+
api_1.diag.error('ioredis instrumentation: request hook failed', e);
|
|
88
|
+
}
|
|
89
|
+
}, true);
|
|
90
|
+
}
|
|
91
|
+
const { host, port } = this.options;
|
|
92
|
+
span.setAttributes({
|
|
93
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: host,
|
|
94
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: port,
|
|
95
|
+
[semantic_conventions_1.SemanticAttributes.NET_PEER_IP]: `redis://${host}:${port}`,
|
|
96
|
+
});
|
|
97
|
+
try {
|
|
98
|
+
const result = original.apply(this, arguments);
|
|
99
|
+
const origResolve = cmd.resolve;
|
|
100
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
101
|
+
cmd.resolve = function (result) {
|
|
102
|
+
instrumentation_1.safeExecuteInTheMiddle(() => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.responseHook) === null || _a === void 0 ? void 0 : _a.call(config, span, cmd.name, cmd.args, result); }, e => {
|
|
103
|
+
if (e) {
|
|
104
|
+
api_1.diag.error('ioredis instrumentation: response hook failed', e);
|
|
105
|
+
}
|
|
106
|
+
}, true);
|
|
107
|
+
endSpan(span, null);
|
|
108
|
+
origResolve(result);
|
|
109
|
+
};
|
|
110
|
+
const origReject = cmd.reject;
|
|
111
|
+
cmd.reject = function (err) {
|
|
112
|
+
endSpan(span, err);
|
|
113
|
+
origReject(err);
|
|
114
|
+
};
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
endSpan(span, error);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
exports.traceSendCommand = traceSendCommand;
|
|
124
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,4CAQ4B;AAM5B,yBAA4C;AAC5C,8EAAyE;AACzE,oEAAwE;AAExE,MAAM,OAAO,GAAG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AEF,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACpB,WAAW,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC,CAAC;YAEF,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC;YAC9B,GAAG,CAAC,MAAM,GAAG,UAAU,GAAU;gBAC/B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBACnB,UAAU,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC,CAAC;YAEF,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACrB,MAAM,KAAK,CAAC;SACb;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAtFW,QAAA,gBAAgB,oBAsF3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.VERSION = void 0;
|
|
19
|
+
// this is autogenerated file, see scripts/version-update.js
|
|
20
|
+
exports.VERSION = '0.25.0';
|
|
21
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentelemetry/instrumentation-ioredis",
|
|
3
|
+
"version": "0.25.0",
|
|
4
|
+
"description": "OpenTelemetry ioredis automatic instrumentation package.",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"types": "build/src/index.d.ts",
|
|
7
|
+
"repository": "open-telemetry/opentelemetry-js-contrib",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
|
|
10
|
+
"test:debug": "cross-env RUN_REDIS_TESTS_LOCAL=true ts-mocha --inspect-brk --no-timeouts -p tsconfig.json 'test/**/*.test.ts'",
|
|
11
|
+
"test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test",
|
|
12
|
+
"test-all-versions": "tav",
|
|
13
|
+
"test-all-versions:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test-all-versions",
|
|
14
|
+
"tdd": "npm run test -- --watch-extensions ts --watch",
|
|
15
|
+
"clean": "rimraf build/*",
|
|
16
|
+
"lint": "eslint . --ext .ts",
|
|
17
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
18
|
+
"precompile": "tsc --version",
|
|
19
|
+
"version:update": "node ../../../scripts/version-update.js",
|
|
20
|
+
"compile": "npm run version:update && tsc -p .",
|
|
21
|
+
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
|
|
22
|
+
"prepare": "npm run compile"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"opentelemetry",
|
|
26
|
+
"ioredis",
|
|
27
|
+
"redis",
|
|
28
|
+
"nodejs",
|
|
29
|
+
"tracing",
|
|
30
|
+
"profiling",
|
|
31
|
+
"instrumentation"
|
|
32
|
+
],
|
|
33
|
+
"author": "OpenTelemetry Authors",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=8.0.0"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"build/src/**/*.js",
|
|
40
|
+
"build/src/**/*.js.map",
|
|
41
|
+
"build/src/**/*.d.ts",
|
|
42
|
+
"doc",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@opentelemetry/api": "^1.0.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@opentelemetry/api": "1.0.2",
|
|
54
|
+
"@opentelemetry/context-async-hooks": "0.25.0",
|
|
55
|
+
"@opentelemetry/contrib-test-utils": "^0.25.0",
|
|
56
|
+
"@opentelemetry/sdk-trace-base": "0.25.0",
|
|
57
|
+
"@opentelemetry/sdk-trace-node": "0.25.0",
|
|
58
|
+
"@types/mocha": "7.0.2",
|
|
59
|
+
"@types/node": "14.17.9",
|
|
60
|
+
"codecov": "3.8.3",
|
|
61
|
+
"cross-env": "7.0.3",
|
|
62
|
+
"gts": "3.1.0",
|
|
63
|
+
"ioredis": "4.27.7",
|
|
64
|
+
"mocha": "7.2.0",
|
|
65
|
+
"nyc": "15.1.0",
|
|
66
|
+
"rimraf": "3.0.2",
|
|
67
|
+
"test-all-versions": "5.0.1",
|
|
68
|
+
"ts-mocha": "8.0.0",
|
|
69
|
+
"typescript": "4.3.5"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@opentelemetry/instrumentation": "^0.25.0",
|
|
73
|
+
"@opentelemetry/semantic-conventions": "^0.25.0",
|
|
74
|
+
"@types/ioredis": "4.26.6"
|
|
75
|
+
},
|
|
76
|
+
"gitHead": "fcfaeb965804d2a081f1dc8d2b82803cd51681af"
|
|
77
|
+
}
|