@prisma/instrumentation 6.7.0-dev.46 → 6.7.0-dev.47
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/dist/index.d.mts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +13 -1
- package/dist/index.mjs +13 -1
- package/package.json +14 -2
- package/dist/ActiveTracingHelper.js +0 -151
- package/dist/ActiveTracingHelper.mjs +0 -130
- package/dist/PrismaInstrumentation.js +0 -247
- package/dist/PrismaInstrumentation.mjs +0 -229
- package/dist/constants.js +0 -95
- package/dist/constants.mjs +0 -64
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
import { InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
4
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
5
|
+
import { TracerProvider } from '@opentelemetry/api';
|
|
6
|
+
|
|
7
|
+
declare type Config = PrismaInstrumentationConfig & InstrumentationConfig;
|
|
8
|
+
|
|
9
|
+
export declare class PrismaInstrumentation extends InstrumentationBase {
|
|
10
|
+
private tracerProvider;
|
|
11
|
+
constructor(config?: Config);
|
|
12
|
+
setTracerProvider(tracerProvider: TracerProvider): void;
|
|
13
|
+
init(): InstrumentationNodeModuleDefinition[];
|
|
14
|
+
enable(): void;
|
|
15
|
+
disable(): void;
|
|
16
|
+
isEnabled(): boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface PrismaInstrumentationConfig {
|
|
20
|
+
middleware?: boolean;
|
|
21
|
+
ignoreSpanTypes?: (string | RegExp)[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { registerInstrumentations }
|
|
25
|
+
|
|
26
|
+
export { }
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
import { InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
4
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
5
|
+
import { TracerProvider } from '@opentelemetry/api';
|
|
6
|
+
|
|
7
|
+
declare type Config = PrismaInstrumentationConfig & InstrumentationConfig;
|
|
8
|
+
|
|
9
|
+
export declare class PrismaInstrumentation extends InstrumentationBase {
|
|
10
|
+
private tracerProvider;
|
|
11
|
+
constructor(config?: Config);
|
|
12
|
+
setTracerProvider(tracerProvider: TracerProvider): void;
|
|
13
|
+
init(): InstrumentationNodeModuleDefinition[];
|
|
14
|
+
enable(): void;
|
|
15
|
+
disable(): void;
|
|
16
|
+
isEnabled(): boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface PrismaInstrumentationConfig {
|
|
20
|
+
middleware?: boolean;
|
|
21
|
+
ignoreSpanTypes?: (string | RegExp)[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { registerInstrumentations }
|
|
25
|
+
|
|
26
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -156,11 +156,23 @@ function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
|
156
156
|
// package.json
|
|
157
157
|
var package_default = {
|
|
158
158
|
name: "@prisma/instrumentation",
|
|
159
|
-
version: "6.7.0-dev.
|
|
159
|
+
version: "6.7.0-dev.47",
|
|
160
160
|
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
161
161
|
main: "dist/index.js",
|
|
162
162
|
module: "dist/index.mjs",
|
|
163
163
|
types: "dist/index.d.ts",
|
|
164
|
+
exports: {
|
|
165
|
+
".": {
|
|
166
|
+
require: {
|
|
167
|
+
types: "./dist/index.d.ts",
|
|
168
|
+
default: "./dist/index.js"
|
|
169
|
+
},
|
|
170
|
+
import: {
|
|
171
|
+
types: "./dist/index.d.ts",
|
|
172
|
+
default: "./dist/index.mjs"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
164
176
|
license: "Apache-2.0",
|
|
165
177
|
homepage: "https://www.prisma.io",
|
|
166
178
|
repository: {
|
package/dist/index.mjs
CHANGED
|
@@ -136,11 +136,23 @@ function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
|
136
136
|
// package.json
|
|
137
137
|
var package_default = {
|
|
138
138
|
name: "@prisma/instrumentation",
|
|
139
|
-
version: "6.7.0-dev.
|
|
139
|
+
version: "6.7.0-dev.47",
|
|
140
140
|
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
141
141
|
main: "dist/index.js",
|
|
142
142
|
module: "dist/index.mjs",
|
|
143
143
|
types: "dist/index.d.ts",
|
|
144
|
+
exports: {
|
|
145
|
+
".": {
|
|
146
|
+
require: {
|
|
147
|
+
types: "./dist/index.d.ts",
|
|
148
|
+
default: "./dist/index.js"
|
|
149
|
+
},
|
|
150
|
+
import: {
|
|
151
|
+
types: "./dist/index.d.ts",
|
|
152
|
+
default: "./dist/index.mjs"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
144
156
|
license: "Apache-2.0",
|
|
145
157
|
homepage: "https://www.prisma.io",
|
|
146
158
|
repository: {
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/instrumentation",
|
|
3
|
-
"version": "6.7.0-dev.
|
|
3
|
+
"version": "6.7.0-dev.47",
|
|
4
4
|
"description": "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.mjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
8
20
|
"license": "Apache-2.0",
|
|
9
21
|
"homepage": "https://www.prisma.io",
|
|
10
22
|
"repository": {
|
|
@@ -21,7 +33,7 @@
|
|
|
21
33
|
"jest": "29.7.0",
|
|
22
34
|
"jest-junit": "16.0.0",
|
|
23
35
|
"typescript": "5.4.5",
|
|
24
|
-
"@prisma/internals": "6.7.0-dev.
|
|
36
|
+
"@prisma/internals": "6.7.0-dev.47"
|
|
25
37
|
},
|
|
26
38
|
"dependencies": {
|
|
27
39
|
"@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/ActiveTracingHelper.ts
|
|
21
|
-
var ActiveTracingHelper_exports = {};
|
|
22
|
-
__export(ActiveTracingHelper_exports, {
|
|
23
|
-
ActiveTracingHelper: () => ActiveTracingHelper
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ActiveTracingHelper_exports);
|
|
26
|
-
var import_api = require("@opentelemetry/api");
|
|
27
|
-
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
28
|
-
var nonSampledTraceParent = `00-10-10-00`;
|
|
29
|
-
function engineSpanKindToOtelSpanKind(engineSpanKind) {
|
|
30
|
-
switch (engineSpanKind) {
|
|
31
|
-
case "client":
|
|
32
|
-
return import_api.SpanKind.CLIENT;
|
|
33
|
-
case "internal":
|
|
34
|
-
default:
|
|
35
|
-
return import_api.SpanKind.INTERNAL;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
var ActiveTracingHelper = class {
|
|
39
|
-
traceMiddleware;
|
|
40
|
-
tracerProvider;
|
|
41
|
-
ignoreSpanTypes;
|
|
42
|
-
constructor({ traceMiddleware, tracerProvider, ignoreSpanTypes }) {
|
|
43
|
-
this.traceMiddleware = traceMiddleware;
|
|
44
|
-
this.tracerProvider = tracerProvider;
|
|
45
|
-
this.ignoreSpanTypes = ignoreSpanTypes;
|
|
46
|
-
}
|
|
47
|
-
isEnabled() {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
getTraceParent(context) {
|
|
51
|
-
const span = import_api.trace.getSpanContext(context ?? import_api.context.active());
|
|
52
|
-
if (span) {
|
|
53
|
-
return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
|
|
54
|
-
}
|
|
55
|
-
return nonSampledTraceParent;
|
|
56
|
-
}
|
|
57
|
-
dispatchEngineSpans(spans) {
|
|
58
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
59
|
-
const linkIds = /* @__PURE__ */ new Map();
|
|
60
|
-
const roots = spans.filter((span) => span.parentId === null);
|
|
61
|
-
for (const root of roots) {
|
|
62
|
-
dispatchEngineSpan(tracer, root, spans, linkIds, this.ignoreSpanTypes);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
getActiveContext() {
|
|
66
|
-
return import_api.context.active();
|
|
67
|
-
}
|
|
68
|
-
runInChildSpan(options, callback) {
|
|
69
|
-
if (typeof options === "string") {
|
|
70
|
-
options = { name: options };
|
|
71
|
-
}
|
|
72
|
-
if (options.internal && !showAllTraces) {
|
|
73
|
-
return callback();
|
|
74
|
-
}
|
|
75
|
-
if (options.middleware && !this.traceMiddleware) {
|
|
76
|
-
return callback();
|
|
77
|
-
}
|
|
78
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
79
|
-
const context = options.context ?? this.getActiveContext();
|
|
80
|
-
const name = `prisma:client:${options.name}`;
|
|
81
|
-
if (shouldIgnoreSpan(name, this.ignoreSpanTypes)) {
|
|
82
|
-
return callback();
|
|
83
|
-
}
|
|
84
|
-
if (options.active === false) {
|
|
85
|
-
const span = tracer.startSpan(name, options, context);
|
|
86
|
-
return endSpan(span, callback(span, context));
|
|
87
|
-
}
|
|
88
|
-
return tracer.startActiveSpan(name, options, (span) => endSpan(span, callback(span, context)));
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
92
|
-
if (shouldIgnoreSpan(engineSpan.name, ignoreSpanTypes)) return;
|
|
93
|
-
const spanOptions = {
|
|
94
|
-
attributes: engineSpan.attributes,
|
|
95
|
-
kind: engineSpanKindToOtelSpanKind(engineSpan.kind),
|
|
96
|
-
startTime: engineSpan.startTime
|
|
97
|
-
};
|
|
98
|
-
tracer.startActiveSpan(engineSpan.name, spanOptions, (span) => {
|
|
99
|
-
linkIds.set(engineSpan.id, span.spanContext().spanId);
|
|
100
|
-
if (engineSpan.links) {
|
|
101
|
-
span.addLinks(
|
|
102
|
-
engineSpan.links.flatMap((link) => {
|
|
103
|
-
const linkedId = linkIds.get(link);
|
|
104
|
-
if (!linkedId) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
context: {
|
|
109
|
-
spanId: linkedId,
|
|
110
|
-
traceId: span.spanContext().traceId,
|
|
111
|
-
traceFlags: span.spanContext().traceFlags
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
})
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
const children = allSpans.filter((s) => s.parentId === engineSpan.id);
|
|
118
|
-
for (const child of children) {
|
|
119
|
-
dispatchEngineSpan(tracer, child, allSpans, linkIds, ignoreSpanTypes);
|
|
120
|
-
}
|
|
121
|
-
span.end(engineSpan.endTime);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function endSpan(span, result) {
|
|
125
|
-
if (isPromiseLike(result)) {
|
|
126
|
-
return result.then(
|
|
127
|
-
(value) => {
|
|
128
|
-
span.end();
|
|
129
|
-
return value;
|
|
130
|
-
},
|
|
131
|
-
(reason) => {
|
|
132
|
-
span.end();
|
|
133
|
-
throw reason;
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
span.end();
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
function isPromiseLike(value) {
|
|
141
|
-
return value != null && typeof value["then"] === "function";
|
|
142
|
-
}
|
|
143
|
-
function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
144
|
-
return ignoreSpanTypes.some(
|
|
145
|
-
(pattern) => typeof pattern === "string" ? pattern === spanName : pattern.test(spanName)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
-
0 && (module.exports = {
|
|
150
|
-
ActiveTracingHelper
|
|
151
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// src/ActiveTracingHelper.ts
|
|
2
|
-
import {
|
|
3
|
-
context as _context,
|
|
4
|
-
SpanKind,
|
|
5
|
-
trace
|
|
6
|
-
} from "@opentelemetry/api";
|
|
7
|
-
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
8
|
-
var nonSampledTraceParent = `00-10-10-00`;
|
|
9
|
-
function engineSpanKindToOtelSpanKind(engineSpanKind) {
|
|
10
|
-
switch (engineSpanKind) {
|
|
11
|
-
case "client":
|
|
12
|
-
return SpanKind.CLIENT;
|
|
13
|
-
case "internal":
|
|
14
|
-
default:
|
|
15
|
-
return SpanKind.INTERNAL;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
var ActiveTracingHelper = class {
|
|
19
|
-
traceMiddleware;
|
|
20
|
-
tracerProvider;
|
|
21
|
-
ignoreSpanTypes;
|
|
22
|
-
constructor({ traceMiddleware, tracerProvider, ignoreSpanTypes }) {
|
|
23
|
-
this.traceMiddleware = traceMiddleware;
|
|
24
|
-
this.tracerProvider = tracerProvider;
|
|
25
|
-
this.ignoreSpanTypes = ignoreSpanTypes;
|
|
26
|
-
}
|
|
27
|
-
isEnabled() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
getTraceParent(context) {
|
|
31
|
-
const span = trace.getSpanContext(context ?? _context.active());
|
|
32
|
-
if (span) {
|
|
33
|
-
return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
|
|
34
|
-
}
|
|
35
|
-
return nonSampledTraceParent;
|
|
36
|
-
}
|
|
37
|
-
dispatchEngineSpans(spans) {
|
|
38
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
39
|
-
const linkIds = /* @__PURE__ */ new Map();
|
|
40
|
-
const roots = spans.filter((span) => span.parentId === null);
|
|
41
|
-
for (const root of roots) {
|
|
42
|
-
dispatchEngineSpan(tracer, root, spans, linkIds, this.ignoreSpanTypes);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
getActiveContext() {
|
|
46
|
-
return _context.active();
|
|
47
|
-
}
|
|
48
|
-
runInChildSpan(options, callback) {
|
|
49
|
-
if (typeof options === "string") {
|
|
50
|
-
options = { name: options };
|
|
51
|
-
}
|
|
52
|
-
if (options.internal && !showAllTraces) {
|
|
53
|
-
return callback();
|
|
54
|
-
}
|
|
55
|
-
if (options.middleware && !this.traceMiddleware) {
|
|
56
|
-
return callback();
|
|
57
|
-
}
|
|
58
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
59
|
-
const context = options.context ?? this.getActiveContext();
|
|
60
|
-
const name = `prisma:client:${options.name}`;
|
|
61
|
-
if (shouldIgnoreSpan(name, this.ignoreSpanTypes)) {
|
|
62
|
-
return callback();
|
|
63
|
-
}
|
|
64
|
-
if (options.active === false) {
|
|
65
|
-
const span = tracer.startSpan(name, options, context);
|
|
66
|
-
return endSpan(span, callback(span, context));
|
|
67
|
-
}
|
|
68
|
-
return tracer.startActiveSpan(name, options, (span) => endSpan(span, callback(span, context)));
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
72
|
-
if (shouldIgnoreSpan(engineSpan.name, ignoreSpanTypes)) return;
|
|
73
|
-
const spanOptions = {
|
|
74
|
-
attributes: engineSpan.attributes,
|
|
75
|
-
kind: engineSpanKindToOtelSpanKind(engineSpan.kind),
|
|
76
|
-
startTime: engineSpan.startTime
|
|
77
|
-
};
|
|
78
|
-
tracer.startActiveSpan(engineSpan.name, spanOptions, (span) => {
|
|
79
|
-
linkIds.set(engineSpan.id, span.spanContext().spanId);
|
|
80
|
-
if (engineSpan.links) {
|
|
81
|
-
span.addLinks(
|
|
82
|
-
engineSpan.links.flatMap((link) => {
|
|
83
|
-
const linkedId = linkIds.get(link);
|
|
84
|
-
if (!linkedId) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
context: {
|
|
89
|
-
spanId: linkedId,
|
|
90
|
-
traceId: span.spanContext().traceId,
|
|
91
|
-
traceFlags: span.spanContext().traceFlags
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
const children = allSpans.filter((s) => s.parentId === engineSpan.id);
|
|
98
|
-
for (const child of children) {
|
|
99
|
-
dispatchEngineSpan(tracer, child, allSpans, linkIds, ignoreSpanTypes);
|
|
100
|
-
}
|
|
101
|
-
span.end(engineSpan.endTime);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function endSpan(span, result) {
|
|
105
|
-
if (isPromiseLike(result)) {
|
|
106
|
-
return result.then(
|
|
107
|
-
(value) => {
|
|
108
|
-
span.end();
|
|
109
|
-
return value;
|
|
110
|
-
},
|
|
111
|
-
(reason) => {
|
|
112
|
-
span.end();
|
|
113
|
-
throw reason;
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
span.end();
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
function isPromiseLike(value) {
|
|
121
|
-
return value != null && typeof value["then"] === "function";
|
|
122
|
-
}
|
|
123
|
-
function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
124
|
-
return ignoreSpanTypes.some(
|
|
125
|
-
(pattern) => typeof pattern === "string" ? pattern === spanName : pattern.test(spanName)
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
129
|
-
ActiveTracingHelper
|
|
130
|
-
};
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/PrismaInstrumentation.ts
|
|
21
|
-
var PrismaInstrumentation_exports = {};
|
|
22
|
-
__export(PrismaInstrumentation_exports, {
|
|
23
|
-
PrismaInstrumentation: () => PrismaInstrumentation
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(PrismaInstrumentation_exports);
|
|
26
|
-
var import_api2 = require("@opentelemetry/api");
|
|
27
|
-
var import_instrumentation = require("@opentelemetry/instrumentation");
|
|
28
|
-
|
|
29
|
-
// src/ActiveTracingHelper.ts
|
|
30
|
-
var import_api = require("@opentelemetry/api");
|
|
31
|
-
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
32
|
-
var nonSampledTraceParent = `00-10-10-00`;
|
|
33
|
-
function engineSpanKindToOtelSpanKind(engineSpanKind) {
|
|
34
|
-
switch (engineSpanKind) {
|
|
35
|
-
case "client":
|
|
36
|
-
return import_api.SpanKind.CLIENT;
|
|
37
|
-
case "internal":
|
|
38
|
-
default:
|
|
39
|
-
return import_api.SpanKind.INTERNAL;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
var ActiveTracingHelper = class {
|
|
43
|
-
traceMiddleware;
|
|
44
|
-
tracerProvider;
|
|
45
|
-
ignoreSpanTypes;
|
|
46
|
-
constructor({ traceMiddleware, tracerProvider, ignoreSpanTypes }) {
|
|
47
|
-
this.traceMiddleware = traceMiddleware;
|
|
48
|
-
this.tracerProvider = tracerProvider;
|
|
49
|
-
this.ignoreSpanTypes = ignoreSpanTypes;
|
|
50
|
-
}
|
|
51
|
-
isEnabled() {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
getTraceParent(context) {
|
|
55
|
-
const span = import_api.trace.getSpanContext(context ?? import_api.context.active());
|
|
56
|
-
if (span) {
|
|
57
|
-
return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
|
|
58
|
-
}
|
|
59
|
-
return nonSampledTraceParent;
|
|
60
|
-
}
|
|
61
|
-
dispatchEngineSpans(spans) {
|
|
62
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
63
|
-
const linkIds = /* @__PURE__ */ new Map();
|
|
64
|
-
const roots = spans.filter((span) => span.parentId === null);
|
|
65
|
-
for (const root of roots) {
|
|
66
|
-
dispatchEngineSpan(tracer, root, spans, linkIds, this.ignoreSpanTypes);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
getActiveContext() {
|
|
70
|
-
return import_api.context.active();
|
|
71
|
-
}
|
|
72
|
-
runInChildSpan(options, callback) {
|
|
73
|
-
if (typeof options === "string") {
|
|
74
|
-
options = { name: options };
|
|
75
|
-
}
|
|
76
|
-
if (options.internal && !showAllTraces) {
|
|
77
|
-
return callback();
|
|
78
|
-
}
|
|
79
|
-
if (options.middleware && !this.traceMiddleware) {
|
|
80
|
-
return callback();
|
|
81
|
-
}
|
|
82
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
83
|
-
const context = options.context ?? this.getActiveContext();
|
|
84
|
-
const name = `prisma:client:${options.name}`;
|
|
85
|
-
if (shouldIgnoreSpan(name, this.ignoreSpanTypes)) {
|
|
86
|
-
return callback();
|
|
87
|
-
}
|
|
88
|
-
if (options.active === false) {
|
|
89
|
-
const span = tracer.startSpan(name, options, context);
|
|
90
|
-
return endSpan(span, callback(span, context));
|
|
91
|
-
}
|
|
92
|
-
return tracer.startActiveSpan(name, options, (span) => endSpan(span, callback(span, context)));
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
96
|
-
if (shouldIgnoreSpan(engineSpan.name, ignoreSpanTypes)) return;
|
|
97
|
-
const spanOptions = {
|
|
98
|
-
attributes: engineSpan.attributes,
|
|
99
|
-
kind: engineSpanKindToOtelSpanKind(engineSpan.kind),
|
|
100
|
-
startTime: engineSpan.startTime
|
|
101
|
-
};
|
|
102
|
-
tracer.startActiveSpan(engineSpan.name, spanOptions, (span) => {
|
|
103
|
-
linkIds.set(engineSpan.id, span.spanContext().spanId);
|
|
104
|
-
if (engineSpan.links) {
|
|
105
|
-
span.addLinks(
|
|
106
|
-
engineSpan.links.flatMap((link) => {
|
|
107
|
-
const linkedId = linkIds.get(link);
|
|
108
|
-
if (!linkedId) {
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
context: {
|
|
113
|
-
spanId: linkedId,
|
|
114
|
-
traceId: span.spanContext().traceId,
|
|
115
|
-
traceFlags: span.spanContext().traceFlags
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
})
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
const children = allSpans.filter((s) => s.parentId === engineSpan.id);
|
|
122
|
-
for (const child of children) {
|
|
123
|
-
dispatchEngineSpan(tracer, child, allSpans, linkIds, ignoreSpanTypes);
|
|
124
|
-
}
|
|
125
|
-
span.end(engineSpan.endTime);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function endSpan(span, result) {
|
|
129
|
-
if (isPromiseLike(result)) {
|
|
130
|
-
return result.then(
|
|
131
|
-
(value) => {
|
|
132
|
-
span.end();
|
|
133
|
-
return value;
|
|
134
|
-
},
|
|
135
|
-
(reason) => {
|
|
136
|
-
span.end();
|
|
137
|
-
throw reason;
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
span.end();
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
function isPromiseLike(value) {
|
|
145
|
-
return value != null && typeof value["then"] === "function";
|
|
146
|
-
}
|
|
147
|
-
function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
148
|
-
return ignoreSpanTypes.some(
|
|
149
|
-
(pattern) => typeof pattern === "string" ? pattern === spanName : pattern.test(spanName)
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// package.json
|
|
154
|
-
var package_default = {
|
|
155
|
-
name: "@prisma/instrumentation",
|
|
156
|
-
version: "6.7.0-dev.46",
|
|
157
|
-
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
158
|
-
main: "dist/index.js",
|
|
159
|
-
module: "dist/index.mjs",
|
|
160
|
-
types: "dist/index.d.ts",
|
|
161
|
-
license: "Apache-2.0",
|
|
162
|
-
homepage: "https://www.prisma.io",
|
|
163
|
-
repository: {
|
|
164
|
-
type: "git",
|
|
165
|
-
url: "https://github.com/prisma/prisma.git",
|
|
166
|
-
directory: "packages/instrumentation"
|
|
167
|
-
},
|
|
168
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
169
|
-
devDependencies: {
|
|
170
|
-
"@prisma/internals": "workspace:*",
|
|
171
|
-
"@swc/core": "1.11.5",
|
|
172
|
-
"@types/jest": "29.5.14",
|
|
173
|
-
"@types/node": "18.19.76",
|
|
174
|
-
"@opentelemetry/api": "1.9.0",
|
|
175
|
-
jest: "29.7.0",
|
|
176
|
-
"jest-junit": "16.0.0",
|
|
177
|
-
typescript: "5.4.5"
|
|
178
|
-
},
|
|
179
|
-
dependencies: {
|
|
180
|
-
"@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
|
|
181
|
-
},
|
|
182
|
-
peerDependencies: {
|
|
183
|
-
"@opentelemetry/api": "^1.8"
|
|
184
|
-
},
|
|
185
|
-
files: [
|
|
186
|
-
"dist"
|
|
187
|
-
],
|
|
188
|
-
keywords: [
|
|
189
|
-
"prisma",
|
|
190
|
-
"instrumentation",
|
|
191
|
-
"opentelemetry",
|
|
192
|
-
"otel"
|
|
193
|
-
],
|
|
194
|
-
scripts: {
|
|
195
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
196
|
-
build: "tsx helpers/build.ts",
|
|
197
|
-
prepublishOnly: "pnpm run build",
|
|
198
|
-
test: "jest"
|
|
199
|
-
},
|
|
200
|
-
sideEffects: false
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/constants.ts
|
|
204
|
-
var VERSION = package_default.version;
|
|
205
|
-
var majorVersion = VERSION.split(".")[0];
|
|
206
|
-
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
207
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
208
|
-
var NAME = package_default.name;
|
|
209
|
-
var MODULE_NAME = "@prisma/client";
|
|
210
|
-
|
|
211
|
-
// src/PrismaInstrumentation.ts
|
|
212
|
-
var PrismaInstrumentation = class extends import_instrumentation.InstrumentationBase {
|
|
213
|
-
tracerProvider;
|
|
214
|
-
constructor(config = {}) {
|
|
215
|
-
super(NAME, VERSION, config);
|
|
216
|
-
}
|
|
217
|
-
setTracerProvider(tracerProvider) {
|
|
218
|
-
this.tracerProvider = tracerProvider;
|
|
219
|
-
}
|
|
220
|
-
init() {
|
|
221
|
-
const module2 = new import_instrumentation.InstrumentationNodeModuleDefinition(MODULE_NAME, [VERSION]);
|
|
222
|
-
return [module2];
|
|
223
|
-
}
|
|
224
|
-
enable() {
|
|
225
|
-
const config = this._config;
|
|
226
|
-
const globalValue = {
|
|
227
|
-
helper: new ActiveTracingHelper({
|
|
228
|
-
traceMiddleware: config.middleware ?? false,
|
|
229
|
-
tracerProvider: this.tracerProvider ?? import_api2.trace.getTracerProvider(),
|
|
230
|
-
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
231
|
-
})
|
|
232
|
-
};
|
|
233
|
-
global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
234
|
-
global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
235
|
-
}
|
|
236
|
-
disable() {
|
|
237
|
-
delete global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY];
|
|
238
|
-
delete global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY];
|
|
239
|
-
}
|
|
240
|
-
isEnabled() {
|
|
241
|
-
return Boolean(global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY]);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
245
|
-
0 && (module.exports = {
|
|
246
|
-
PrismaInstrumentation
|
|
247
|
-
});
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
// src/PrismaInstrumentation.ts
|
|
2
|
-
import { trace as trace2 } from "@opentelemetry/api";
|
|
3
|
-
import {
|
|
4
|
-
InstrumentationBase,
|
|
5
|
-
InstrumentationNodeModuleDefinition
|
|
6
|
-
} from "@opentelemetry/instrumentation";
|
|
7
|
-
|
|
8
|
-
// src/ActiveTracingHelper.ts
|
|
9
|
-
import {
|
|
10
|
-
context as _context,
|
|
11
|
-
SpanKind,
|
|
12
|
-
trace
|
|
13
|
-
} from "@opentelemetry/api";
|
|
14
|
-
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
15
|
-
var nonSampledTraceParent = `00-10-10-00`;
|
|
16
|
-
function engineSpanKindToOtelSpanKind(engineSpanKind) {
|
|
17
|
-
switch (engineSpanKind) {
|
|
18
|
-
case "client":
|
|
19
|
-
return SpanKind.CLIENT;
|
|
20
|
-
case "internal":
|
|
21
|
-
default:
|
|
22
|
-
return SpanKind.INTERNAL;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
var ActiveTracingHelper = class {
|
|
26
|
-
traceMiddleware;
|
|
27
|
-
tracerProvider;
|
|
28
|
-
ignoreSpanTypes;
|
|
29
|
-
constructor({ traceMiddleware, tracerProvider, ignoreSpanTypes }) {
|
|
30
|
-
this.traceMiddleware = traceMiddleware;
|
|
31
|
-
this.tracerProvider = tracerProvider;
|
|
32
|
-
this.ignoreSpanTypes = ignoreSpanTypes;
|
|
33
|
-
}
|
|
34
|
-
isEnabled() {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
getTraceParent(context) {
|
|
38
|
-
const span = trace.getSpanContext(context ?? _context.active());
|
|
39
|
-
if (span) {
|
|
40
|
-
return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
|
|
41
|
-
}
|
|
42
|
-
return nonSampledTraceParent;
|
|
43
|
-
}
|
|
44
|
-
dispatchEngineSpans(spans) {
|
|
45
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
46
|
-
const linkIds = /* @__PURE__ */ new Map();
|
|
47
|
-
const roots = spans.filter((span) => span.parentId === null);
|
|
48
|
-
for (const root of roots) {
|
|
49
|
-
dispatchEngineSpan(tracer, root, spans, linkIds, this.ignoreSpanTypes);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
getActiveContext() {
|
|
53
|
-
return _context.active();
|
|
54
|
-
}
|
|
55
|
-
runInChildSpan(options, callback) {
|
|
56
|
-
if (typeof options === "string") {
|
|
57
|
-
options = { name: options };
|
|
58
|
-
}
|
|
59
|
-
if (options.internal && !showAllTraces) {
|
|
60
|
-
return callback();
|
|
61
|
-
}
|
|
62
|
-
if (options.middleware && !this.traceMiddleware) {
|
|
63
|
-
return callback();
|
|
64
|
-
}
|
|
65
|
-
const tracer = this.tracerProvider.getTracer("prisma");
|
|
66
|
-
const context = options.context ?? this.getActiveContext();
|
|
67
|
-
const name = `prisma:client:${options.name}`;
|
|
68
|
-
if (shouldIgnoreSpan(name, this.ignoreSpanTypes)) {
|
|
69
|
-
return callback();
|
|
70
|
-
}
|
|
71
|
-
if (options.active === false) {
|
|
72
|
-
const span = tracer.startSpan(name, options, context);
|
|
73
|
-
return endSpan(span, callback(span, context));
|
|
74
|
-
}
|
|
75
|
-
return tracer.startActiveSpan(name, options, (span) => endSpan(span, callback(span, context)));
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
79
|
-
if (shouldIgnoreSpan(engineSpan.name, ignoreSpanTypes)) return;
|
|
80
|
-
const spanOptions = {
|
|
81
|
-
attributes: engineSpan.attributes,
|
|
82
|
-
kind: engineSpanKindToOtelSpanKind(engineSpan.kind),
|
|
83
|
-
startTime: engineSpan.startTime
|
|
84
|
-
};
|
|
85
|
-
tracer.startActiveSpan(engineSpan.name, spanOptions, (span) => {
|
|
86
|
-
linkIds.set(engineSpan.id, span.spanContext().spanId);
|
|
87
|
-
if (engineSpan.links) {
|
|
88
|
-
span.addLinks(
|
|
89
|
-
engineSpan.links.flatMap((link) => {
|
|
90
|
-
const linkedId = linkIds.get(link);
|
|
91
|
-
if (!linkedId) {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
context: {
|
|
96
|
-
spanId: linkedId,
|
|
97
|
-
traceId: span.spanContext().traceId,
|
|
98
|
-
traceFlags: span.spanContext().traceFlags
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
const children = allSpans.filter((s) => s.parentId === engineSpan.id);
|
|
105
|
-
for (const child of children) {
|
|
106
|
-
dispatchEngineSpan(tracer, child, allSpans, linkIds, ignoreSpanTypes);
|
|
107
|
-
}
|
|
108
|
-
span.end(engineSpan.endTime);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function endSpan(span, result) {
|
|
112
|
-
if (isPromiseLike(result)) {
|
|
113
|
-
return result.then(
|
|
114
|
-
(value) => {
|
|
115
|
-
span.end();
|
|
116
|
-
return value;
|
|
117
|
-
},
|
|
118
|
-
(reason) => {
|
|
119
|
-
span.end();
|
|
120
|
-
throw reason;
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
span.end();
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
function isPromiseLike(value) {
|
|
128
|
-
return value != null && typeof value["then"] === "function";
|
|
129
|
-
}
|
|
130
|
-
function shouldIgnoreSpan(spanName, ignoreSpanTypes) {
|
|
131
|
-
return ignoreSpanTypes.some(
|
|
132
|
-
(pattern) => typeof pattern === "string" ? pattern === spanName : pattern.test(spanName)
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// package.json
|
|
137
|
-
var package_default = {
|
|
138
|
-
name: "@prisma/instrumentation",
|
|
139
|
-
version: "6.7.0-dev.46",
|
|
140
|
-
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
141
|
-
main: "dist/index.js",
|
|
142
|
-
module: "dist/index.mjs",
|
|
143
|
-
types: "dist/index.d.ts",
|
|
144
|
-
license: "Apache-2.0",
|
|
145
|
-
homepage: "https://www.prisma.io",
|
|
146
|
-
repository: {
|
|
147
|
-
type: "git",
|
|
148
|
-
url: "https://github.com/prisma/prisma.git",
|
|
149
|
-
directory: "packages/instrumentation"
|
|
150
|
-
},
|
|
151
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
152
|
-
devDependencies: {
|
|
153
|
-
"@prisma/internals": "workspace:*",
|
|
154
|
-
"@swc/core": "1.11.5",
|
|
155
|
-
"@types/jest": "29.5.14",
|
|
156
|
-
"@types/node": "18.19.76",
|
|
157
|
-
"@opentelemetry/api": "1.9.0",
|
|
158
|
-
jest: "29.7.0",
|
|
159
|
-
"jest-junit": "16.0.0",
|
|
160
|
-
typescript: "5.4.5"
|
|
161
|
-
},
|
|
162
|
-
dependencies: {
|
|
163
|
-
"@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
|
|
164
|
-
},
|
|
165
|
-
peerDependencies: {
|
|
166
|
-
"@opentelemetry/api": "^1.8"
|
|
167
|
-
},
|
|
168
|
-
files: [
|
|
169
|
-
"dist"
|
|
170
|
-
],
|
|
171
|
-
keywords: [
|
|
172
|
-
"prisma",
|
|
173
|
-
"instrumentation",
|
|
174
|
-
"opentelemetry",
|
|
175
|
-
"otel"
|
|
176
|
-
],
|
|
177
|
-
scripts: {
|
|
178
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
179
|
-
build: "tsx helpers/build.ts",
|
|
180
|
-
prepublishOnly: "pnpm run build",
|
|
181
|
-
test: "jest"
|
|
182
|
-
},
|
|
183
|
-
sideEffects: false
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// src/constants.ts
|
|
187
|
-
var VERSION = package_default.version;
|
|
188
|
-
var majorVersion = VERSION.split(".")[0];
|
|
189
|
-
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
190
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
191
|
-
var NAME = package_default.name;
|
|
192
|
-
var MODULE_NAME = "@prisma/client";
|
|
193
|
-
|
|
194
|
-
// src/PrismaInstrumentation.ts
|
|
195
|
-
var PrismaInstrumentation = class extends InstrumentationBase {
|
|
196
|
-
tracerProvider;
|
|
197
|
-
constructor(config = {}) {
|
|
198
|
-
super(NAME, VERSION, config);
|
|
199
|
-
}
|
|
200
|
-
setTracerProvider(tracerProvider) {
|
|
201
|
-
this.tracerProvider = tracerProvider;
|
|
202
|
-
}
|
|
203
|
-
init() {
|
|
204
|
-
const module = new InstrumentationNodeModuleDefinition(MODULE_NAME, [VERSION]);
|
|
205
|
-
return [module];
|
|
206
|
-
}
|
|
207
|
-
enable() {
|
|
208
|
-
const config = this._config;
|
|
209
|
-
const globalValue = {
|
|
210
|
-
helper: new ActiveTracingHelper({
|
|
211
|
-
traceMiddleware: config.middleware ?? false,
|
|
212
|
-
tracerProvider: this.tracerProvider ?? trace2.getTracerProvider(),
|
|
213
|
-
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
214
|
-
})
|
|
215
|
-
};
|
|
216
|
-
global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
217
|
-
global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY] = globalValue;
|
|
218
|
-
}
|
|
219
|
-
disable() {
|
|
220
|
-
delete global[GLOBAL_INSTRUMENTATION_ACCESSOR_KEY];
|
|
221
|
-
delete global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY];
|
|
222
|
-
}
|
|
223
|
-
isEnabled() {
|
|
224
|
-
return Boolean(global[GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY]);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
export {
|
|
228
|
-
PrismaInstrumentation
|
|
229
|
-
};
|
package/dist/constants.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/constants.ts
|
|
21
|
-
var constants_exports = {};
|
|
22
|
-
__export(constants_exports, {
|
|
23
|
-
GLOBAL_INSTRUMENTATION_ACCESSOR_KEY: () => GLOBAL_INSTRUMENTATION_ACCESSOR_KEY,
|
|
24
|
-
GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY: () => GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY,
|
|
25
|
-
MODULE_NAME: () => MODULE_NAME,
|
|
26
|
-
NAME: () => NAME,
|
|
27
|
-
VERSION: () => VERSION
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(constants_exports);
|
|
30
|
-
|
|
31
|
-
// package.json
|
|
32
|
-
var package_default = {
|
|
33
|
-
name: "@prisma/instrumentation",
|
|
34
|
-
version: "6.7.0-dev.46",
|
|
35
|
-
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
36
|
-
main: "dist/index.js",
|
|
37
|
-
module: "dist/index.mjs",
|
|
38
|
-
types: "dist/index.d.ts",
|
|
39
|
-
license: "Apache-2.0",
|
|
40
|
-
homepage: "https://www.prisma.io",
|
|
41
|
-
repository: {
|
|
42
|
-
type: "git",
|
|
43
|
-
url: "https://github.com/prisma/prisma.git",
|
|
44
|
-
directory: "packages/instrumentation"
|
|
45
|
-
},
|
|
46
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
47
|
-
devDependencies: {
|
|
48
|
-
"@prisma/internals": "workspace:*",
|
|
49
|
-
"@swc/core": "1.11.5",
|
|
50
|
-
"@types/jest": "29.5.14",
|
|
51
|
-
"@types/node": "18.19.76",
|
|
52
|
-
"@opentelemetry/api": "1.9.0",
|
|
53
|
-
jest: "29.7.0",
|
|
54
|
-
"jest-junit": "16.0.0",
|
|
55
|
-
typescript: "5.4.5"
|
|
56
|
-
},
|
|
57
|
-
dependencies: {
|
|
58
|
-
"@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
|
|
59
|
-
},
|
|
60
|
-
peerDependencies: {
|
|
61
|
-
"@opentelemetry/api": "^1.8"
|
|
62
|
-
},
|
|
63
|
-
files: [
|
|
64
|
-
"dist"
|
|
65
|
-
],
|
|
66
|
-
keywords: [
|
|
67
|
-
"prisma",
|
|
68
|
-
"instrumentation",
|
|
69
|
-
"opentelemetry",
|
|
70
|
-
"otel"
|
|
71
|
-
],
|
|
72
|
-
scripts: {
|
|
73
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
74
|
-
build: "tsx helpers/build.ts",
|
|
75
|
-
prepublishOnly: "pnpm run build",
|
|
76
|
-
test: "jest"
|
|
77
|
-
},
|
|
78
|
-
sideEffects: false
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// src/constants.ts
|
|
82
|
-
var VERSION = package_default.version;
|
|
83
|
-
var majorVersion = VERSION.split(".")[0];
|
|
84
|
-
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
85
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
86
|
-
var NAME = package_default.name;
|
|
87
|
-
var MODULE_NAME = "@prisma/client";
|
|
88
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
-
0 && (module.exports = {
|
|
90
|
-
GLOBAL_INSTRUMENTATION_ACCESSOR_KEY,
|
|
91
|
-
GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY,
|
|
92
|
-
MODULE_NAME,
|
|
93
|
-
NAME,
|
|
94
|
-
VERSION
|
|
95
|
-
});
|
package/dist/constants.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
var package_default = {
|
|
3
|
-
name: "@prisma/instrumentation",
|
|
4
|
-
version: "6.7.0-dev.46",
|
|
5
|
-
description: "OpenTelemetry compliant instrumentation for Prisma Client",
|
|
6
|
-
main: "dist/index.js",
|
|
7
|
-
module: "dist/index.mjs",
|
|
8
|
-
types: "dist/index.d.ts",
|
|
9
|
-
license: "Apache-2.0",
|
|
10
|
-
homepage: "https://www.prisma.io",
|
|
11
|
-
repository: {
|
|
12
|
-
type: "git",
|
|
13
|
-
url: "https://github.com/prisma/prisma.git",
|
|
14
|
-
directory: "packages/instrumentation"
|
|
15
|
-
},
|
|
16
|
-
bugs: "https://github.com/prisma/prisma/issues",
|
|
17
|
-
devDependencies: {
|
|
18
|
-
"@prisma/internals": "workspace:*",
|
|
19
|
-
"@swc/core": "1.11.5",
|
|
20
|
-
"@types/jest": "29.5.14",
|
|
21
|
-
"@types/node": "18.19.76",
|
|
22
|
-
"@opentelemetry/api": "1.9.0",
|
|
23
|
-
jest: "29.7.0",
|
|
24
|
-
"jest-junit": "16.0.0",
|
|
25
|
-
typescript: "5.4.5"
|
|
26
|
-
},
|
|
27
|
-
dependencies: {
|
|
28
|
-
"@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
|
|
29
|
-
},
|
|
30
|
-
peerDependencies: {
|
|
31
|
-
"@opentelemetry/api": "^1.8"
|
|
32
|
-
},
|
|
33
|
-
files: [
|
|
34
|
-
"dist"
|
|
35
|
-
],
|
|
36
|
-
keywords: [
|
|
37
|
-
"prisma",
|
|
38
|
-
"instrumentation",
|
|
39
|
-
"opentelemetry",
|
|
40
|
-
"otel"
|
|
41
|
-
],
|
|
42
|
-
scripts: {
|
|
43
|
-
dev: "DEV=true tsx helpers/build.ts",
|
|
44
|
-
build: "tsx helpers/build.ts",
|
|
45
|
-
prepublishOnly: "pnpm run build",
|
|
46
|
-
test: "jest"
|
|
47
|
-
},
|
|
48
|
-
sideEffects: false
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// src/constants.ts
|
|
52
|
-
var VERSION = package_default.version;
|
|
53
|
-
var majorVersion = VERSION.split(".")[0];
|
|
54
|
-
var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
|
|
55
|
-
var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
|
|
56
|
-
var NAME = package_default.name;
|
|
57
|
-
var MODULE_NAME = "@prisma/client";
|
|
58
|
-
export {
|
|
59
|
-
GLOBAL_INSTRUMENTATION_ACCESSOR_KEY,
|
|
60
|
-
GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY,
|
|
61
|
-
MODULE_NAME,
|
|
62
|
-
NAME,
|
|
63
|
-
VERSION
|
|
64
|
-
};
|