@prisma/instrumentation 7.2.0 → 7.3.0-integration-prisma6-fix-cloudflare-engine.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/README.md +11 -0
- package/dist/index.js +18 -79
- package/dist/index.mjs +18 -79
- package/dist/src/ActiveTracingHelper.d.ts +1 -1
- package/dist/src/constants.d.ts +2 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
[OTEL - OpenTelemetry](https://opentelemetry.io/) compliant instrumentation for Prisma Client.
|
|
6
6
|
|
|
7
|
+
⚠️ **Warning**: This package is provided as part of the `tracing` Preview Feature
|
|
8
|
+
Its release cycle does not follow SemVer, which means we might release breaking changes (change APIs, remove functionality) without any prior warning.
|
|
9
|
+
|
|
7
10
|
## Installing
|
|
8
11
|
|
|
9
12
|
```
|
|
@@ -21,6 +24,14 @@ registerInstrumentations({
|
|
|
21
24
|
})
|
|
22
25
|
```
|
|
23
26
|
|
|
27
|
+
Don't forget to set `previewFeatures`:
|
|
28
|
+
|
|
29
|
+
```prisma
|
|
30
|
+
generator client {
|
|
31
|
+
provider = "prisma-client-js"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
24
35
|
## Jaeger
|
|
25
36
|
|
|
26
37
|
Exporting traces to [Jaeger Tracing](https://jaegertracing.io).
|
package/dist/index.js
CHANGED
|
@@ -29,73 +29,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
29
29
|
var import_api2 = require("@opentelemetry/api");
|
|
30
30
|
var import_instrumentation = require("@opentelemetry/instrumentation");
|
|
31
31
|
|
|
32
|
-
// ../instrumentation-contract/dist/index.mjs
|
|
33
|
-
var package_default = {
|
|
34
|
-
name: "@prisma/instrumentation-contract",
|
|
35
|
-
version: "7.2.0",
|
|
36
|
-
description: "Shared types and utilities for Prisma instrumentation",
|
|
37
|
-
main: "dist/index.js",
|
|
38
|
-
module: "dist/index.mjs",
|
|
39
|
-
types: "dist/index.d.ts",
|
|
40
|
-
exports: {
|
|
41
|
-
".": {
|
|
42
|
-
require: {
|
|
43
|
-
types: "./dist/index.d.ts",
|
|
44
|
-
default: "./dist/index.js"
|
|
45
|
-
},
|
|
46
|
-
import: {
|
|
47
|
-
types: "./dist/index.d.mts",
|
|
48
|
-
default: "./dist/index.mjs"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
license: "Apache-2.0",
|
|
53
|
-
homepage: "https://www.prisma.io",
|
|
54
|
-
repository: {
|
|
55
|
-
type: "git",
|
|
56
|
-
url: "https://github.com/prisma/prisma.git",
|
|
57
|
-
directory: "packages/instrumentation-contract"
|
|
58
|
-
},
|
|
59
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
60
|
-
scripts: {
|
|
61
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
62
|
-
build: "tsx helpers/build.ts",
|
|
63
|
-
prepublishOnly: "pnpm run build",
|
|
64
|
-
test: "vitest run"
|
|
65
|
-
},
|
|
66
|
-
files: [
|
|
67
|
-
"dist"
|
|
68
|
-
],
|
|
69
|
-
sideEffects: false,
|
|
70
|
-
devDependencies: {
|
|
71
|
-
"@opentelemetry/api": "1.9.0"
|
|
72
|
-
},
|
|
73
|
-
peerDependencies: {
|
|
74
|
-
"@opentelemetry/api": "^1.8"
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var majorVersion = package_default.version.split(".")[0];
|
|
78
|
-
var GLOBAL_INSTRUMENTATION_KEY = "PRISMA_INSTRUMENTATION";
|
|
79
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
80
|
-
var globalThisWithPrismaInstrumentation = globalThis;
|
|
81
|
-
function getGlobalTracingHelper() {
|
|
82
|
-
const versionedGlobal = globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
|
|
83
|
-
if (versionedGlobal?.helper) {
|
|
84
|
-
return versionedGlobal.helper;
|
|
85
|
-
}
|
|
86
|
-
const fallbackGlobal = globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
|
|
87
|
-
return fallbackGlobal?.helper;
|
|
88
|
-
}
|
|
89
|
-
function setGlobalTracingHelper(helper) {
|
|
90
|
-
const globalValue = { helper };
|
|
91
|
-
globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY] = globalValue;
|
|
92
|
-
globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY] = globalValue;
|
|
93
|
-
}
|
|
94
|
-
function clearGlobalTracingHelper() {
|
|
95
|
-
delete globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
|
|
96
|
-
delete globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
32
|
// src/ActiveTracingHelper.ts
|
|
100
33
|
var import_api = require("@opentelemetry/api");
|
|
101
34
|
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
@@ -216,9 +149,9 @@ function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
|
216
149
|
}
|
|
217
150
|
|
|
218
151
|
// package.json
|
|
219
|
-
var
|
|
152
|
+
var package_default = {
|
|
220
153
|
name: "@prisma/instrumentation",
|
|
221
|
-
version: "7.
|
|
154
|
+
version: "7.3.0-integration-prisma6-fix-cloudflare-engine.1",
|
|
222
155
|
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
223
156
|
main: "dist/index.js",
|
|
224
157
|
module: "dist/index.mjs",
|
|
@@ -244,13 +177,13 @@ var package_default2 = {
|
|
|
244
177
|
},
|
|
245
178
|
bugs: "https://github.com/prisma/prisma/issues",
|
|
246
179
|
devDependencies: {
|
|
180
|
+
"@prisma/internals": "workspace:*",
|
|
181
|
+
"@types/node": "18.19.76",
|
|
247
182
|
"@opentelemetry/api": "1.9.0",
|
|
248
|
-
"@prisma/instrumentation-contract": "workspace:*",
|
|
249
|
-
"@types/node": "~20.19.24",
|
|
250
183
|
typescript: "5.4.5"
|
|
251
184
|
},
|
|
252
185
|
dependencies: {
|
|
253
|
-
"@opentelemetry/instrumentation": "
|
|
186
|
+
"@opentelemetry/instrumentation": ">=0.52.0 <1"
|
|
254
187
|
},
|
|
255
188
|
peerDependencies: {
|
|
256
189
|
"@opentelemetry/api": "^1.8"
|
|
@@ -274,8 +207,11 @@ var package_default2 = {
|
|
|
274
207
|
};
|
|
275
208
|
|
|
276
209
|
// src/constants.ts
|
|
277
|
-
var VERSION =
|
|
278
|
-
var
|
|
210
|
+
var VERSION = package_default.version;
|
|
211
|
+
var majorVersion = VERSION.split(".")[0];
|
|
212
|
+
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
213
|
+
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
214
|
+
var NAME = package_default.name;
|
|
279
215
|
var MODULE_NAME = "@prisma/client";
|
|
280
216
|
|
|
281
217
|
// src/PrismaInstrumentation.ts
|
|
@@ -293,18 +229,21 @@ var PrismaInstrumentation = class extends import_instrumentation.Instrumentation
|
|
|
293
229
|
}
|
|
294
230
|
enable() {
|
|
295
231
|
const config = this._config;
|
|
296
|
-
|
|
297
|
-
new ActiveTracingHelper({
|
|
232
|
+
const globalValue = {
|
|
233
|
+
helper: new ActiveTracingHelper({
|
|
298
234
|
tracerProvider: this.tracerProvider ?? import_api2.trace.getTracerProvider(),
|
|
299
235
|
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
300
236
|
})
|
|
301
|
-
|
|
237
|
+
};
|
|
238
|
+
global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
239
|
+
global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
302
240
|
}
|
|
303
241
|
disable() {
|
|
304
|
-
|
|
242
|
+
delete global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY];
|
|
243
|
+
delete global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY];
|
|
305
244
|
}
|
|
306
245
|
isEnabled() {
|
|
307
|
-
return
|
|
246
|
+
return Boolean(global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY]);
|
|
308
247
|
}
|
|
309
248
|
};
|
|
310
249
|
|
package/dist/index.mjs
CHANGED
|
@@ -5,73 +5,6 @@ import {
|
|
|
5
5
|
InstrumentationNodeModuleDefinition
|
|
6
6
|
} from "@opentelemetry/instrumentation";
|
|
7
7
|
|
|
8
|
-
// ../instrumentation-contract/dist/index.mjs
|
|
9
|
-
var package_default = {
|
|
10
|
-
name: "@prisma/instrumentation-contract",
|
|
11
|
-
version: "7.2.0",
|
|
12
|
-
description: "Shared types and utilities for Prisma instrumentation",
|
|
13
|
-
main: "dist/index.js",
|
|
14
|
-
module: "dist/index.mjs",
|
|
15
|
-
types: "dist/index.d.ts",
|
|
16
|
-
exports: {
|
|
17
|
-
".": {
|
|
18
|
-
require: {
|
|
19
|
-
types: "./dist/index.d.ts",
|
|
20
|
-
default: "./dist/index.js"
|
|
21
|
-
},
|
|
22
|
-
import: {
|
|
23
|
-
types: "./dist/index.d.mts",
|
|
24
|
-
default: "./dist/index.mjs"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
license: "Apache-2.0",
|
|
29
|
-
homepage: "https://www.prisma.io",
|
|
30
|
-
repository: {
|
|
31
|
-
type: "git",
|
|
32
|
-
url: "https://github.com/prisma/prisma.git",
|
|
33
|
-
directory: "packages/instrumentation-contract"
|
|
34
|
-
},
|
|
35
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
36
|
-
scripts: {
|
|
37
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
38
|
-
build: "tsx helpers/build.ts",
|
|
39
|
-
prepublishOnly: "pnpm run build",
|
|
40
|
-
test: "vitest run"
|
|
41
|
-
},
|
|
42
|
-
files: [
|
|
43
|
-
"dist"
|
|
44
|
-
],
|
|
45
|
-
sideEffects: false,
|
|
46
|
-
devDependencies: {
|
|
47
|
-
"@opentelemetry/api": "1.9.0"
|
|
48
|
-
},
|
|
49
|
-
peerDependencies: {
|
|
50
|
-
"@opentelemetry/api": "^1.8"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var majorVersion = package_default.version.split(".")[0];
|
|
54
|
-
var GLOBAL_INSTRUMENTATION_KEY = "PRISMA_INSTRUMENTATION";
|
|
55
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
56
|
-
var globalThisWithPrismaInstrumentation = globalThis;
|
|
57
|
-
function getGlobalTracingHelper() {
|
|
58
|
-
const versionedGlobal = globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
|
|
59
|
-
if (versionedGlobal?.helper) {
|
|
60
|
-
return versionedGlobal.helper;
|
|
61
|
-
}
|
|
62
|
-
const fallbackGlobal = globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
|
|
63
|
-
return fallbackGlobal?.helper;
|
|
64
|
-
}
|
|
65
|
-
function setGlobalTracingHelper(helper) {
|
|
66
|
-
const globalValue = { helper };
|
|
67
|
-
globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY] = globalValue;
|
|
68
|
-
globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY] = globalValue;
|
|
69
|
-
}
|
|
70
|
-
function clearGlobalTracingHelper() {
|
|
71
|
-
delete globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
|
|
72
|
-
delete globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
8
|
// src/ActiveTracingHelper.ts
|
|
76
9
|
import {
|
|
77
10
|
context as _context,
|
|
@@ -196,9 +129,9 @@ function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
|
196
129
|
}
|
|
197
130
|
|
|
198
131
|
// package.json
|
|
199
|
-
var
|
|
132
|
+
var package_default = {
|
|
200
133
|
name: "@prisma/instrumentation",
|
|
201
|
-
version: "7.
|
|
134
|
+
version: "7.3.0-integration-prisma6-fix-cloudflare-engine.1",
|
|
202
135
|
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
203
136
|
main: "dist/index.js",
|
|
204
137
|
module: "dist/index.mjs",
|
|
@@ -224,13 +157,13 @@ var package_default2 = {
|
|
|
224
157
|
},
|
|
225
158
|
bugs: "https://github.com/prisma/prisma/issues",
|
|
226
159
|
devDependencies: {
|
|
160
|
+
"@prisma/internals": "workspace:*",
|
|
161
|
+
"@types/node": "18.19.76",
|
|
227
162
|
"@opentelemetry/api": "1.9.0",
|
|
228
|
-
"@prisma/instrumentation-contract": "workspace:*",
|
|
229
|
-
"@types/node": "~20.19.24",
|
|
230
163
|
typescript: "5.4.5"
|
|
231
164
|
},
|
|
232
165
|
dependencies: {
|
|
233
|
-
"@opentelemetry/instrumentation": "
|
|
166
|
+
"@opentelemetry/instrumentation": ">=0.52.0 <1"
|
|
234
167
|
},
|
|
235
168
|
peerDependencies: {
|
|
236
169
|
"@opentelemetry/api": "^1.8"
|
|
@@ -254,8 +187,11 @@ var package_default2 = {
|
|
|
254
187
|
};
|
|
255
188
|
|
|
256
189
|
// src/constants.ts
|
|
257
|
-
var VERSION =
|
|
258
|
-
var
|
|
190
|
+
var VERSION = package_default.version;
|
|
191
|
+
var majorVersion = VERSION.split(".")[0];
|
|
192
|
+
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
193
|
+
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
194
|
+
var NAME = package_default.name;
|
|
259
195
|
var MODULE_NAME = "@prisma/client";
|
|
260
196
|
|
|
261
197
|
// src/PrismaInstrumentation.ts
|
|
@@ -273,18 +209,21 @@ var PrismaInstrumentation = class extends InstrumentationBase {
|
|
|
273
209
|
}
|
|
274
210
|
enable() {
|
|
275
211
|
const config = this._config;
|
|
276
|
-
|
|
277
|
-
new ActiveTracingHelper({
|
|
212
|
+
const globalValue = {
|
|
213
|
+
helper: new ActiveTracingHelper({
|
|
278
214
|
tracerProvider: this.tracerProvider ?? trace2.getTracerProvider(),
|
|
279
215
|
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
280
216
|
})
|
|
281
|
-
|
|
217
|
+
};
|
|
218
|
+
global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
219
|
+
global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
282
220
|
}
|
|
283
221
|
disable() {
|
|
284
|
-
|
|
222
|
+
delete global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY];
|
|
223
|
+
delete global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY];
|
|
285
224
|
}
|
|
286
225
|
isEnabled() {
|
|
287
|
-
return
|
|
226
|
+
return Boolean(global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY]);
|
|
288
227
|
}
|
|
289
228
|
};
|
|
290
229
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, TracerProvider } from '@opentelemetry/api';
|
|
2
|
-
import
|
|
2
|
+
import { EngineSpan, ExtendedSpanOptions, SpanCallback, TracingHelper } from '@prisma/internals';
|
|
3
3
|
type Options = {
|
|
4
4
|
tracerProvider: TracerProvider;
|
|
5
5
|
ignoreSpanTypes: (string | RegExp)[];
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const VERSION: string;
|
|
2
|
+
export declare const GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
3
|
+
export declare const GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY: string;
|
|
2
4
|
export declare const NAME: string;
|
|
3
5
|
export declare const MODULE_NAME = "@prisma/client";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/instrumentation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0-integration-prisma6-fix-cloudflare-engine.1",
|
|
4
4
|
"description": "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"bugs": "https://github.com/prisma/prisma/issues",
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@types/node": "18.19.76",
|
|
29
30
|
"@opentelemetry/api": "1.9.0",
|
|
30
|
-
"@types/node": "~20.19.24",
|
|
31
31
|
"typescript": "5.4.5",
|
|
32
|
-
"@prisma/
|
|
32
|
+
"@prisma/internals": "7.3.0-integration-prisma6-fix-cloudflare-engine.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@opentelemetry/instrumentation": "
|
|
35
|
+
"@opentelemetry/instrumentation": ">=0.52.0 <1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@opentelemetry/api": "^1.8"
|