@opentelemetry/instrumentation-typeorm 0.0.1
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 +80 -0
- package/build/src/index.d.ts +3 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/semconv.d.ts +8 -0
- package/build/src/semconv.js +26 -0
- package/build/src/semconv.js.map +1 -0
- package/build/src/typeorm.d.ts +11 -0
- package/build/src/typeorm.js +336 -0
- package/build/src/typeorm.js.map +1 -0
- package/build/src/types.d.ts +28 -0
- package/build/src/types.js +8 -0
- package/build/src/types.js.map +1 -0
- package/build/src/utils/get-func-param-names.d.ts +2 -0
- package/build/src/utils/get-func-param-names.js +28 -0
- package/build/src/utils/get-func-param-names.js.map +1 -0
- package/build/src/utils/index.d.ts +3 -0
- package/build/src/utils/index.js +34 -0
- package/build/src/utils/index.js.map +1 -0
- package/build/src/utils/suppressTracing.d.ts +4 -0
- package/build/src/utils/suppressTracing.js +25 -0
- package/build/src/utils/suppressTracing.js.map +1 -0
- package/build/src/version.d.ts +3 -0
- package/build/src/version.js +22 -0
- package/build/src/version.js.map +1 -0
- package/package.json +64 -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,80 @@
|
|
|
1
|
+
# OpenTelemetry `typeorm` Instrumentation for Node.js
|
|
2
|
+
|
|
3
|
+
[![NPM Published Version][npm-img]][npm-url]
|
|
4
|
+
[![Apache License][license-image]][license-image]
|
|
5
|
+
|
|
6
|
+
This module provides automatic instrumentation for the [`typeorm`](https://www.npmjs.com/package/typeorm) package, which may be loaded using the [`@opentelemetry/instrumentation`](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation) package.
|
|
7
|
+
|
|
8
|
+
If total installation size is not constrained, it is recommended to use [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience.
|
|
9
|
+
|
|
10
|
+
Compatible with OpenTelemetry JS API `^1.3.0` and SDK `2.0+`.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install --save @opentelemetry/instrumentation-typeorm
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Supported versions
|
|
19
|
+
|
|
20
|
+
- `>=0.3.0 <1`
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
26
|
+
const { TypeormInstrumentation } = require('@opentelemetry/instrumentation-typeorm');
|
|
27
|
+
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
|
|
28
|
+
|
|
29
|
+
const provider = new NodeTracerProvider();
|
|
30
|
+
provider.register();
|
|
31
|
+
|
|
32
|
+
registerInstrumentations({
|
|
33
|
+
instrumentations: [
|
|
34
|
+
new TypeormInstrumentation({
|
|
35
|
+
// see below for available configuration
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Instrumentation Options
|
|
42
|
+
|
|
43
|
+
You can set the following:
|
|
44
|
+
|
|
45
|
+
| Options | Type | Description |
|
|
46
|
+
| ---------------------------- | -------------------------------------- | ------------------------------------------------------------------------------|
|
|
47
|
+
| `responseHook` | `TypeormResponseCustomAttributesFunction` | Hook called before response is returned, which allows to add custom attributes to span. |
|
|
48
|
+
| `suppressInternalInstrumentation` | boolean | Typeorm uses mongodb/postgres/mysql/mariadb/etc. under the hood. If, for example, postgres instrumentation is enabled, a postgres operation will also create a postgres span describing the communication. Setting the `suppressInternalInstrumentation` config value to `true` will cause the instrumentation to suppress instrumentation of underlying operations. |
|
|
49
|
+
| `enableInternalInstrumentation` | boolean | Some methods such as `getManyAndCount` can generate internally multiple spans. To instrument those set this to `true` |
|
|
50
|
+
| `enhancedDatabaseReporting` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) |
|
|
51
|
+
|
|
52
|
+
## Semantic Conventions
|
|
53
|
+
|
|
54
|
+
Attributes collected:
|
|
55
|
+
|
|
56
|
+
| Attribute | Short Description |
|
|
57
|
+
| ---------------------| --------------------------------------------------------------------------- |
|
|
58
|
+
| `db.namespace` | The name of the database being accessed. |
|
|
59
|
+
| `db.operation.name` | The name of the operation being executed (e.g. the SQL keyword). |
|
|
60
|
+
| `db.collection.name` | The name of the table being accessed. |
|
|
61
|
+
| `db.query.text` | The database statement being executed. |
|
|
62
|
+
| `db.system.name` | An identifier for the database management system (DBMS) product being used. |
|
|
63
|
+
| `server.address` | Remote address of the database. |
|
|
64
|
+
| `server.port` | Peer port number of the network connection. |
|
|
65
|
+
|
|
66
|
+
## Useful links
|
|
67
|
+
|
|
68
|
+
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
69
|
+
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
|
70
|
+
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
75
|
+
|
|
76
|
+
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
77
|
+
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
|
|
78
|
+
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
79
|
+
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-typeorm
|
|
80
|
+
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-typeorm.svg
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*
|
|
18
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
31
|
+
*/
|
|
32
|
+
__exportStar(require("./typeorm"), exports);
|
|
33
|
+
__exportStar(require("./types"), exports);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAA0B;AAC1B,0CAAwB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from './typeorm';\nexport * from './types';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ATTR_DB_NAMESPACE: "db.namespace";
|
|
2
|
+
export declare const ATTR_DB_COLLECTION_NAME: "db.collection.name";
|
|
3
|
+
export declare const ATTR_DB_OPERATION_NAME: "db.operation.name";
|
|
4
|
+
export declare const ATTR_DB_QUERY_TEXT: "db.query.text";
|
|
5
|
+
export declare const ATTR_DB_SYSTEM_NAME: "db.system.name";
|
|
6
|
+
export declare const ATTR_SERVER_ADDRESS: "server.address";
|
|
7
|
+
export declare const ATTR_SERVER_PORT: "server.port";
|
|
8
|
+
//# sourceMappingURL=semconv.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
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.ATTR_SERVER_PORT = exports.ATTR_SERVER_ADDRESS = exports.ATTR_DB_SYSTEM_NAME = exports.ATTR_DB_QUERY_TEXT = exports.ATTR_DB_OPERATION_NAME = exports.ATTR_DB_COLLECTION_NAME = exports.ATTR_DB_NAMESPACE = void 0;
|
|
19
|
+
exports.ATTR_DB_NAMESPACE = 'db.namespace';
|
|
20
|
+
exports.ATTR_DB_COLLECTION_NAME = 'db.collection.name';
|
|
21
|
+
exports.ATTR_DB_OPERATION_NAME = 'db.operation.name';
|
|
22
|
+
exports.ATTR_DB_QUERY_TEXT = 'db.query.text';
|
|
23
|
+
exports.ATTR_DB_SYSTEM_NAME = 'db.system.name';
|
|
24
|
+
exports.ATTR_SERVER_ADDRESS = 'server.address';
|
|
25
|
+
exports.ATTR_SERVER_PORT = 'server.port';
|
|
26
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEU,QAAA,iBAAiB,GAAG,cAAuB,CAAC;AAC5C,QAAA,uBAAuB,GAAG,oBAA6B,CAAC;AACxD,QAAA,sBAAsB,GAAG,mBAA4B,CAAC;AACtD,QAAA,kBAAkB,GAAG,eAAwB,CAAC;AAC9C,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAChD,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAChD,QAAA,gBAAgB,GAAG,aAAsB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ATTR_DB_NAMESPACE = 'db.namespace' as const;\nexport const ATTR_DB_COLLECTION_NAME = 'db.collection.name' as const;\nexport const ATTR_DB_OPERATION_NAME = 'db.operation.name' as const;\nexport const ATTR_DB_QUERY_TEXT = 'db.query.text' as const;\nexport const ATTR_DB_SYSTEM_NAME = 'db.system.name' as const;\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypeormInstrumentationConfig } from './types';
|
|
2
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
3
|
+
export declare class TypeormInstrumentation extends InstrumentationBase<TypeormInstrumentationConfig> {
|
|
4
|
+
constructor(config?: TypeormInstrumentationConfig);
|
|
5
|
+
protected init(): InstrumentationNodeModuleDefinition;
|
|
6
|
+
private _patchEntityManagerFunction;
|
|
7
|
+
private _patchQueryBuilder;
|
|
8
|
+
private _patchRawQuery;
|
|
9
|
+
private _endSpan;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=typeorm.d.ts.map
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeormInstrumentation = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const core_1 = require("@opentelemetry/core");
|
|
21
|
+
const semconv_1 = require("./semconv");
|
|
22
|
+
const types_1 = require("./types");
|
|
23
|
+
const utils_1 = require("./utils");
|
|
24
|
+
/** @knipignore */
|
|
25
|
+
const version_1 = require("./version");
|
|
26
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
27
|
+
const util = require("util");
|
|
28
|
+
const selectQueryBuilderExecuteMethods = [
|
|
29
|
+
'getRawOne',
|
|
30
|
+
'getCount',
|
|
31
|
+
'getManyAndCount',
|
|
32
|
+
'stream',
|
|
33
|
+
'getMany',
|
|
34
|
+
'getOneOrFail',
|
|
35
|
+
'getOne',
|
|
36
|
+
'getRawAndEntities',
|
|
37
|
+
'getRawMany',
|
|
38
|
+
];
|
|
39
|
+
const rawQueryFuncName = 'query';
|
|
40
|
+
const functionsUsingEntityPersistExecutor = [
|
|
41
|
+
'save',
|
|
42
|
+
'remove',
|
|
43
|
+
'softRemove',
|
|
44
|
+
'recover',
|
|
45
|
+
];
|
|
46
|
+
const functionsUsingQueryBuilder = [
|
|
47
|
+
'insert',
|
|
48
|
+
'update',
|
|
49
|
+
'delete',
|
|
50
|
+
'softDelete',
|
|
51
|
+
'restore',
|
|
52
|
+
'count',
|
|
53
|
+
'find',
|
|
54
|
+
'findAndCount',
|
|
55
|
+
'findByIds',
|
|
56
|
+
'findOne',
|
|
57
|
+
'increment',
|
|
58
|
+
'decrement',
|
|
59
|
+
];
|
|
60
|
+
const entityManagerMethods = [
|
|
61
|
+
...functionsUsingEntityPersistExecutor,
|
|
62
|
+
...functionsUsingQueryBuilder,
|
|
63
|
+
];
|
|
64
|
+
class TypeormInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
65
|
+
constructor(config = {}) {
|
|
66
|
+
super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config);
|
|
67
|
+
}
|
|
68
|
+
init() {
|
|
69
|
+
const selectQueryBuilder = new instrumentation_1.InstrumentationNodeModuleFile('typeorm/query-builder/SelectQueryBuilder.js', ['>=0.3.0 <1'], moduleExports => {
|
|
70
|
+
selectQueryBuilderExecuteMethods.map(method => {
|
|
71
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.SelectQueryBuilder.prototype?.[method])) {
|
|
72
|
+
this._unwrap(moduleExports.SelectQueryBuilder.prototype, method);
|
|
73
|
+
}
|
|
74
|
+
this._wrap(moduleExports.SelectQueryBuilder.prototype, method, this._patchQueryBuilder());
|
|
75
|
+
});
|
|
76
|
+
return moduleExports;
|
|
77
|
+
}, moduleExports => {
|
|
78
|
+
selectQueryBuilderExecuteMethods.map(method => {
|
|
79
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.SelectQueryBuilder.prototype?.[method])) {
|
|
80
|
+
this._unwrap(moduleExports.SelectQueryBuilder.prototype, method);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return moduleExports;
|
|
84
|
+
});
|
|
85
|
+
const dataSource = new instrumentation_1.InstrumentationNodeModuleFile('typeorm/data-source/DataSource.js', ['>=0.3.0 <1'], moduleExports => {
|
|
86
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.DataSource.prototype?.[rawQueryFuncName])) {
|
|
87
|
+
this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName);
|
|
88
|
+
}
|
|
89
|
+
this._wrap(moduleExports.DataSource.prototype, rawQueryFuncName, this._patchRawQuery());
|
|
90
|
+
return moduleExports;
|
|
91
|
+
}, moduleExports => {
|
|
92
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.DataSource.prototype?.[rawQueryFuncName])) {
|
|
93
|
+
this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName);
|
|
94
|
+
}
|
|
95
|
+
return moduleExports;
|
|
96
|
+
});
|
|
97
|
+
const entityManager = new instrumentation_1.InstrumentationNodeModuleFile('typeorm/entity-manager/EntityManager.js', ['>=0.3.0 <1'], moduleExports => {
|
|
98
|
+
entityManagerMethods.map(method => {
|
|
99
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.EntityManager.prototype?.[method])) {
|
|
100
|
+
this._unwrap(moduleExports.EntityManager.prototype, method);
|
|
101
|
+
}
|
|
102
|
+
this._wrap(moduleExports.EntityManager.prototype, method, this._patchEntityManagerFunction(method));
|
|
103
|
+
});
|
|
104
|
+
return moduleExports;
|
|
105
|
+
}, moduleExports => {
|
|
106
|
+
entityManagerMethods.map(method => {
|
|
107
|
+
if ((0, instrumentation_1.isWrapped)(moduleExports.EntityManager.prototype?.[method])) {
|
|
108
|
+
this._unwrap(moduleExports.EntityManager.prototype, method);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return moduleExports;
|
|
112
|
+
});
|
|
113
|
+
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('typeorm', ['>=0.3.0 <1'], undefined, undefined, [selectQueryBuilder, entityManager, dataSource]);
|
|
114
|
+
return module;
|
|
115
|
+
}
|
|
116
|
+
_patchEntityManagerFunction(opName) {
|
|
117
|
+
const self = this;
|
|
118
|
+
return (original) => {
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
|
+
return function (...args) {
|
|
121
|
+
if ((0, utils_1.isTypeormInternalTracingSuppressed)(api_1.context.active())) {
|
|
122
|
+
return original.apply(this, args);
|
|
123
|
+
}
|
|
124
|
+
const connectionOptions = this?.connection?.options ?? {};
|
|
125
|
+
const attributes = {
|
|
126
|
+
[semconv_1.ATTR_DB_SYSTEM_NAME]: connectionOptions.type,
|
|
127
|
+
[semconv_1.ATTR_SERVER_ADDRESS]: connectionOptions.host,
|
|
128
|
+
[semconv_1.ATTR_SERVER_PORT]: connectionOptions.port,
|
|
129
|
+
[semconv_1.ATTR_DB_NAMESPACE]: connectionOptions.database,
|
|
130
|
+
[semconv_1.ATTR_DB_OPERATION_NAME]: opName,
|
|
131
|
+
[semconv_1.ATTR_DB_QUERY_TEXT]: JSON.stringify(buildStatement(original, args)),
|
|
132
|
+
};
|
|
133
|
+
//ignore EntityMetadataNotFoundError
|
|
134
|
+
try {
|
|
135
|
+
if (this.metadata) {
|
|
136
|
+
attributes[semconv_1.ATTR_DB_COLLECTION_NAME] = this.metadata.tableName;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const entity = args[0];
|
|
140
|
+
const name = typeof entity === 'object' ? entity?.constructor?.name : entity;
|
|
141
|
+
const metadata = this.connection.getMetadata(name);
|
|
142
|
+
if (metadata?.tableName) {
|
|
143
|
+
attributes[semconv_1.ATTR_DB_COLLECTION_NAME] = metadata.tableName;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
/* */
|
|
149
|
+
}
|
|
150
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
151
|
+
if (value === undefined)
|
|
152
|
+
delete attributes[key];
|
|
153
|
+
});
|
|
154
|
+
const span = self.tracer.startSpan(buildSpanName(opName, attributes[semconv_1.ATTR_DB_COLLECTION_NAME]), {
|
|
155
|
+
kind: api_1.SpanKind.CLIENT,
|
|
156
|
+
attributes,
|
|
157
|
+
});
|
|
158
|
+
const contextWithSpan = api_1.trace.setSpan(api_1.context.active(), span);
|
|
159
|
+
const traceContext = self.getConfig().enableInternalInstrumentation
|
|
160
|
+
? contextWithSpan
|
|
161
|
+
: (0, utils_1.suppressTypeormInternalTracing)(contextWithSpan);
|
|
162
|
+
const contextWithSuppressTracing = self.getConfig()
|
|
163
|
+
.suppressInternalInstrumentation
|
|
164
|
+
? (0, core_1.suppressTracing)(traceContext)
|
|
165
|
+
: traceContext;
|
|
166
|
+
return api_1.context.with(contextWithSuppressTracing, () => self._endSpan(() => original.apply(this, args), span));
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
_patchQueryBuilder() {
|
|
171
|
+
const self = this;
|
|
172
|
+
return (original) => {
|
|
173
|
+
return function (...args) {
|
|
174
|
+
if ((0, utils_1.isTypeormInternalTracingSuppressed)(api_1.context.active())) {
|
|
175
|
+
return original.apply(this, args);
|
|
176
|
+
}
|
|
177
|
+
const sql = this.getQuery();
|
|
178
|
+
const parameters = this.getParameters();
|
|
179
|
+
const mainTableName = this.getMainTableName();
|
|
180
|
+
const operation = this.expressionMap.queryType;
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
|
+
const connectionOptions = this.connection?.options;
|
|
183
|
+
const attributes = {
|
|
184
|
+
[semconv_1.ATTR_DB_SYSTEM_NAME]: connectionOptions.type,
|
|
185
|
+
[semconv_1.ATTR_SERVER_ADDRESS]: connectionOptions.host,
|
|
186
|
+
[semconv_1.ATTR_SERVER_PORT]: connectionOptions.port,
|
|
187
|
+
[semconv_1.ATTR_DB_NAMESPACE]: connectionOptions.database,
|
|
188
|
+
[semconv_1.ATTR_DB_OPERATION_NAME]: operation,
|
|
189
|
+
[semconv_1.ATTR_DB_QUERY_TEXT]: sql,
|
|
190
|
+
[semconv_1.ATTR_DB_COLLECTION_NAME]: mainTableName,
|
|
191
|
+
};
|
|
192
|
+
if (self.getConfig().enhancedDatabaseReporting) {
|
|
193
|
+
try {
|
|
194
|
+
attributes[types_1.ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] =
|
|
195
|
+
JSON.stringify(parameters);
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
/* */
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const span = self.tracer.startSpan(buildSpanName(operation, attributes[semconv_1.ATTR_DB_COLLECTION_NAME]), {
|
|
202
|
+
kind: api_1.SpanKind.CLIENT,
|
|
203
|
+
attributes,
|
|
204
|
+
});
|
|
205
|
+
const contextWithSpan = api_1.trace.setSpan(api_1.context.active(), span);
|
|
206
|
+
const traceContext = self.getConfig().enableInternalInstrumentation
|
|
207
|
+
? contextWithSpan
|
|
208
|
+
: (0, utils_1.suppressTypeormInternalTracing)(contextWithSpan);
|
|
209
|
+
const contextWithSuppressTracing = self.getConfig()
|
|
210
|
+
?.suppressInternalInstrumentation
|
|
211
|
+
? (0, core_1.suppressTracing)(traceContext)
|
|
212
|
+
: traceContext;
|
|
213
|
+
return api_1.context.with(contextWithSuppressTracing, () => self._endSpan(() => original.apply(this, args), span));
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
_patchRawQuery() {
|
|
218
|
+
const self = this;
|
|
219
|
+
return (original) => {
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
221
|
+
return function (...args) {
|
|
222
|
+
if ((0, utils_1.isTypeormInternalTracingSuppressed)(api_1.context.active())) {
|
|
223
|
+
return original.apply(this, args);
|
|
224
|
+
}
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
|
+
const sql = args[0];
|
|
227
|
+
const operation = 'raw query';
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
229
|
+
const connectionOptions = this.options;
|
|
230
|
+
const attributes = {
|
|
231
|
+
[semconv_1.ATTR_DB_SYSTEM_NAME]: connectionOptions.type,
|
|
232
|
+
[semconv_1.ATTR_SERVER_ADDRESS]: connectionOptions.host,
|
|
233
|
+
[semconv_1.ATTR_SERVER_PORT]: connectionOptions.port,
|
|
234
|
+
[semconv_1.ATTR_DB_NAMESPACE]: connectionOptions.database,
|
|
235
|
+
[semconv_1.ATTR_DB_OPERATION_NAME]: operation,
|
|
236
|
+
[semconv_1.ATTR_DB_QUERY_TEXT]: sql,
|
|
237
|
+
};
|
|
238
|
+
const span = self.tracer.startSpan(operation, {
|
|
239
|
+
kind: api_1.SpanKind.CLIENT,
|
|
240
|
+
attributes,
|
|
241
|
+
});
|
|
242
|
+
const contextWithSpan = api_1.trace.setSpan(api_1.context.active(), span);
|
|
243
|
+
const traceContext = self.getConfig().enableInternalInstrumentation
|
|
244
|
+
? contextWithSpan
|
|
245
|
+
: (0, utils_1.suppressTypeormInternalTracing)(contextWithSpan);
|
|
246
|
+
const contextWithSuppressTracing = self.getConfig()
|
|
247
|
+
?.suppressInternalInstrumentation
|
|
248
|
+
? (0, core_1.suppressTracing)(traceContext)
|
|
249
|
+
: traceContext;
|
|
250
|
+
return api_1.context.with(contextWithSuppressTracing, () => self._endSpan(() => original.apply(this, args), span));
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
+
_endSpan(traced, span) {
|
|
256
|
+
const executeResponseHook = (response) => {
|
|
257
|
+
const hook = this.getConfig().responseHook;
|
|
258
|
+
if (hook !== undefined) {
|
|
259
|
+
(0, instrumentation_1.safeExecuteInTheMiddle)(() => hook(span, { response }), e => {
|
|
260
|
+
if (e)
|
|
261
|
+
this._diag.error('responseHook error', e);
|
|
262
|
+
}, true);
|
|
263
|
+
}
|
|
264
|
+
return response;
|
|
265
|
+
};
|
|
266
|
+
try {
|
|
267
|
+
const response = traced();
|
|
268
|
+
if (util.types.isPromise(response)) {
|
|
269
|
+
return Promise.resolve(response)
|
|
270
|
+
.then(response => executeResponseHook(response))
|
|
271
|
+
.catch(err => {
|
|
272
|
+
if (err) {
|
|
273
|
+
if (typeof err === 'string') {
|
|
274
|
+
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: err });
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
span.recordException(err);
|
|
278
|
+
span.setStatus({
|
|
279
|
+
code: api_1.SpanStatusCode.ERROR,
|
|
280
|
+
message: err?.message,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
throw err;
|
|
285
|
+
})
|
|
286
|
+
.finally(() => span.end());
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
span.end();
|
|
290
|
+
return executeResponseHook(response);
|
|
291
|
+
}
|
|
292
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
span.recordException(error);
|
|
296
|
+
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: error?.message });
|
|
297
|
+
span.end();
|
|
298
|
+
throw error;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.TypeormInstrumentation = TypeormInstrumentation;
|
|
303
|
+
const buildStatement = (func, args) => {
|
|
304
|
+
const paramNames = (0, utils_1.getParamNames)(func) || [];
|
|
305
|
+
const statement = {};
|
|
306
|
+
paramNames.forEach((pName, i) => {
|
|
307
|
+
const value = args[i];
|
|
308
|
+
if (!value)
|
|
309
|
+
return;
|
|
310
|
+
try {
|
|
311
|
+
const stringified = JSON.stringify(value);
|
|
312
|
+
if (stringified) {
|
|
313
|
+
statement[pName] = args[i];
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch (_err) {
|
|
318
|
+
/* */
|
|
319
|
+
}
|
|
320
|
+
if (value?.name) {
|
|
321
|
+
statement[pName] = value.name;
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (value?.constructor?.name) {
|
|
325
|
+
statement[pName] = value.constructor.name;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
return statement;
|
|
329
|
+
};
|
|
330
|
+
function buildSpanName(operation, target) {
|
|
331
|
+
if (target !== undefined) {
|
|
332
|
+
return `${operation} ${target}`;
|
|
333
|
+
}
|
|
334
|
+
return operation;
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=typeorm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm.js","sourceRoot":"","sources":["../../src/typeorm.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAM4B;AAC5B,8CAAsD;AACtD,uCAQmB;AACnB,mCAGiB;AACjB,mCAIiB;AACjB,kBAAkB;AAClB,uCAA0D;AAE1D,oEAMwC;AACxC,6BAA6B;AAI7B,MAAM,gCAAgC,GAA+B;IACnE,WAAW;IACX,UAAU;IACV,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,cAAc;IACd,QAAQ;IACR,mBAAmB;IACnB,YAAY;CACb,CAAC;AACF,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC,MAAM,mCAAmC,GAA2B;IAClE,MAAM;IACN,QAAQ;IACR,YAAY;IACZ,SAAS;CACV,CAAC;AACF,MAAM,0BAA0B,GAA2B;IACzD,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,OAAO;IACP,MAAM;IACN,cAAc;IACd,WAAW;IACX,SAAS;IACT,WAAW;IACX,WAAW;CACZ,CAAC;AACF,MAAM,oBAAoB,GAA2B;IACnD,GAAG,mCAAmC;IACtC,GAAG,0BAA0B;CAC9B,CAAC;AAEF,MAAa,sBAAuB,SAAQ,qCAAiD;IAC3F,YAAY,SAAuC,EAAE;QACnD,KAAK,CAAC,sBAAY,EAAE,yBAAe,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAES,IAAI;QACZ,MAAM,kBAAkB,GAAG,IAAI,+CAA6B,CAC1D,6CAA6C,EAC7C,CAAC,YAAY,CAAC,EACd,aAAa,CAAC,EAAE;YACd,gCAAgC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBAC5C,IAAI,IAAA,2BAAS,EAAC,aAAa,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC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C;KACjC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Span,\n SpanKind,\n SpanStatusCode,\n trace,\n context,\n} from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n ATTR_DB_COLLECTION_NAME,\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from './semconv';\nimport {\n ExtendedDatabaseAttribute,\n TypeormInstrumentationConfig,\n} from './types';\nimport {\n getParamNames,\n isTypeormInternalTracingSuppressed,\n suppressTypeormInternalTracing,\n} from './utils';\n/** @knipignore */\nimport { PACKAGE_NAME, PACKAGE_VERSION } from './version';\nimport type * as typeorm from 'typeorm';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n isWrapped,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport * as util from 'util';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SelectQueryBuilderMethod = keyof typeorm.SelectQueryBuilder<any>;\nconst selectQueryBuilderExecuteMethods: SelectQueryBuilderMethod[] = [\n 'getRawOne',\n 'getCount',\n 'getManyAndCount',\n 'stream',\n 'getMany',\n 'getOneOrFail',\n 'getOne',\n 'getRawAndEntities',\n 'getRawMany',\n];\nconst rawQueryFuncName = 'query';\ntype EntityManagerMethods = keyof typeorm.EntityManager;\nconst functionsUsingEntityPersistExecutor: EntityManagerMethods[] = [\n 'save',\n 'remove',\n 'softRemove',\n 'recover',\n];\nconst functionsUsingQueryBuilder: EntityManagerMethods[] = [\n 'insert',\n 'update',\n 'delete',\n 'softDelete',\n 'restore',\n 'count',\n 'find',\n 'findAndCount',\n 'findByIds',\n 'findOne',\n 'increment',\n 'decrement',\n];\nconst entityManagerMethods: EntityManagerMethods[] = [\n ...functionsUsingEntityPersistExecutor,\n ...functionsUsingQueryBuilder,\n];\n\nexport class TypeormInstrumentation extends InstrumentationBase<TypeormInstrumentationConfig> {\n constructor(config: TypeormInstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n }\n\n protected init() {\n const selectQueryBuilder = new InstrumentationNodeModuleFile(\n 'typeorm/query-builder/SelectQueryBuilder.js',\n ['>=0.3.0 <1'],\n moduleExports => {\n selectQueryBuilderExecuteMethods.map(method => {\n if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) {\n this._unwrap(moduleExports.SelectQueryBuilder.prototype, method);\n }\n this._wrap(\n moduleExports.SelectQueryBuilder.prototype,\n method,\n this._patchQueryBuilder()\n );\n });\n\n return moduleExports;\n },\n moduleExports => {\n selectQueryBuilderExecuteMethods.map(method => {\n if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) {\n this._unwrap(moduleExports.SelectQueryBuilder.prototype, method);\n }\n });\n return moduleExports;\n }\n );\n\n const dataSource = new InstrumentationNodeModuleFile(\n 'typeorm/data-source/DataSource.js',\n ['>=0.3.0 <1'],\n moduleExports => {\n if (isWrapped(moduleExports.DataSource.prototype?.[rawQueryFuncName])) {\n this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName);\n }\n this._wrap(\n moduleExports.DataSource.prototype,\n rawQueryFuncName,\n this._patchRawQuery()\n );\n\n return moduleExports;\n },\n moduleExports => {\n if (isWrapped(moduleExports.DataSource.prototype?.[rawQueryFuncName])) {\n this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName);\n }\n return moduleExports;\n }\n );\n\n const entityManager = new InstrumentationNodeModuleFile(\n 'typeorm/entity-manager/EntityManager.js',\n ['>=0.3.0 <1'],\n moduleExports => {\n entityManagerMethods.map(method => {\n if (isWrapped(moduleExports.EntityManager.prototype?.[method])) {\n this._unwrap(moduleExports.EntityManager.prototype, method);\n }\n this._wrap(\n moduleExports.EntityManager.prototype,\n method,\n this._patchEntityManagerFunction(method)\n );\n });\n\n return moduleExports;\n },\n moduleExports => {\n entityManagerMethods.map(method => {\n if (isWrapped(moduleExports.EntityManager.prototype?.[method])) {\n this._unwrap(moduleExports.EntityManager.prototype, method);\n }\n });\n return moduleExports;\n }\n );\n\n const module = new InstrumentationNodeModuleDefinition(\n 'typeorm',\n ['>=0.3.0 <1'],\n undefined,\n undefined,\n [selectQueryBuilder, entityManager, dataSource]\n );\n return module;\n }\n\n private _patchEntityManagerFunction(opName: string) {\n const self = this;\n return (original: Function) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: any, ...args: unknown[]) {\n if (isTypeormInternalTracingSuppressed(context.active())) {\n return original.apply(this, args);\n }\n const connectionOptions = this?.connection?.options ?? {};\n const attributes: Record<string, any> = {\n [ATTR_DB_SYSTEM_NAME]: connectionOptions.type,\n [ATTR_SERVER_ADDRESS]: connectionOptions.host,\n [ATTR_SERVER_PORT]: connectionOptions.port,\n [ATTR_DB_NAMESPACE]: connectionOptions.database,\n [ATTR_DB_OPERATION_NAME]: opName,\n [ATTR_DB_QUERY_TEXT]: JSON.stringify(buildStatement(original, args)),\n };\n\n //ignore EntityMetadataNotFoundError\n try {\n if (this.metadata) {\n attributes[ATTR_DB_COLLECTION_NAME] = this.metadata.tableName;\n } else {\n const entity = args[0];\n const name =\n typeof entity === 'object' ? entity?.constructor?.name : entity;\n const metadata = this.connection.getMetadata(name);\n if (metadata?.tableName) {\n attributes[ATTR_DB_COLLECTION_NAME] = metadata.tableName;\n }\n }\n } catch {\n /* */\n }\n\n Object.entries(attributes).forEach(([key, value]) => {\n if (value === undefined) delete attributes[key];\n });\n\n const span: Span = self.tracer.startSpan(\n buildSpanName(opName, attributes[ATTR_DB_COLLECTION_NAME]),\n {\n kind: SpanKind.CLIENT,\n attributes,\n }\n );\n\n const contextWithSpan = trace.setSpan(context.active(), span);\n\n const traceContext = self.getConfig().enableInternalInstrumentation\n ? contextWithSpan\n : suppressTypeormInternalTracing(contextWithSpan);\n\n const contextWithSuppressTracing = self.getConfig()\n .suppressInternalInstrumentation\n ? suppressTracing(traceContext)\n : traceContext;\n\n return context.with(contextWithSuppressTracing, () =>\n self._endSpan(() => original.apply(this, args), span)\n );\n };\n };\n }\n\n private _patchQueryBuilder() {\n const self = this;\n return (original: Function) => {\n return function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: typeorm.SelectQueryBuilder<any>,\n ...args: unknown[]\n ) {\n if (isTypeormInternalTracingSuppressed(context.active())) {\n return original.apply(this, args);\n }\n const sql = this.getQuery();\n const parameters = this.getParameters();\n const mainTableName = this.getMainTableName();\n const operation = this.expressionMap.queryType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const connectionOptions: any = this.connection?.options;\n const attributes: Record<string, any> = {\n [ATTR_DB_SYSTEM_NAME]: connectionOptions.type,\n [ATTR_SERVER_ADDRESS]: connectionOptions.host,\n [ATTR_SERVER_PORT]: connectionOptions.port,\n [ATTR_DB_NAMESPACE]: connectionOptions.database,\n [ATTR_DB_OPERATION_NAME]: operation,\n [ATTR_DB_QUERY_TEXT]: sql,\n [ATTR_DB_COLLECTION_NAME]: mainTableName,\n };\n if (self.getConfig().enhancedDatabaseReporting) {\n try {\n attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] =\n JSON.stringify(parameters);\n } catch (err) {\n /* */\n }\n }\n const span: Span = self.tracer.startSpan(\n buildSpanName(operation, attributes[ATTR_DB_COLLECTION_NAME]),\n {\n kind: SpanKind.CLIENT,\n attributes,\n }\n );\n\n const contextWithSpan = trace.setSpan(context.active(), span);\n\n const traceContext = self.getConfig().enableInternalInstrumentation\n ? contextWithSpan\n : suppressTypeormInternalTracing(contextWithSpan);\n\n const contextWithSuppressTracing = self.getConfig()\n ?.suppressInternalInstrumentation\n ? suppressTracing(traceContext)\n : traceContext;\n\n return context.with(contextWithSuppressTracing, () =>\n self._endSpan(() => original.apply(this, args), span)\n );\n };\n };\n }\n\n private _patchRawQuery() {\n const self = this;\n return (original: Function) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: any, ...args: unknown[]) {\n if (isTypeormInternalTracingSuppressed(context.active())) {\n return original.apply(this, args);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sql = args[0] as any;\n const operation = 'raw query';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const connectionOptions: any = this.options;\n const attributes = {\n [ATTR_DB_SYSTEM_NAME]: connectionOptions.type,\n [ATTR_SERVER_ADDRESS]: connectionOptions.host,\n [ATTR_SERVER_PORT]: connectionOptions.port,\n [ATTR_DB_NAMESPACE]: connectionOptions.database,\n [ATTR_DB_OPERATION_NAME]: operation,\n [ATTR_DB_QUERY_TEXT]: sql,\n };\n\n const span: Span = self.tracer.startSpan(operation, {\n kind: SpanKind.CLIENT,\n attributes,\n });\n\n const contextWithSpan = trace.setSpan(context.active(), span);\n\n const traceContext = self.getConfig().enableInternalInstrumentation\n ? contextWithSpan\n : suppressTypeormInternalTracing(contextWithSpan);\n\n const contextWithSuppressTracing = self.getConfig()\n ?.suppressInternalInstrumentation\n ? suppressTracing(traceContext)\n : traceContext;\n\n return context.with(contextWithSuppressTracing, () =>\n self._endSpan(() => original.apply(this, args), span)\n );\n };\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _endSpan(traced: any, span: Span) {\n const executeResponseHook = (response: unknown) => {\n const hook = this.getConfig().responseHook;\n if (hook !== undefined) {\n safeExecuteInTheMiddle(\n () => hook(span, { response }),\n e => {\n if (e) this._diag.error('responseHook error', e);\n },\n true\n );\n }\n return response;\n };\n try {\n const response = traced();\n if (util.types.isPromise(response)) {\n return Promise.resolve(response)\n .then(response => executeResponseHook(response))\n .catch(err => {\n if (err) {\n if (typeof err === 'string') {\n span.setStatus({ code: SpanStatusCode.ERROR, message: err });\n } else {\n span.recordException(err);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n }\n }\n throw err;\n })\n .finally(() => span.end());\n } else {\n span.end();\n return executeResponseHook(response);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n span.recordException(error);\n span.setStatus({ code: SpanStatusCode.ERROR, message: error?.message });\n span.end();\n throw error;\n }\n }\n}\n\nconst buildStatement = (func: Function, args: any[]) => {\n const paramNames = getParamNames(func) || [];\n const statement: Record<string, any> = {};\n paramNames.forEach((pName, i) => {\n const value = args[i];\n if (!value) return;\n\n try {\n const stringified = JSON.stringify(value);\n if (stringified) {\n statement[pName] = args[i];\n return;\n }\n } catch (_err) {\n /* */\n }\n if (value?.name) {\n statement[pName] = value.name;\n return;\n }\n if (value?.constructor?.name) {\n statement[pName] = value.constructor.name;\n }\n });\n return statement;\n};\n\nfunction buildSpanName(operation: string, target: string | undefined): string {\n if (target !== undefined) {\n return `${operation} ${target}`;\n }\n\n return operation;\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
export declare enum ExtendedDatabaseAttribute {
|
|
4
|
+
DB_STATEMENT_PARAMETERS = "db.typeorm.parameters"
|
|
5
|
+
}
|
|
6
|
+
export interface HookInfo {
|
|
7
|
+
response: any;
|
|
8
|
+
}
|
|
9
|
+
export type TypeormResponseCustomAttributesFunction = (span: Span, info: HookInfo) => void;
|
|
10
|
+
export interface TypeormInstrumentationConfig extends InstrumentationConfig {
|
|
11
|
+
/** hook for adding custom attributes using the response payload */
|
|
12
|
+
responseHook?: TypeormResponseCustomAttributesFunction;
|
|
13
|
+
/**
|
|
14
|
+
* Typeorm operation use mongodb/postgres/mysql/mariadb/etc. under the hood.
|
|
15
|
+
* If, for example, postgres instrumentation is enabled, a postgres operation will also create
|
|
16
|
+
* a postgres span describing the communication.
|
|
17
|
+
* Setting the `suppressInternalInstrumentation` config value to `true` will
|
|
18
|
+
* cause the instrumentation to suppress instrumentation of underlying operations.
|
|
19
|
+
*/
|
|
20
|
+
suppressInternalInstrumentation?: boolean;
|
|
21
|
+
/** Some methods such as `getManyAndCount` can generate internally multiple spans.
|
|
22
|
+
* To instrument those set this to `true`
|
|
23
|
+
*/
|
|
24
|
+
enableInternalInstrumentation?: boolean;
|
|
25
|
+
/** set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) */
|
|
26
|
+
enhancedDatabaseReporting?: boolean;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtendedDatabaseAttribute = void 0;
|
|
4
|
+
var ExtendedDatabaseAttribute;
|
|
5
|
+
(function (ExtendedDatabaseAttribute) {
|
|
6
|
+
ExtendedDatabaseAttribute["DB_STATEMENT_PARAMETERS"] = "db.typeorm.parameters";
|
|
7
|
+
})(ExtendedDatabaseAttribute = exports.ExtendedDatabaseAttribute || (exports.ExtendedDatabaseAttribute = {}));
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAkBA,IAAY,yBAEX;AAFD,WAAY,yBAAyB;IACnC,8EAAiD,CAAA;AACnD,CAAC,EAFW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAEpC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { Span } from '@opentelemetry/api';\nimport { InstrumentationConfig } from '@opentelemetry/instrumentation';\n\nexport enum ExtendedDatabaseAttribute {\n DB_STATEMENT_PARAMETERS = 'db.typeorm.parameters',\n}\n\nexport interface HookInfo {\n response: any;\n}\n\nexport type TypeormResponseCustomAttributesFunction = (\n span: Span,\n info: HookInfo\n) => void;\n\nexport interface TypeormInstrumentationConfig extends InstrumentationConfig {\n /** hook for adding custom attributes using the response payload */\n responseHook?: TypeormResponseCustomAttributesFunction;\n /**\n * Typeorm operation use mongodb/postgres/mysql/mariadb/etc. under the hood.\n * If, for example, postgres instrumentation is enabled, a postgres operation will also create\n * a postgres span describing the communication.\n * Setting the `suppressInternalInstrumentation` config value to `true` will\n * cause the instrumentation to suppress instrumentation of underlying operations.\n */\n suppressInternalInstrumentation?: boolean;\n /** Some methods such as `getManyAndCount` can generate internally multiple spans.\n * To instrument those set this to `true`\n */\n enableInternalInstrumentation?: boolean;\n /** set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) */\n enhancedDatabaseReporting?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParamNames = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;
|
|
20
|
+
const ARGUMENT_NAMES = /([^\s,]+)/g;
|
|
21
|
+
function getParamNames(func) {
|
|
22
|
+
const fnStr = func.toString().replace(STRIP_COMMENTS, '');
|
|
23
|
+
return fnStr
|
|
24
|
+
.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'))
|
|
25
|
+
.match(ARGUMENT_NAMES);
|
|
26
|
+
}
|
|
27
|
+
exports.getParamNames = getParamNames;
|
|
28
|
+
//# sourceMappingURL=get-func-param-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-func-param-names.js","sourceRoot":"","sources":["../../../src/utils/get-func-param-names.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,SAAgB,aAAa,CAAC,IAAc;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAC1D,OAAO,KAAK;SACT,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACjD,KAAK,CAAC,cAAc,CAAC,CAAC;AAC3B,CAAC;AALD,sCAKC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/gm;\nconst ARGUMENT_NAMES = /([^\\s,]+)/g;\n\nexport function getParamNames(func: Function) {\n const fnStr = func.toString().replace(STRIP_COMMENTS, '');\n return fnStr\n .slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'))\n .match(ARGUMENT_NAMES);\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*
|
|
18
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
31
|
+
*/
|
|
32
|
+
__exportStar(require("./get-func-param-names"), exports);
|
|
33
|
+
__exportStar(require("./suppressTracing"), exports);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yDAAuC;AACvC,oDAAkC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from './get-func-param-names';\nexport * from './suppressTracing';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTypeormInternalTracingSuppressed = exports.suppressTypeormInternalTracing = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors, Aspecto
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY = (0, api_1.createContextKey)('instrumentation-typeorm Context Key SUPPRESS_TYPEORM_INTERNAL_TRACING');
|
|
21
|
+
const suppressTypeormInternalTracing = (context) => context.setValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY, true);
|
|
22
|
+
exports.suppressTypeormInternalTracing = suppressTypeormInternalTracing;
|
|
23
|
+
const isTypeormInternalTracingSuppressed = (context) => context.getValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY) === true;
|
|
24
|
+
exports.isTypeormInternalTracingSuppressed = isTypeormInternalTracingSuppressed;
|
|
25
|
+
//# sourceMappingURL=suppressTracing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressTracing.js","sourceRoot":"","sources":["../../../src/utils/suppressTracing.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAA+D;AAE/D,MAAM,qCAAqC,GAAG,IAAA,sBAAgB,EAC5D,uEAAuE,CACxE,CAAC;AAEK,MAAM,8BAA8B,GAAG,CAAC,OAAgB,EAAE,EAAE,CACjE,OAAO,CAAC,QAAQ,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;AADnD,QAAA,8BAA8B,kCACqB;AAEzD,MAAM,kCAAkC,GAAG,CAAC,OAAgB,EAAE,EAAE,CACrE,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,KAAK,IAAI,CAAC;AADtD,QAAA,kCAAkC,sCACoB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createContextKey, Context } from '@opentelemetry/api';\n\nconst SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY = createContextKey(\n 'instrumentation-typeorm Context Key SUPPRESS_TYPEORM_INTERNAL_TRACING'\n);\n\nexport const suppressTypeormInternalTracing = (context: Context) =>\n context.setValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY, true);\n\nexport const isTypeormInternalTracingSuppressed = (context: Context) =>\n context.getValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY) === true;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
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.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
|
|
19
|
+
// this is autogenerated file, see scripts/version-update.js
|
|
20
|
+
exports.PACKAGE_VERSION = '0.0.1';
|
|
21
|
+
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-typeorm';
|
|
22
|
+
//# 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,eAAe,GAAG,OAAO,CAAC;AAC1B,QAAA,YAAY,GAAG,wCAAwC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const PACKAGE_VERSION = '0.0.1';\nexport const PACKAGE_NAME = '@opentelemetry/instrumentation-typeorm';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentelemetry/instrumentation-typeorm",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "OpenTelemetry instrumentation for `typeorm` database data-mapper ORM",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"types": "build/src/index.d.ts",
|
|
7
|
+
"repository": "open-telemetry/opentelemetry-js-contrib",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"clean": "rimraf build/*",
|
|
10
|
+
"compile": "tsc -p .",
|
|
11
|
+
"lint": "eslint . --ext .ts",
|
|
12
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
13
|
+
"lint:readme": "node ../../../scripts/lint-readme.js",
|
|
14
|
+
"prewatch": "npm run precompile",
|
|
15
|
+
"prepublishOnly": "npm run compile",
|
|
16
|
+
"tdd": "npm run test -- --watch-extensions ts --watch",
|
|
17
|
+
"test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
|
|
18
|
+
"test-all-versions": "tav",
|
|
19
|
+
"test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
|
|
20
|
+
"version:update": "node ../../../scripts/version-update.js",
|
|
21
|
+
"watch": "tsc -w"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"typeorm",
|
|
25
|
+
"instrumentation",
|
|
26
|
+
"nodejs",
|
|
27
|
+
"opentelemetry",
|
|
28
|
+
"tracing"
|
|
29
|
+
],
|
|
30
|
+
"author": "OpenTelemetry Authors",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": "^18.19.0 || >=20.6.0"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"build/src/**/*.js",
|
|
37
|
+
"build/src/**/*.js.map",
|
|
38
|
+
"build/src/**/*.d.ts"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@opentelemetry/api": "^1.3.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@opentelemetry/api": "^1.3.0",
|
|
48
|
+
"@opentelemetry/contrib-test-utils": "^0.46.0",
|
|
49
|
+
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
50
|
+
"@types/mocha": "10.0.10",
|
|
51
|
+
"@types/node": "18.18.14",
|
|
52
|
+
"nyc": "15.1.0",
|
|
53
|
+
"rimraf": "5.0.10",
|
|
54
|
+
"sqlite3": "^5.0.2",
|
|
55
|
+
"typeorm": "^0.3.21",
|
|
56
|
+
"typescript": "5.0.4"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@opentelemetry/core": "^2.0.0",
|
|
60
|
+
"@opentelemetry/instrumentation": "^0.200.0"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme",
|
|
63
|
+
"gitHead": "f07dcceccc3441bfc7921b4b1d09413490a7f6cd"
|
|
64
|
+
}
|