@pocket-tools/tracing 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-semantic-release.log +66 -177
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +288 -1395
- package/dist/index.mjs +281 -1391
- package/package.json +23 -19
package/dist/index.mjs
CHANGED
|
@@ -1,39 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/platform/node/index.js
|
|
15
|
-
var init_node = __esm({
|
|
16
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/platform/node/index.js"() {
|
|
17
|
-
init_globalThis();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
1
|
+
// src/tracing.ts
|
|
2
|
+
import process from "process";
|
|
3
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
4
|
+
import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql";
|
|
5
|
+
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
|
|
6
|
+
import { AWSXRayIdGenerator } from "@opentelemetry/id-generator-aws-xray";
|
|
7
|
+
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
|
|
8
|
+
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
9
|
+
import { DataloaderInstrumentation } from "@opentelemetry/instrumentation-dataloader";
|
|
20
10
|
|
|
21
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
22
|
-
var
|
|
23
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/platform/index.js"() {
|
|
24
|
-
init_node();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
11
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
|
12
|
+
var _globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
27
13
|
|
|
28
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
29
|
-
var VERSION;
|
|
30
|
-
var init_version = __esm({
|
|
31
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/version.js"() {
|
|
32
|
-
VERSION = "1.8.0";
|
|
33
|
-
}
|
|
34
|
-
});
|
|
14
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/version.js
|
|
15
|
+
var VERSION = "1.4.1";
|
|
35
16
|
|
|
36
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
17
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
18
|
+
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
37
19
|
function _makeCompatibilityCheck(ownVersion) {
|
|
38
20
|
var acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
39
21
|
var rejectedVersions = /* @__PURE__ */ new Set();
|
|
@@ -97,22 +79,18 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
97
79
|
return _reject(globalVersion);
|
|
98
80
|
};
|
|
99
81
|
}
|
|
100
|
-
var
|
|
101
|
-
var init_semver = __esm({
|
|
102
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js"() {
|
|
103
|
-
init_version();
|
|
104
|
-
re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
105
|
-
isCompatible = _makeCompatibilityCheck(VERSION);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
82
|
+
var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
108
83
|
|
|
109
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
84
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
85
|
+
var major = VERSION.split(".")[0];
|
|
86
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
87
|
+
var _global = _globalThis;
|
|
110
88
|
function registerGlobal(type, instance, diag2, allowOverride) {
|
|
111
|
-
var
|
|
89
|
+
var _a;
|
|
112
90
|
if (allowOverride === void 0) {
|
|
113
91
|
allowOverride = false;
|
|
114
92
|
}
|
|
115
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
93
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
116
94
|
version: VERSION
|
|
117
95
|
};
|
|
118
96
|
if (!allowOverride && api[type]) {
|
|
@@ -130,8 +108,8 @@ function registerGlobal(type, instance, diag2, allowOverride) {
|
|
|
130
108
|
return true;
|
|
131
109
|
}
|
|
132
110
|
function getGlobal(type) {
|
|
133
|
-
var
|
|
134
|
-
var globalVersion = (
|
|
111
|
+
var _a, _b;
|
|
112
|
+
var globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
|
|
135
113
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
136
114
|
return;
|
|
137
115
|
}
|
|
@@ -144,19 +122,84 @@ function unregisterGlobal(type, diag2) {
|
|
|
144
122
|
delete api[type];
|
|
145
123
|
}
|
|
146
124
|
}
|
|
147
|
-
var major, GLOBAL_OPENTELEMETRY_API_KEY, _global;
|
|
148
|
-
var init_global_utils = __esm({
|
|
149
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"() {
|
|
150
|
-
init_platform();
|
|
151
|
-
init_version();
|
|
152
|
-
init_semver();
|
|
153
|
-
major = VERSION.split(".")[0];
|
|
154
|
-
GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
155
|
-
_global = _globalThis;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
125
|
|
|
159
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
126
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
127
|
+
var __read = function(o, n) {
|
|
128
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
129
|
+
if (!m)
|
|
130
|
+
return o;
|
|
131
|
+
var i = m.call(o), r, ar = [], e;
|
|
132
|
+
try {
|
|
133
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
134
|
+
ar.push(r.value);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
e = { error };
|
|
137
|
+
} finally {
|
|
138
|
+
try {
|
|
139
|
+
if (r && !r.done && (m = i["return"]))
|
|
140
|
+
m.call(i);
|
|
141
|
+
} finally {
|
|
142
|
+
if (e)
|
|
143
|
+
throw e.error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return ar;
|
|
147
|
+
};
|
|
148
|
+
var __spreadArray = function(to, from, pack) {
|
|
149
|
+
if (pack || arguments.length === 2)
|
|
150
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
151
|
+
if (ar || !(i in from)) {
|
|
152
|
+
if (!ar)
|
|
153
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
154
|
+
ar[i] = from[i];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
158
|
+
};
|
|
159
|
+
var DiagComponentLogger = (
|
|
160
|
+
/** @class */
|
|
161
|
+
function() {
|
|
162
|
+
function DiagComponentLogger2(props) {
|
|
163
|
+
this._namespace = props.namespace || "DiagComponentLogger";
|
|
164
|
+
}
|
|
165
|
+
DiagComponentLogger2.prototype.debug = function() {
|
|
166
|
+
var args = [];
|
|
167
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
168
|
+
args[_i] = arguments[_i];
|
|
169
|
+
}
|
|
170
|
+
return logProxy("debug", this._namespace, args);
|
|
171
|
+
};
|
|
172
|
+
DiagComponentLogger2.prototype.error = function() {
|
|
173
|
+
var args = [];
|
|
174
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
175
|
+
args[_i] = arguments[_i];
|
|
176
|
+
}
|
|
177
|
+
return logProxy("error", this._namespace, args);
|
|
178
|
+
};
|
|
179
|
+
DiagComponentLogger2.prototype.info = function() {
|
|
180
|
+
var args = [];
|
|
181
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
182
|
+
args[_i] = arguments[_i];
|
|
183
|
+
}
|
|
184
|
+
return logProxy("info", this._namespace, args);
|
|
185
|
+
};
|
|
186
|
+
DiagComponentLogger2.prototype.warn = function() {
|
|
187
|
+
var args = [];
|
|
188
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
189
|
+
args[_i] = arguments[_i];
|
|
190
|
+
}
|
|
191
|
+
return logProxy("warn", this._namespace, args);
|
|
192
|
+
};
|
|
193
|
+
DiagComponentLogger2.prototype.verbose = function() {
|
|
194
|
+
var args = [];
|
|
195
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
196
|
+
args[_i] = arguments[_i];
|
|
197
|
+
}
|
|
198
|
+
return logProxy("verbose", this._namespace, args);
|
|
199
|
+
};
|
|
200
|
+
return DiagComponentLogger2;
|
|
201
|
+
}()
|
|
202
|
+
);
|
|
160
203
|
function logProxy(funcName, namespace, args) {
|
|
161
204
|
var logger = getGlobal("diag");
|
|
162
205
|
if (!logger) {
|
|
@@ -165,104 +208,20 @@ function logProxy(funcName, namespace, args) {
|
|
|
165
208
|
args.unshift(namespace);
|
|
166
209
|
return logger[funcName].apply(logger, __spreadArray([], __read(args), false));
|
|
167
210
|
}
|
|
168
|
-
var __read, __spreadArray, DiagComponentLogger;
|
|
169
|
-
var init_ComponentLogger = __esm({
|
|
170
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"() {
|
|
171
|
-
init_global_utils();
|
|
172
|
-
__read = function(o, n) {
|
|
173
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
174
|
-
if (!m)
|
|
175
|
-
return o;
|
|
176
|
-
var i = m.call(o), r, ar = [], e;
|
|
177
|
-
try {
|
|
178
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
179
|
-
ar.push(r.value);
|
|
180
|
-
} catch (error) {
|
|
181
|
-
e = { error };
|
|
182
|
-
} finally {
|
|
183
|
-
try {
|
|
184
|
-
if (r && !r.done && (m = i["return"]))
|
|
185
|
-
m.call(i);
|
|
186
|
-
} finally {
|
|
187
|
-
if (e)
|
|
188
|
-
throw e.error;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return ar;
|
|
192
|
-
};
|
|
193
|
-
__spreadArray = function(to, from, pack) {
|
|
194
|
-
if (pack || arguments.length === 2)
|
|
195
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
196
|
-
if (ar || !(i in from)) {
|
|
197
|
-
if (!ar)
|
|
198
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
199
|
-
ar[i] = from[i];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
203
|
-
};
|
|
204
|
-
DiagComponentLogger = /** @class */
|
|
205
|
-
function() {
|
|
206
|
-
function DiagComponentLogger2(props) {
|
|
207
|
-
this._namespace = props.namespace || "DiagComponentLogger";
|
|
208
|
-
}
|
|
209
|
-
DiagComponentLogger2.prototype.debug = function() {
|
|
210
|
-
var args = [];
|
|
211
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
212
|
-
args[_i] = arguments[_i];
|
|
213
|
-
}
|
|
214
|
-
return logProxy("debug", this._namespace, args);
|
|
215
|
-
};
|
|
216
|
-
DiagComponentLogger2.prototype.error = function() {
|
|
217
|
-
var args = [];
|
|
218
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
219
|
-
args[_i] = arguments[_i];
|
|
220
|
-
}
|
|
221
|
-
return logProxy("error", this._namespace, args);
|
|
222
|
-
};
|
|
223
|
-
DiagComponentLogger2.prototype.info = function() {
|
|
224
|
-
var args = [];
|
|
225
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
226
|
-
args[_i] = arguments[_i];
|
|
227
|
-
}
|
|
228
|
-
return logProxy("info", this._namespace, args);
|
|
229
|
-
};
|
|
230
|
-
DiagComponentLogger2.prototype.warn = function() {
|
|
231
|
-
var args = [];
|
|
232
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
233
|
-
args[_i] = arguments[_i];
|
|
234
|
-
}
|
|
235
|
-
return logProxy("warn", this._namespace, args);
|
|
236
|
-
};
|
|
237
|
-
DiagComponentLogger2.prototype.verbose = function() {
|
|
238
|
-
var args = [];
|
|
239
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
240
|
-
args[_i] = arguments[_i];
|
|
241
|
-
}
|
|
242
|
-
return logProxy("verbose", this._namespace, args);
|
|
243
|
-
};
|
|
244
|
-
return DiagComponentLogger2;
|
|
245
|
-
}();
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
211
|
|
|
249
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
212
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
250
213
|
var DiagLogLevel;
|
|
251
|
-
|
|
252
|
-
"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
214
|
+
(function(DiagLogLevel2) {
|
|
215
|
+
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
216
|
+
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
|
217
|
+
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
|
218
|
+
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
|
219
|
+
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
|
220
|
+
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
|
221
|
+
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
222
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
223
|
+
|
|
224
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
266
225
|
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
267
226
|
if (maxLevel < DiagLogLevel.NONE) {
|
|
268
227
|
maxLevel = DiagLogLevel.NONE;
|
|
@@ -286,660 +245,156 @@ function createLogLevelDiagLogger(maxLevel, logger) {
|
|
|
286
245
|
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
287
246
|
};
|
|
288
247
|
}
|
|
289
|
-
var init_logLevelLogger = __esm({
|
|
290
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"() {
|
|
291
|
-
init_types();
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
248
|
|
|
295
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.
|
|
296
|
-
var __read2
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
e
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
249
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
250
|
+
var __read2 = function(o, n) {
|
|
251
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
252
|
+
if (!m)
|
|
253
|
+
return o;
|
|
254
|
+
var i = m.call(o), r, ar = [], e;
|
|
255
|
+
try {
|
|
256
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
257
|
+
ar.push(r.value);
|
|
258
|
+
} catch (error) {
|
|
259
|
+
e = { error };
|
|
260
|
+
} finally {
|
|
261
|
+
try {
|
|
262
|
+
if (r && !r.done && (m = i["return"]))
|
|
263
|
+
m.call(i);
|
|
264
|
+
} finally {
|
|
265
|
+
if (e)
|
|
266
|
+
throw e.error;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return ar;
|
|
270
|
+
};
|
|
271
|
+
var __spreadArray2 = function(to, from, pack) {
|
|
272
|
+
if (pack || arguments.length === 2)
|
|
273
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
274
|
+
if (ar || !(i in from)) {
|
|
275
|
+
if (!ar)
|
|
276
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
277
|
+
ar[i] = from[i];
|
|
321
278
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
API_NAME = "diag";
|
|
336
|
-
DiagAPI = /** @class */
|
|
337
|
-
function() {
|
|
338
|
-
function DiagAPI2() {
|
|
339
|
-
function _logProxy(funcName) {
|
|
340
|
-
return function() {
|
|
341
|
-
var args = [];
|
|
342
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
343
|
-
args[_i] = arguments[_i];
|
|
344
|
-
}
|
|
345
|
-
var logger = getGlobal("diag");
|
|
346
|
-
if (!logger)
|
|
347
|
-
return;
|
|
348
|
-
return logger[funcName].apply(logger, __spreadArray2([], __read2(args), false));
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
var self = this;
|
|
352
|
-
var setLogger = function(logger, optionsOrLogLevel) {
|
|
353
|
-
var _a2, _b, _c;
|
|
354
|
-
if (optionsOrLogLevel === void 0) {
|
|
355
|
-
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
356
|
-
}
|
|
357
|
-
if (logger === self) {
|
|
358
|
-
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
359
|
-
self.error((_a2 = err.stack) !== null && _a2 !== void 0 ? _a2 : err.message);
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
if (typeof optionsOrLogLevel === "number") {
|
|
363
|
-
optionsOrLogLevel = {
|
|
364
|
-
logLevel: optionsOrLogLevel
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
var oldLogger = getGlobal("diag");
|
|
368
|
-
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
369
|
-
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
370
|
-
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
371
|
-
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
372
|
-
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
279
|
+
}
|
|
280
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
281
|
+
};
|
|
282
|
+
var API_NAME = "diag";
|
|
283
|
+
var DiagAPI = (
|
|
284
|
+
/** @class */
|
|
285
|
+
function() {
|
|
286
|
+
function DiagAPI2() {
|
|
287
|
+
function _logProxy(funcName) {
|
|
288
|
+
return function() {
|
|
289
|
+
var args = [];
|
|
290
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
291
|
+
args[_i] = arguments[_i];
|
|
373
292
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
unregisterGlobal(API_NAME, self);
|
|
379
|
-
};
|
|
380
|
-
self.createComponentLogger = function(options) {
|
|
381
|
-
return new DiagComponentLogger(options);
|
|
382
|
-
};
|
|
383
|
-
self.verbose = _logProxy("verbose");
|
|
384
|
-
self.debug = _logProxy("debug");
|
|
385
|
-
self.info = _logProxy("info");
|
|
386
|
-
self.warn = _logProxy("warn");
|
|
387
|
-
self.error = _logProxy("error");
|
|
388
|
-
}
|
|
389
|
-
DiagAPI2.instance = function() {
|
|
390
|
-
if (!this._instance) {
|
|
391
|
-
this._instance = new DiagAPI2();
|
|
392
|
-
}
|
|
393
|
-
return this._instance;
|
|
394
|
-
};
|
|
395
|
-
return DiagAPI2;
|
|
396
|
-
}();
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
401
|
-
function createContextKey(description) {
|
|
402
|
-
return Symbol.for(description);
|
|
403
|
-
}
|
|
404
|
-
var BaseContext, ROOT_CONTEXT;
|
|
405
|
-
var init_context = __esm({
|
|
406
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context/context.js"() {
|
|
407
|
-
BaseContext = /** @class */
|
|
408
|
-
/* @__PURE__ */ function() {
|
|
409
|
-
function BaseContext2(parentContext) {
|
|
410
|
-
var self = this;
|
|
411
|
-
self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
412
|
-
self.getValue = function(key) {
|
|
413
|
-
return self._currentContext.get(key);
|
|
414
|
-
};
|
|
415
|
-
self.setValue = function(key, value) {
|
|
416
|
-
var context2 = new BaseContext2(self._currentContext);
|
|
417
|
-
context2._currentContext.set(key, value);
|
|
418
|
-
return context2;
|
|
419
|
-
};
|
|
420
|
-
self.deleteValue = function(key) {
|
|
421
|
-
var context2 = new BaseContext2(self._currentContext);
|
|
422
|
-
context2._currentContext.delete(key);
|
|
423
|
-
return context2;
|
|
293
|
+
var logger = getGlobal("diag");
|
|
294
|
+
if (!logger)
|
|
295
|
+
return;
|
|
296
|
+
return logger[funcName].apply(logger, __spreadArray2([], __read2(args), false));
|
|
424
297
|
};
|
|
425
298
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js
|
|
433
|
-
var consoleMap, DiagConsoleLogger;
|
|
434
|
-
var init_consoleLogger = __esm({
|
|
435
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js"() {
|
|
436
|
-
consoleMap = [
|
|
437
|
-
{ n: "error", c: "error" },
|
|
438
|
-
{ n: "warn", c: "warn" },
|
|
439
|
-
{ n: "info", c: "info" },
|
|
440
|
-
{ n: "debug", c: "debug" },
|
|
441
|
-
{ n: "verbose", c: "trace" }
|
|
442
|
-
];
|
|
443
|
-
DiagConsoleLogger = /** @class */
|
|
444
|
-
/* @__PURE__ */ function() {
|
|
445
|
-
function DiagConsoleLogger2() {
|
|
446
|
-
function _consoleFunc(funcName) {
|
|
447
|
-
return function() {
|
|
448
|
-
var args = [];
|
|
449
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
450
|
-
args[_i] = arguments[_i];
|
|
451
|
-
}
|
|
452
|
-
if (console) {
|
|
453
|
-
var theFunc = console[funcName];
|
|
454
|
-
if (typeof theFunc !== "function") {
|
|
455
|
-
theFunc = console.log;
|
|
456
|
-
}
|
|
457
|
-
if (typeof theFunc === "function") {
|
|
458
|
-
return theFunc.apply(console, args);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
for (var i = 0; i < consoleMap.length; i++) {
|
|
464
|
-
this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
|
|
299
|
+
var self = this;
|
|
300
|
+
var setLogger = function(logger, optionsOrLogLevel) {
|
|
301
|
+
var _a, _b, _c;
|
|
302
|
+
if (optionsOrLogLevel === void 0) {
|
|
303
|
+
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
465
304
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
473
|
-
var __read3, __spreadArray3, NoopContextManager;
|
|
474
|
-
var init_NoopContextManager = __esm({
|
|
475
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"() {
|
|
476
|
-
init_context();
|
|
477
|
-
__read3 = function(o, n) {
|
|
478
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
479
|
-
if (!m)
|
|
480
|
-
return o;
|
|
481
|
-
var i = m.call(o), r, ar = [], e;
|
|
482
|
-
try {
|
|
483
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
484
|
-
ar.push(r.value);
|
|
485
|
-
} catch (error) {
|
|
486
|
-
e = { error };
|
|
487
|
-
} finally {
|
|
488
|
-
try {
|
|
489
|
-
if (r && !r.done && (m = i["return"]))
|
|
490
|
-
m.call(i);
|
|
491
|
-
} finally {
|
|
492
|
-
if (e)
|
|
493
|
-
throw e.error;
|
|
305
|
+
if (logger === self) {
|
|
306
|
+
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
307
|
+
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
308
|
+
return false;
|
|
494
309
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (pack || arguments.length === 2)
|
|
500
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
501
|
-
if (ar || !(i in from)) {
|
|
502
|
-
if (!ar)
|
|
503
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
504
|
-
ar[i] = from[i];
|
|
505
|
-
}
|
|
310
|
+
if (typeof optionsOrLogLevel === "number") {
|
|
311
|
+
optionsOrLogLevel = {
|
|
312
|
+
logLevel: optionsOrLogLevel
|
|
313
|
+
};
|
|
506
314
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
NoopContextManager2.prototype.active = function() {
|
|
514
|
-
return ROOT_CONTEXT;
|
|
515
|
-
};
|
|
516
|
-
NoopContextManager2.prototype.with = function(_context, fn, thisArg) {
|
|
517
|
-
var args = [];
|
|
518
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
519
|
-
args[_i - 3] = arguments[_i];
|
|
315
|
+
var oldLogger = getGlobal("diag");
|
|
316
|
+
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
317
|
+
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
318
|
+
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
319
|
+
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
320
|
+
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
520
321
|
}
|
|
521
|
-
return
|
|
322
|
+
return registerGlobal("diag", newLogger, self, true);
|
|
522
323
|
};
|
|
523
|
-
|
|
524
|
-
|
|
324
|
+
self.setLogger = setLogger;
|
|
325
|
+
self.disable = function() {
|
|
326
|
+
unregisterGlobal(API_NAME, self);
|
|
525
327
|
};
|
|
526
|
-
|
|
527
|
-
return
|
|
328
|
+
self.createComponentLogger = function(options) {
|
|
329
|
+
return new DiagComponentLogger(options);
|
|
528
330
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
var __read4, __spreadArray4, API_NAME2, NOOP_CONTEXT_MANAGER, ContextAPI;
|
|
539
|
-
var init_context2 = __esm({
|
|
540
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/api/context.js"() {
|
|
541
|
-
init_NoopContextManager();
|
|
542
|
-
init_global_utils();
|
|
543
|
-
init_diag();
|
|
544
|
-
__read4 = function(o, n) {
|
|
545
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
546
|
-
if (!m)
|
|
547
|
-
return o;
|
|
548
|
-
var i = m.call(o), r, ar = [], e;
|
|
549
|
-
try {
|
|
550
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
551
|
-
ar.push(r.value);
|
|
552
|
-
} catch (error) {
|
|
553
|
-
e = { error };
|
|
554
|
-
} finally {
|
|
555
|
-
try {
|
|
556
|
-
if (r && !r.done && (m = i["return"]))
|
|
557
|
-
m.call(i);
|
|
558
|
-
} finally {
|
|
559
|
-
if (e)
|
|
560
|
-
throw e.error;
|
|
561
|
-
}
|
|
331
|
+
self.verbose = _logProxy("verbose");
|
|
332
|
+
self.debug = _logProxy("debug");
|
|
333
|
+
self.info = _logProxy("info");
|
|
334
|
+
self.warn = _logProxy("warn");
|
|
335
|
+
self.error = _logProxy("error");
|
|
336
|
+
}
|
|
337
|
+
DiagAPI2.instance = function() {
|
|
338
|
+
if (!this._instance) {
|
|
339
|
+
this._instance = new DiagAPI2();
|
|
562
340
|
}
|
|
563
|
-
return
|
|
341
|
+
return this._instance;
|
|
564
342
|
};
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (ar || !(i in from)) {
|
|
569
|
-
if (!ar)
|
|
570
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
571
|
-
ar[i] = from[i];
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
575
|
-
};
|
|
576
|
-
API_NAME2 = "context";
|
|
577
|
-
NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
578
|
-
ContextAPI = /** @class */
|
|
579
|
-
function() {
|
|
580
|
-
function ContextAPI2() {
|
|
581
|
-
}
|
|
582
|
-
ContextAPI2.getInstance = function() {
|
|
583
|
-
if (!this._instance) {
|
|
584
|
-
this._instance = new ContextAPI2();
|
|
585
|
-
}
|
|
586
|
-
return this._instance;
|
|
587
|
-
};
|
|
588
|
-
ContextAPI2.prototype.setGlobalContextManager = function(contextManager) {
|
|
589
|
-
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
590
|
-
};
|
|
591
|
-
ContextAPI2.prototype.active = function() {
|
|
592
|
-
return this._getContextManager().active();
|
|
593
|
-
};
|
|
594
|
-
ContextAPI2.prototype.with = function(context2, fn, thisArg) {
|
|
595
|
-
var _a2;
|
|
596
|
-
var args = [];
|
|
597
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
598
|
-
args[_i - 3] = arguments[_i];
|
|
599
|
-
}
|
|
600
|
-
return (_a2 = this._getContextManager()).with.apply(_a2, __spreadArray4([context2, fn, thisArg], __read4(args), false));
|
|
601
|
-
};
|
|
602
|
-
ContextAPI2.prototype.bind = function(context2, target) {
|
|
603
|
-
return this._getContextManager().bind(context2, target);
|
|
604
|
-
};
|
|
605
|
-
ContextAPI2.prototype._getContextManager = function() {
|
|
606
|
-
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
607
|
-
};
|
|
608
|
-
ContextAPI2.prototype.disable = function() {
|
|
609
|
-
this._getContextManager().disable();
|
|
610
|
-
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
611
|
-
};
|
|
612
|
-
return ContextAPI2;
|
|
613
|
-
}();
|
|
614
|
-
}
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
618
|
-
var TraceFlags;
|
|
619
|
-
var init_trace_flags = __esm({
|
|
620
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"() {
|
|
621
|
-
(function(TraceFlags2) {
|
|
622
|
-
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
623
|
-
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
624
|
-
})(TraceFlags || (TraceFlags = {}));
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
629
|
-
var context;
|
|
630
|
-
var init_context_api = __esm({
|
|
631
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/context-api.js"() {
|
|
632
|
-
init_context2();
|
|
633
|
-
context = ContextAPI.getInstance();
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag-api.js
|
|
638
|
-
var diag;
|
|
639
|
-
var init_diag_api = __esm({
|
|
640
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag-api.js"() {
|
|
641
|
-
init_diag();
|
|
642
|
-
diag = DiagAPI.instance();
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/index.js
|
|
647
|
-
var init_esm = __esm({
|
|
648
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/index.js"() {
|
|
649
|
-
init_context();
|
|
650
|
-
init_consoleLogger();
|
|
651
|
-
init_types();
|
|
652
|
-
init_trace_flags();
|
|
653
|
-
init_context_api();
|
|
654
|
-
init_diag_api();
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
|
|
658
|
-
// src/tracing.ts
|
|
659
|
-
import process2 from "process";
|
|
660
|
-
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
661
|
-
import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql";
|
|
662
|
-
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
|
|
663
|
-
import { AWSXRayIdGenerator } from "@opentelemetry/id-generator-aws-xray";
|
|
664
|
-
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
|
|
665
|
-
|
|
666
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
|
|
667
|
-
init_esm();
|
|
668
|
-
var SUPPRESS_TRACING_KEY = createContextKey("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
|
|
669
|
-
function suppressTracing(context2) {
|
|
670
|
-
return context2.setValue(SUPPRESS_TRACING_KEY, true);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js
|
|
674
|
-
init_esm();
|
|
675
|
-
function loggingErrorHandler() {
|
|
676
|
-
return function(ex) {
|
|
677
|
-
diag.error(stringifyException(ex));
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
function stringifyException(ex) {
|
|
681
|
-
if (typeof ex === "string") {
|
|
682
|
-
return ex;
|
|
683
|
-
} else {
|
|
684
|
-
return JSON.stringify(flattenException(ex));
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
function flattenException(ex) {
|
|
688
|
-
var result = {};
|
|
689
|
-
var current = ex;
|
|
690
|
-
while (current !== null) {
|
|
691
|
-
Object.getOwnPropertyNames(current).forEach(function(propertyName) {
|
|
692
|
-
if (result[propertyName])
|
|
693
|
-
return;
|
|
694
|
-
var value = current[propertyName];
|
|
695
|
-
if (value) {
|
|
696
|
-
result[propertyName] = String(value);
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
current = Object.getPrototypeOf(current);
|
|
700
|
-
}
|
|
701
|
-
return result;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js
|
|
705
|
-
var delegateHandler = loggingErrorHandler();
|
|
706
|
-
function globalErrorHandler(ex) {
|
|
707
|
-
try {
|
|
708
|
-
delegateHandler(ex);
|
|
709
|
-
} catch (_a2) {
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/environment.js
|
|
714
|
-
init_esm();
|
|
715
|
-
|
|
716
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/sampling.js
|
|
717
|
-
var TracesSamplerValues;
|
|
718
|
-
(function(TracesSamplerValues2) {
|
|
719
|
-
TracesSamplerValues2["AlwaysOff"] = "always_off";
|
|
720
|
-
TracesSamplerValues2["AlwaysOn"] = "always_on";
|
|
721
|
-
TracesSamplerValues2["ParentBasedAlwaysOff"] = "parentbased_always_off";
|
|
722
|
-
TracesSamplerValues2["ParentBasedAlwaysOn"] = "parentbased_always_on";
|
|
723
|
-
TracesSamplerValues2["ParentBasedTraceIdRatio"] = "parentbased_traceidratio";
|
|
724
|
-
TracesSamplerValues2["TraceIdRatio"] = "traceidratio";
|
|
725
|
-
})(TracesSamplerValues || (TracesSamplerValues = {}));
|
|
343
|
+
return DiagAPI2;
|
|
344
|
+
}()
|
|
345
|
+
);
|
|
726
346
|
|
|
727
|
-
// ../../node_modules/.pnpm/@opentelemetry+
|
|
728
|
-
var
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
"OTEL_BSP_EXPORT_TIMEOUT",
|
|
735
|
-
"OTEL_BSP_MAX_EXPORT_BATCH_SIZE",
|
|
736
|
-
"OTEL_BSP_MAX_QUEUE_SIZE",
|
|
737
|
-
"OTEL_BSP_SCHEDULE_DELAY",
|
|
738
|
-
"OTEL_BLRP_EXPORT_TIMEOUT",
|
|
739
|
-
"OTEL_BLRP_MAX_EXPORT_BATCH_SIZE",
|
|
740
|
-
"OTEL_BLRP_MAX_QUEUE_SIZE",
|
|
741
|
-
"OTEL_BLRP_SCHEDULE_DELAY",
|
|
742
|
-
"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT",
|
|
743
|
-
"OTEL_ATTRIBUTE_COUNT_LIMIT",
|
|
744
|
-
"OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT",
|
|
745
|
-
"OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT",
|
|
746
|
-
"OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT",
|
|
747
|
-
"OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT",
|
|
748
|
-
"OTEL_SPAN_EVENT_COUNT_LIMIT",
|
|
749
|
-
"OTEL_SPAN_LINK_COUNT_LIMIT",
|
|
750
|
-
"OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT",
|
|
751
|
-
"OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT",
|
|
752
|
-
"OTEL_EXPORTER_OTLP_TIMEOUT",
|
|
753
|
-
"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT",
|
|
754
|
-
"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT",
|
|
755
|
-
"OTEL_EXPORTER_OTLP_LOGS_TIMEOUT",
|
|
756
|
-
"OTEL_EXPORTER_JAEGER_AGENT_PORT"
|
|
347
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js
|
|
348
|
+
var consoleMap = [
|
|
349
|
+
{ n: "error", c: "error" },
|
|
350
|
+
{ n: "warn", c: "warn" },
|
|
351
|
+
{ n: "info", c: "info" },
|
|
352
|
+
{ n: "debug", c: "debug" },
|
|
353
|
+
{ n: "verbose", c: "trace" }
|
|
757
354
|
];
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
];
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
var DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity;
|
|
769
|
-
var DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128;
|
|
770
|
-
var DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT = 128;
|
|
771
|
-
var DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT = 128;
|
|
772
|
-
var DEFAULT_ENVIRONMENT = {
|
|
773
|
-
OTEL_SDK_DISABLED: false,
|
|
774
|
-
CONTAINER_NAME: "",
|
|
775
|
-
ECS_CONTAINER_METADATA_URI_V4: "",
|
|
776
|
-
ECS_CONTAINER_METADATA_URI: "",
|
|
777
|
-
HOSTNAME: "",
|
|
778
|
-
KUBERNETES_SERVICE_HOST: "",
|
|
779
|
-
NAMESPACE: "",
|
|
780
|
-
OTEL_BSP_EXPORT_TIMEOUT: 3e4,
|
|
781
|
-
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: 512,
|
|
782
|
-
OTEL_BSP_MAX_QUEUE_SIZE: 2048,
|
|
783
|
-
OTEL_BSP_SCHEDULE_DELAY: 5e3,
|
|
784
|
-
OTEL_BLRP_EXPORT_TIMEOUT: 3e4,
|
|
785
|
-
OTEL_BLRP_MAX_EXPORT_BATCH_SIZE: 512,
|
|
786
|
-
OTEL_BLRP_MAX_QUEUE_SIZE: 2048,
|
|
787
|
-
OTEL_BLRP_SCHEDULE_DELAY: 5e3,
|
|
788
|
-
OTEL_EXPORTER_JAEGER_AGENT_HOST: "",
|
|
789
|
-
OTEL_EXPORTER_JAEGER_AGENT_PORT: 6832,
|
|
790
|
-
OTEL_EXPORTER_JAEGER_ENDPOINT: "",
|
|
791
|
-
OTEL_EXPORTER_JAEGER_PASSWORD: "",
|
|
792
|
-
OTEL_EXPORTER_JAEGER_USER: "",
|
|
793
|
-
OTEL_EXPORTER_OTLP_ENDPOINT: "",
|
|
794
|
-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "",
|
|
795
|
-
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: "",
|
|
796
|
-
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "",
|
|
797
|
-
OTEL_EXPORTER_OTLP_HEADERS: "",
|
|
798
|
-
OTEL_EXPORTER_OTLP_TRACES_HEADERS: "",
|
|
799
|
-
OTEL_EXPORTER_OTLP_METRICS_HEADERS: "",
|
|
800
|
-
OTEL_EXPORTER_OTLP_LOGS_HEADERS: "",
|
|
801
|
-
OTEL_EXPORTER_OTLP_TIMEOUT: 1e4,
|
|
802
|
-
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: 1e4,
|
|
803
|
-
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT: 1e4,
|
|
804
|
-
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: 1e4,
|
|
805
|
-
OTEL_EXPORTER_ZIPKIN_ENDPOINT: "http://localhost:9411/api/v2/spans",
|
|
806
|
-
OTEL_LOG_LEVEL: DiagLogLevel.INFO,
|
|
807
|
-
OTEL_NO_PATCH_MODULES: [],
|
|
808
|
-
OTEL_PROPAGATORS: ["tracecontext", "baggage"],
|
|
809
|
-
OTEL_RESOURCE_ATTRIBUTES: "",
|
|
810
|
-
OTEL_SERVICE_NAME: "",
|
|
811
|
-
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,
|
|
812
|
-
OTEL_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,
|
|
813
|
-
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,
|
|
814
|
-
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,
|
|
815
|
-
OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,
|
|
816
|
-
OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,
|
|
817
|
-
OTEL_SPAN_EVENT_COUNT_LIMIT: 128,
|
|
818
|
-
OTEL_SPAN_LINK_COUNT_LIMIT: 128,
|
|
819
|
-
OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT: DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,
|
|
820
|
-
OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT: DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,
|
|
821
|
-
OTEL_TRACES_EXPORTER: "",
|
|
822
|
-
OTEL_TRACES_SAMPLER: TracesSamplerValues.ParentBasedAlwaysOn,
|
|
823
|
-
OTEL_TRACES_SAMPLER_ARG: "",
|
|
824
|
-
OTEL_LOGS_EXPORTER: "",
|
|
825
|
-
OTEL_EXPORTER_OTLP_INSECURE: "",
|
|
826
|
-
OTEL_EXPORTER_OTLP_TRACES_INSECURE: "",
|
|
827
|
-
OTEL_EXPORTER_OTLP_METRICS_INSECURE: "",
|
|
828
|
-
OTEL_EXPORTER_OTLP_LOGS_INSECURE: "",
|
|
829
|
-
OTEL_EXPORTER_OTLP_CERTIFICATE: "",
|
|
830
|
-
OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE: "",
|
|
831
|
-
OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE: "",
|
|
832
|
-
OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE: "",
|
|
833
|
-
OTEL_EXPORTER_OTLP_COMPRESSION: "",
|
|
834
|
-
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: "",
|
|
835
|
-
OTEL_EXPORTER_OTLP_METRICS_COMPRESSION: "",
|
|
836
|
-
OTEL_EXPORTER_OTLP_LOGS_COMPRESSION: "",
|
|
837
|
-
OTEL_EXPORTER_OTLP_CLIENT_KEY: "",
|
|
838
|
-
OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY: "",
|
|
839
|
-
OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY: "",
|
|
840
|
-
OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY: "",
|
|
841
|
-
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: "",
|
|
842
|
-
OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE: "",
|
|
843
|
-
OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE: "",
|
|
844
|
-
OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE: "",
|
|
845
|
-
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf",
|
|
846
|
-
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: "http/protobuf",
|
|
847
|
-
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: "http/protobuf",
|
|
848
|
-
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: "http/protobuf",
|
|
849
|
-
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: "cumulative"
|
|
850
|
-
};
|
|
851
|
-
function parseBoolean(key, environment, values) {
|
|
852
|
-
if (typeof values[key] === "undefined") {
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
var value = String(values[key]);
|
|
856
|
-
environment[key] = value.toLowerCase() === "true";
|
|
857
|
-
}
|
|
858
|
-
function parseNumber(name, environment, values, min, max) {
|
|
859
|
-
if (min === void 0) {
|
|
860
|
-
min = -Infinity;
|
|
861
|
-
}
|
|
862
|
-
if (max === void 0) {
|
|
863
|
-
max = Infinity;
|
|
864
|
-
}
|
|
865
|
-
if (typeof values[name] !== "undefined") {
|
|
866
|
-
var value = Number(values[name]);
|
|
867
|
-
if (!isNaN(value)) {
|
|
868
|
-
if (value < min) {
|
|
869
|
-
environment[name] = min;
|
|
870
|
-
} else if (value > max) {
|
|
871
|
-
environment[name] = max;
|
|
872
|
-
} else {
|
|
873
|
-
environment[name] = value;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
function parseStringList(name, output, input, separator) {
|
|
879
|
-
if (separator === void 0) {
|
|
880
|
-
separator = DEFAULT_LIST_SEPARATOR;
|
|
881
|
-
}
|
|
882
|
-
var givenValue = input[name];
|
|
883
|
-
if (typeof givenValue === "string") {
|
|
884
|
-
output[name] = givenValue.split(separator).map(function(v) {
|
|
885
|
-
return v.trim();
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
var logLevelMap = {
|
|
890
|
-
ALL: DiagLogLevel.ALL,
|
|
891
|
-
VERBOSE: DiagLogLevel.VERBOSE,
|
|
892
|
-
DEBUG: DiagLogLevel.DEBUG,
|
|
893
|
-
INFO: DiagLogLevel.INFO,
|
|
894
|
-
WARN: DiagLogLevel.WARN,
|
|
895
|
-
ERROR: DiagLogLevel.ERROR,
|
|
896
|
-
NONE: DiagLogLevel.NONE
|
|
897
|
-
};
|
|
898
|
-
function setLogLevelFromEnv(key, environment, values) {
|
|
899
|
-
var value = values[key];
|
|
900
|
-
if (typeof value === "string") {
|
|
901
|
-
var theLevel = logLevelMap[value.toUpperCase()];
|
|
902
|
-
if (theLevel != null) {
|
|
903
|
-
environment[key] = theLevel;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function parseEnvironment(values) {
|
|
908
|
-
var environment = {};
|
|
909
|
-
for (var env in DEFAULT_ENVIRONMENT) {
|
|
910
|
-
var key = env;
|
|
911
|
-
switch (key) {
|
|
912
|
-
case "OTEL_LOG_LEVEL":
|
|
913
|
-
setLogLevelFromEnv(key, environment, values);
|
|
914
|
-
break;
|
|
915
|
-
default:
|
|
916
|
-
if (isEnvVarABoolean(key)) {
|
|
917
|
-
parseBoolean(key, environment, values);
|
|
918
|
-
} else if (isEnvVarANumber(key)) {
|
|
919
|
-
parseNumber(key, environment, values);
|
|
920
|
-
} else if (isEnvVarAList(key)) {
|
|
921
|
-
parseStringList(key, environment, values);
|
|
922
|
-
} else {
|
|
923
|
-
var value = values[key];
|
|
924
|
-
if (typeof value !== "undefined" && value !== null) {
|
|
925
|
-
environment[key] = String(value);
|
|
355
|
+
var DiagConsoleLogger = (
|
|
356
|
+
/** @class */
|
|
357
|
+
/* @__PURE__ */ function() {
|
|
358
|
+
function DiagConsoleLogger2() {
|
|
359
|
+
function _consoleFunc(funcName) {
|
|
360
|
+
return function() {
|
|
361
|
+
var args = [];
|
|
362
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
363
|
+
args[_i] = arguments[_i];
|
|
926
364
|
}
|
|
927
|
-
|
|
365
|
+
if (console) {
|
|
366
|
+
var theFunc = console[funcName];
|
|
367
|
+
if (typeof theFunc !== "function") {
|
|
368
|
+
theFunc = console.log;
|
|
369
|
+
}
|
|
370
|
+
if (typeof theFunc === "function") {
|
|
371
|
+
return theFunc.apply(console, args);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
for (var i = 0; i < consoleMap.length; i++) {
|
|
377
|
+
this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
|
|
378
|
+
}
|
|
928
379
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
380
|
+
return DiagConsoleLogger2;
|
|
381
|
+
}()
|
|
382
|
+
);
|
|
932
383
|
|
|
933
|
-
// ../../node_modules/.pnpm/@opentelemetry+
|
|
934
|
-
|
|
935
|
-
var processEnv = parseEnvironment(process.env);
|
|
936
|
-
return Object.assign({}, DEFAULT_ENVIRONMENT, processEnv);
|
|
937
|
-
}
|
|
384
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag-api.js
|
|
385
|
+
var diag = DiagAPI.instance();
|
|
938
386
|
|
|
939
|
-
//
|
|
940
|
-
|
|
387
|
+
// src/tracing.ts
|
|
388
|
+
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
389
|
+
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
390
|
+
import { KnexInstrumentation } from "@opentelemetry/instrumentation-knex";
|
|
391
|
+
import { MySQL2Instrumentation } from "@opentelemetry/instrumentation-mysql2";
|
|
392
|
+
import { NetInstrumentation } from "@opentelemetry/instrumentation-net";
|
|
393
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
394
|
+
import { PrismaInstrumentation } from "@prisma/instrumentation";
|
|
395
|
+
import { Resource } from "@opentelemetry/resources";
|
|
941
396
|
|
|
942
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
397
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.24.0/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js
|
|
943
398
|
// @__NO_SIDE_EFFECTS__
|
|
944
399
|
function createConstMap(values) {
|
|
945
400
|
var res = {};
|
|
@@ -953,7 +408,7 @@ function createConstMap(values) {
|
|
|
953
408
|
return res;
|
|
954
409
|
}
|
|
955
410
|
|
|
956
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
411
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.24.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js
|
|
957
412
|
var TMP_CLOUD_PROVIDER = "cloud.provider";
|
|
958
413
|
var TMP_CLOUD_ACCOUNT_ID = "cloud.account.id";
|
|
959
414
|
var TMP_CLOUD_REGION = "cloud.region";
|
|
@@ -1118,593 +573,22 @@ var SemanticResourceAttributes = /* @__PURE__ */ createConstMap([
|
|
|
1118
573
|
TMP_WEBENGINE_VERSION,
|
|
1119
574
|
TMP_WEBENGINE_DESCRIPTION
|
|
1120
575
|
]);
|
|
1121
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_CPP = "cpp";
|
|
1122
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET = "dotnet";
|
|
1123
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG = "erlang";
|
|
1124
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_GO = "go";
|
|
1125
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA = "java";
|
|
1126
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS = "nodejs";
|
|
1127
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_PHP = "php";
|
|
1128
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON = "python";
|
|
1129
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY = "ruby";
|
|
1130
|
-
var TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS = "webjs";
|
|
1131
|
-
var TelemetrySdkLanguageValues = /* @__PURE__ */ createConstMap([
|
|
1132
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_CPP,
|
|
1133
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET,
|
|
1134
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG,
|
|
1135
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_GO,
|
|
1136
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA,
|
|
1137
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS,
|
|
1138
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_PHP,
|
|
1139
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON,
|
|
1140
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY,
|
|
1141
|
-
TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS
|
|
1142
|
-
]);
|
|
1143
|
-
|
|
1144
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js
|
|
1145
|
-
var _a;
|
|
1146
|
-
var SDK_INFO = (_a = {}, _a[SemanticResourceAttributes.TELEMETRY_SDK_NAME] = "opentelemetry", _a[SemanticResourceAttributes.PROCESS_RUNTIME_NAME] = "node", _a[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE] = TelemetrySdkLanguageValues.NODEJS, _a[SemanticResourceAttributes.TELEMETRY_SDK_VERSION] = VERSION2, _a);
|
|
1147
|
-
|
|
1148
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/platform/node/timer-util.js
|
|
1149
|
-
function unrefTimer(timer) {
|
|
1150
|
-
timer.unref();
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/ExportResult.js
|
|
1154
|
-
var ExportResultCode;
|
|
1155
|
-
(function(ExportResultCode2) {
|
|
1156
|
-
ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
|
|
1157
|
-
ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
|
|
1158
|
-
})(ExportResultCode || (ExportResultCode = {}));
|
|
1159
|
-
|
|
1160
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/promise.js
|
|
1161
|
-
var Deferred = (
|
|
1162
|
-
/** @class */
|
|
1163
|
-
function() {
|
|
1164
|
-
function Deferred2() {
|
|
1165
|
-
var _this = this;
|
|
1166
|
-
this._promise = new Promise(function(resolve, reject) {
|
|
1167
|
-
_this._resolve = resolve;
|
|
1168
|
-
_this._reject = reject;
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
Object.defineProperty(Deferred2.prototype, "promise", {
|
|
1172
|
-
get: function() {
|
|
1173
|
-
return this._promise;
|
|
1174
|
-
},
|
|
1175
|
-
enumerable: false,
|
|
1176
|
-
configurable: true
|
|
1177
|
-
});
|
|
1178
|
-
Deferred2.prototype.resolve = function(val) {
|
|
1179
|
-
this._resolve(val);
|
|
1180
|
-
};
|
|
1181
|
-
Deferred2.prototype.reject = function(err) {
|
|
1182
|
-
this._reject(err);
|
|
1183
|
-
};
|
|
1184
|
-
return Deferred2;
|
|
1185
|
-
}()
|
|
1186
|
-
);
|
|
1187
|
-
|
|
1188
|
-
// ../../node_modules/.pnpm/@opentelemetry+core@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/callback.js
|
|
1189
|
-
var __read5 = function(o, n) {
|
|
1190
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1191
|
-
if (!m)
|
|
1192
|
-
return o;
|
|
1193
|
-
var i = m.call(o), r, ar = [], e;
|
|
1194
|
-
try {
|
|
1195
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
1196
|
-
ar.push(r.value);
|
|
1197
|
-
} catch (error) {
|
|
1198
|
-
e = { error };
|
|
1199
|
-
} finally {
|
|
1200
|
-
try {
|
|
1201
|
-
if (r && !r.done && (m = i["return"]))
|
|
1202
|
-
m.call(i);
|
|
1203
|
-
} finally {
|
|
1204
|
-
if (e)
|
|
1205
|
-
throw e.error;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
return ar;
|
|
1209
|
-
};
|
|
1210
|
-
var __spreadArray5 = function(to, from, pack) {
|
|
1211
|
-
if (pack || arguments.length === 2)
|
|
1212
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1213
|
-
if (ar || !(i in from)) {
|
|
1214
|
-
if (!ar)
|
|
1215
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
1216
|
-
ar[i] = from[i];
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1220
|
-
};
|
|
1221
|
-
var BindOnceFuture = (
|
|
1222
|
-
/** @class */
|
|
1223
|
-
function() {
|
|
1224
|
-
function BindOnceFuture2(_callback, _that) {
|
|
1225
|
-
this._callback = _callback;
|
|
1226
|
-
this._that = _that;
|
|
1227
|
-
this._isCalled = false;
|
|
1228
|
-
this._deferred = new Deferred();
|
|
1229
|
-
}
|
|
1230
|
-
Object.defineProperty(BindOnceFuture2.prototype, "isCalled", {
|
|
1231
|
-
get: function() {
|
|
1232
|
-
return this._isCalled;
|
|
1233
|
-
},
|
|
1234
|
-
enumerable: false,
|
|
1235
|
-
configurable: true
|
|
1236
|
-
});
|
|
1237
|
-
Object.defineProperty(BindOnceFuture2.prototype, "promise", {
|
|
1238
|
-
get: function() {
|
|
1239
|
-
return this._deferred.promise;
|
|
1240
|
-
},
|
|
1241
|
-
enumerable: false,
|
|
1242
|
-
configurable: true
|
|
1243
|
-
});
|
|
1244
|
-
BindOnceFuture2.prototype.call = function() {
|
|
1245
|
-
var _a2;
|
|
1246
|
-
var _this = this;
|
|
1247
|
-
var args = [];
|
|
1248
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1249
|
-
args[_i] = arguments[_i];
|
|
1250
|
-
}
|
|
1251
|
-
if (!this._isCalled) {
|
|
1252
|
-
this._isCalled = true;
|
|
1253
|
-
try {
|
|
1254
|
-
Promise.resolve((_a2 = this._callback).call.apply(_a2, __spreadArray5([this._that], __read5(args), false))).then(function(val) {
|
|
1255
|
-
return _this._deferred.resolve(val);
|
|
1256
|
-
}, function(err) {
|
|
1257
|
-
return _this._deferred.reject(err);
|
|
1258
|
-
});
|
|
1259
|
-
} catch (err) {
|
|
1260
|
-
this._deferred.reject(err);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
return this._deferred.promise;
|
|
1264
|
-
};
|
|
1265
|
-
return BindOnceFuture2;
|
|
1266
|
-
}()
|
|
1267
|
-
);
|
|
1268
|
-
|
|
1269
|
-
// ../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js
|
|
1270
|
-
init_esm();
|
|
1271
|
-
var BatchSpanProcessorBase = (
|
|
1272
|
-
/** @class */
|
|
1273
|
-
function() {
|
|
1274
|
-
function BatchSpanProcessorBase2(_exporter, config) {
|
|
1275
|
-
this._exporter = _exporter;
|
|
1276
|
-
this._isExporting = false;
|
|
1277
|
-
this._finishedSpans = [];
|
|
1278
|
-
this._droppedSpansCount = 0;
|
|
1279
|
-
var env = getEnv();
|
|
1280
|
-
this._maxExportBatchSize = typeof (config === null || config === void 0 ? void 0 : config.maxExportBatchSize) === "number" ? config.maxExportBatchSize : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE;
|
|
1281
|
-
this._maxQueueSize = typeof (config === null || config === void 0 ? void 0 : config.maxQueueSize) === "number" ? config.maxQueueSize : env.OTEL_BSP_MAX_QUEUE_SIZE;
|
|
1282
|
-
this._scheduledDelayMillis = typeof (config === null || config === void 0 ? void 0 : config.scheduledDelayMillis) === "number" ? config.scheduledDelayMillis : env.OTEL_BSP_SCHEDULE_DELAY;
|
|
1283
|
-
this._exportTimeoutMillis = typeof (config === null || config === void 0 ? void 0 : config.exportTimeoutMillis) === "number" ? config.exportTimeoutMillis : env.OTEL_BSP_EXPORT_TIMEOUT;
|
|
1284
|
-
this._shutdownOnce = new BindOnceFuture(this._shutdown, this);
|
|
1285
|
-
if (this._maxExportBatchSize > this._maxQueueSize) {
|
|
1286
|
-
diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize");
|
|
1287
|
-
this._maxExportBatchSize = this._maxQueueSize;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
BatchSpanProcessorBase2.prototype.forceFlush = function() {
|
|
1291
|
-
if (this._shutdownOnce.isCalled) {
|
|
1292
|
-
return this._shutdownOnce.promise;
|
|
1293
|
-
}
|
|
1294
|
-
return this._flushAll();
|
|
1295
|
-
};
|
|
1296
|
-
BatchSpanProcessorBase2.prototype.onStart = function(_span, _parentContext) {
|
|
1297
|
-
};
|
|
1298
|
-
BatchSpanProcessorBase2.prototype.onEnd = function(span) {
|
|
1299
|
-
if (this._shutdownOnce.isCalled) {
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {
|
|
1303
|
-
return;
|
|
1304
|
-
}
|
|
1305
|
-
this._addToBuffer(span);
|
|
1306
|
-
};
|
|
1307
|
-
BatchSpanProcessorBase2.prototype.shutdown = function() {
|
|
1308
|
-
return this._shutdownOnce.call();
|
|
1309
|
-
};
|
|
1310
|
-
BatchSpanProcessorBase2.prototype._shutdown = function() {
|
|
1311
|
-
var _this = this;
|
|
1312
|
-
return Promise.resolve().then(function() {
|
|
1313
|
-
return _this.onShutdown();
|
|
1314
|
-
}).then(function() {
|
|
1315
|
-
return _this._flushAll();
|
|
1316
|
-
}).then(function() {
|
|
1317
|
-
return _this._exporter.shutdown();
|
|
1318
|
-
});
|
|
1319
|
-
};
|
|
1320
|
-
BatchSpanProcessorBase2.prototype._addToBuffer = function(span) {
|
|
1321
|
-
if (this._finishedSpans.length >= this._maxQueueSize) {
|
|
1322
|
-
if (this._droppedSpansCount === 0) {
|
|
1323
|
-
diag.debug("maxQueueSize reached, dropping spans");
|
|
1324
|
-
}
|
|
1325
|
-
this._droppedSpansCount++;
|
|
1326
|
-
return;
|
|
1327
|
-
}
|
|
1328
|
-
if (this._droppedSpansCount > 0) {
|
|
1329
|
-
diag.warn("Dropped " + this._droppedSpansCount + " spans because maxQueueSize reached");
|
|
1330
|
-
this._droppedSpansCount = 0;
|
|
1331
|
-
}
|
|
1332
|
-
this._finishedSpans.push(span);
|
|
1333
|
-
this._maybeStartTimer();
|
|
1334
|
-
};
|
|
1335
|
-
BatchSpanProcessorBase2.prototype._flushAll = function() {
|
|
1336
|
-
var _this = this;
|
|
1337
|
-
return new Promise(function(resolve, reject) {
|
|
1338
|
-
var promises = [];
|
|
1339
|
-
var count = Math.ceil(_this._finishedSpans.length / _this._maxExportBatchSize);
|
|
1340
|
-
for (var i = 0, j = count; i < j; i++) {
|
|
1341
|
-
promises.push(_this._flushOneBatch());
|
|
1342
|
-
}
|
|
1343
|
-
Promise.all(promises).then(function() {
|
|
1344
|
-
resolve();
|
|
1345
|
-
}).catch(reject);
|
|
1346
|
-
});
|
|
1347
|
-
};
|
|
1348
|
-
BatchSpanProcessorBase2.prototype._flushOneBatch = function() {
|
|
1349
|
-
var _this = this;
|
|
1350
|
-
this._clearTimer();
|
|
1351
|
-
if (this._finishedSpans.length === 0) {
|
|
1352
|
-
return Promise.resolve();
|
|
1353
|
-
}
|
|
1354
|
-
return new Promise(function(resolve, reject) {
|
|
1355
|
-
var timer = setTimeout(function() {
|
|
1356
|
-
reject(new Error("Timeout"));
|
|
1357
|
-
}, _this._exportTimeoutMillis);
|
|
1358
|
-
context.with(suppressTracing(context.active()), function() {
|
|
1359
|
-
var spans;
|
|
1360
|
-
if (_this._finishedSpans.length <= _this._maxExportBatchSize) {
|
|
1361
|
-
spans = _this._finishedSpans;
|
|
1362
|
-
_this._finishedSpans = [];
|
|
1363
|
-
} else {
|
|
1364
|
-
spans = _this._finishedSpans.splice(0, _this._maxExportBatchSize);
|
|
1365
|
-
}
|
|
1366
|
-
var doExport = function() {
|
|
1367
|
-
return _this._exporter.export(spans, function(result) {
|
|
1368
|
-
var _a2;
|
|
1369
|
-
clearTimeout(timer);
|
|
1370
|
-
if (result.code === ExportResultCode.SUCCESS) {
|
|
1371
|
-
resolve();
|
|
1372
|
-
} else {
|
|
1373
|
-
reject((_a2 = result.error) !== null && _a2 !== void 0 ? _a2 : new Error("BatchSpanProcessor: span export failed"));
|
|
1374
|
-
}
|
|
1375
|
-
});
|
|
1376
|
-
};
|
|
1377
|
-
var pendingResources = null;
|
|
1378
|
-
for (var i = 0, len = spans.length; i < len; i++) {
|
|
1379
|
-
var span = spans[i];
|
|
1380
|
-
if (span.resource.asyncAttributesPending && span.resource.waitForAsyncAttributes) {
|
|
1381
|
-
pendingResources !== null && pendingResources !== void 0 ? pendingResources : pendingResources = [];
|
|
1382
|
-
pendingResources.push(span.resource.waitForAsyncAttributes());
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
if (pendingResources === null) {
|
|
1386
|
-
doExport();
|
|
1387
|
-
} else {
|
|
1388
|
-
Promise.all(pendingResources).then(doExport, function(err) {
|
|
1389
|
-
globalErrorHandler(err);
|
|
1390
|
-
reject(err);
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
});
|
|
1394
|
-
});
|
|
1395
|
-
};
|
|
1396
|
-
BatchSpanProcessorBase2.prototype._maybeStartTimer = function() {
|
|
1397
|
-
var _this = this;
|
|
1398
|
-
if (this._isExporting)
|
|
1399
|
-
return;
|
|
1400
|
-
var flush = function() {
|
|
1401
|
-
_this._isExporting = true;
|
|
1402
|
-
_this._flushOneBatch().finally(function() {
|
|
1403
|
-
_this._isExporting = false;
|
|
1404
|
-
if (_this._finishedSpans.length > 0) {
|
|
1405
|
-
_this._clearTimer();
|
|
1406
|
-
_this._maybeStartTimer();
|
|
1407
|
-
}
|
|
1408
|
-
}).catch(function(e) {
|
|
1409
|
-
_this._isExporting = false;
|
|
1410
|
-
globalErrorHandler(e);
|
|
1411
|
-
});
|
|
1412
|
-
};
|
|
1413
|
-
if (this._finishedSpans.length >= this._maxExportBatchSize) {
|
|
1414
|
-
return flush();
|
|
1415
|
-
}
|
|
1416
|
-
if (this._timer !== void 0)
|
|
1417
|
-
return;
|
|
1418
|
-
this._timer = setTimeout(function() {
|
|
1419
|
-
return flush();
|
|
1420
|
-
}, this._scheduledDelayMillis);
|
|
1421
|
-
unrefTimer(this._timer);
|
|
1422
|
-
};
|
|
1423
|
-
BatchSpanProcessorBase2.prototype._clearTimer = function() {
|
|
1424
|
-
if (this._timer !== void 0) {
|
|
1425
|
-
clearTimeout(this._timer);
|
|
1426
|
-
this._timer = void 0;
|
|
1427
|
-
}
|
|
1428
|
-
};
|
|
1429
|
-
return BatchSpanProcessorBase2;
|
|
1430
|
-
}()
|
|
1431
|
-
);
|
|
1432
|
-
|
|
1433
|
-
// ../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/node/export/BatchSpanProcessor.js
|
|
1434
|
-
var __extends = /* @__PURE__ */ function() {
|
|
1435
|
-
var extendStatics = function(d, b) {
|
|
1436
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
1437
|
-
d2.__proto__ = b2;
|
|
1438
|
-
} || function(d2, b2) {
|
|
1439
|
-
for (var p in b2)
|
|
1440
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
1441
|
-
d2[p] = b2[p];
|
|
1442
|
-
};
|
|
1443
|
-
return extendStatics(d, b);
|
|
1444
|
-
};
|
|
1445
|
-
return function(d, b) {
|
|
1446
|
-
if (typeof b !== "function" && b !== null)
|
|
1447
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1448
|
-
extendStatics(d, b);
|
|
1449
|
-
function __() {
|
|
1450
|
-
this.constructor = d;
|
|
1451
|
-
}
|
|
1452
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1453
|
-
};
|
|
1454
|
-
}();
|
|
1455
|
-
var BatchSpanProcessor = (
|
|
1456
|
-
/** @class */
|
|
1457
|
-
function(_super) {
|
|
1458
|
-
__extends(BatchSpanProcessor2, _super);
|
|
1459
|
-
function BatchSpanProcessor2() {
|
|
1460
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1461
|
-
}
|
|
1462
|
-
BatchSpanProcessor2.prototype.onShutdown = function() {
|
|
1463
|
-
};
|
|
1464
|
-
return BatchSpanProcessor2;
|
|
1465
|
-
}(BatchSpanProcessorBase)
|
|
1466
|
-
);
|
|
1467
|
-
|
|
1468
|
-
// ../../node_modules/.pnpm/@opentelemetry+resources@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/Resource.js
|
|
1469
|
-
init_esm();
|
|
1470
|
-
|
|
1471
|
-
// ../../node_modules/.pnpm/@opentelemetry+resources@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/platform/node/default-service-name.js
|
|
1472
|
-
function defaultServiceName() {
|
|
1473
|
-
return "unknown_service:" + process.argv0;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
// ../../node_modules/.pnpm/@opentelemetry+resources@1.23.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/Resource.js
|
|
1477
|
-
var __assign = function() {
|
|
1478
|
-
__assign = Object.assign || function(t) {
|
|
1479
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1480
|
-
s = arguments[i];
|
|
1481
|
-
for (var p in s)
|
|
1482
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1483
|
-
t[p] = s[p];
|
|
1484
|
-
}
|
|
1485
|
-
return t;
|
|
1486
|
-
};
|
|
1487
|
-
return __assign.apply(this, arguments);
|
|
1488
|
-
};
|
|
1489
|
-
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
1490
|
-
function adopt(value) {
|
|
1491
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1492
|
-
resolve(value);
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1496
|
-
function fulfilled(value) {
|
|
1497
|
-
try {
|
|
1498
|
-
step(generator.next(value));
|
|
1499
|
-
} catch (e) {
|
|
1500
|
-
reject(e);
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
function rejected(value) {
|
|
1504
|
-
try {
|
|
1505
|
-
step(generator["throw"](value));
|
|
1506
|
-
} catch (e) {
|
|
1507
|
-
reject(e);
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
function step(result) {
|
|
1511
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1512
|
-
}
|
|
1513
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1514
|
-
});
|
|
1515
|
-
};
|
|
1516
|
-
var __generator = function(thisArg, body) {
|
|
1517
|
-
var _ = { label: 0, sent: function() {
|
|
1518
|
-
if (t[0] & 1)
|
|
1519
|
-
throw t[1];
|
|
1520
|
-
return t[1];
|
|
1521
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
1522
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1523
|
-
return this;
|
|
1524
|
-
}), g;
|
|
1525
|
-
function verb(n) {
|
|
1526
|
-
return function(v) {
|
|
1527
|
-
return step([n, v]);
|
|
1528
|
-
};
|
|
1529
|
-
}
|
|
1530
|
-
function step(op) {
|
|
1531
|
-
if (f)
|
|
1532
|
-
throw new TypeError("Generator is already executing.");
|
|
1533
|
-
while (_)
|
|
1534
|
-
try {
|
|
1535
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
1536
|
-
return t;
|
|
1537
|
-
if (y = 0, t)
|
|
1538
|
-
op = [op[0] & 2, t.value];
|
|
1539
|
-
switch (op[0]) {
|
|
1540
|
-
case 0:
|
|
1541
|
-
case 1:
|
|
1542
|
-
t = op;
|
|
1543
|
-
break;
|
|
1544
|
-
case 4:
|
|
1545
|
-
_.label++;
|
|
1546
|
-
return { value: op[1], done: false };
|
|
1547
|
-
case 5:
|
|
1548
|
-
_.label++;
|
|
1549
|
-
y = op[1];
|
|
1550
|
-
op = [0];
|
|
1551
|
-
continue;
|
|
1552
|
-
case 7:
|
|
1553
|
-
op = _.ops.pop();
|
|
1554
|
-
_.trys.pop();
|
|
1555
|
-
continue;
|
|
1556
|
-
default:
|
|
1557
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1558
|
-
_ = 0;
|
|
1559
|
-
continue;
|
|
1560
|
-
}
|
|
1561
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1562
|
-
_.label = op[1];
|
|
1563
|
-
break;
|
|
1564
|
-
}
|
|
1565
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1566
|
-
_.label = t[1];
|
|
1567
|
-
t = op;
|
|
1568
|
-
break;
|
|
1569
|
-
}
|
|
1570
|
-
if (t && _.label < t[2]) {
|
|
1571
|
-
_.label = t[2];
|
|
1572
|
-
_.ops.push(op);
|
|
1573
|
-
break;
|
|
1574
|
-
}
|
|
1575
|
-
if (t[2])
|
|
1576
|
-
_.ops.pop();
|
|
1577
|
-
_.trys.pop();
|
|
1578
|
-
continue;
|
|
1579
|
-
}
|
|
1580
|
-
op = body.call(thisArg, _);
|
|
1581
|
-
} catch (e) {
|
|
1582
|
-
op = [6, e];
|
|
1583
|
-
y = 0;
|
|
1584
|
-
} finally {
|
|
1585
|
-
f = t = 0;
|
|
1586
|
-
}
|
|
1587
|
-
if (op[0] & 5)
|
|
1588
|
-
throw op[1];
|
|
1589
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
var __read6 = function(o, n) {
|
|
1593
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1594
|
-
if (!m)
|
|
1595
|
-
return o;
|
|
1596
|
-
var i = m.call(o), r, ar = [], e;
|
|
1597
|
-
try {
|
|
1598
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
1599
|
-
ar.push(r.value);
|
|
1600
|
-
} catch (error) {
|
|
1601
|
-
e = { error };
|
|
1602
|
-
} finally {
|
|
1603
|
-
try {
|
|
1604
|
-
if (r && !r.done && (m = i["return"]))
|
|
1605
|
-
m.call(i);
|
|
1606
|
-
} finally {
|
|
1607
|
-
if (e)
|
|
1608
|
-
throw e.error;
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
return ar;
|
|
1612
|
-
};
|
|
1613
|
-
var Resource = (
|
|
1614
|
-
/** @class */
|
|
1615
|
-
function() {
|
|
1616
|
-
function Resource2(attributes, asyncAttributesPromise) {
|
|
1617
|
-
var _this = this;
|
|
1618
|
-
var _a2;
|
|
1619
|
-
this._attributes = attributes;
|
|
1620
|
-
this.asyncAttributesPending = asyncAttributesPromise != null;
|
|
1621
|
-
this._syncAttributes = (_a2 = this._attributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
1622
|
-
this._asyncAttributesPromise = asyncAttributesPromise === null || asyncAttributesPromise === void 0 ? void 0 : asyncAttributesPromise.then(function(asyncAttributes) {
|
|
1623
|
-
_this._attributes = Object.assign({}, _this._attributes, asyncAttributes);
|
|
1624
|
-
_this.asyncAttributesPending = false;
|
|
1625
|
-
return asyncAttributes;
|
|
1626
|
-
}, function(err) {
|
|
1627
|
-
diag.debug("a resource's async attributes promise rejected: %s", err);
|
|
1628
|
-
_this.asyncAttributesPending = false;
|
|
1629
|
-
return {};
|
|
1630
|
-
});
|
|
1631
|
-
}
|
|
1632
|
-
Resource2.empty = function() {
|
|
1633
|
-
return Resource2.EMPTY;
|
|
1634
|
-
};
|
|
1635
|
-
Resource2.default = function() {
|
|
1636
|
-
var _a2;
|
|
1637
|
-
return new Resource2((_a2 = {}, _a2[SemanticResourceAttributes.SERVICE_NAME] = defaultServiceName(), _a2[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE] = SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE], _a2[SemanticResourceAttributes.TELEMETRY_SDK_NAME] = SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME], _a2[SemanticResourceAttributes.TELEMETRY_SDK_VERSION] = SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION], _a2));
|
|
1638
|
-
};
|
|
1639
|
-
Object.defineProperty(Resource2.prototype, "attributes", {
|
|
1640
|
-
get: function() {
|
|
1641
|
-
var _a2;
|
|
1642
|
-
if (this.asyncAttributesPending) {
|
|
1643
|
-
diag.error("Accessing resource attributes before async attributes settled");
|
|
1644
|
-
}
|
|
1645
|
-
return (_a2 = this._attributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
1646
|
-
},
|
|
1647
|
-
enumerable: false,
|
|
1648
|
-
configurable: true
|
|
1649
|
-
});
|
|
1650
|
-
Resource2.prototype.waitForAsyncAttributes = function() {
|
|
1651
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
1652
|
-
return __generator(this, function(_a2) {
|
|
1653
|
-
switch (_a2.label) {
|
|
1654
|
-
case 0:
|
|
1655
|
-
if (!this.asyncAttributesPending)
|
|
1656
|
-
return [3, 2];
|
|
1657
|
-
return [4, this._asyncAttributesPromise];
|
|
1658
|
-
case 1:
|
|
1659
|
-
_a2.sent();
|
|
1660
|
-
_a2.label = 2;
|
|
1661
|
-
case 2:
|
|
1662
|
-
return [
|
|
1663
|
-
2
|
|
1664
|
-
/*return*/
|
|
1665
|
-
];
|
|
1666
|
-
}
|
|
1667
|
-
});
|
|
1668
|
-
});
|
|
1669
|
-
};
|
|
1670
|
-
Resource2.prototype.merge = function(other) {
|
|
1671
|
-
var _this = this;
|
|
1672
|
-
var _a2;
|
|
1673
|
-
if (!other)
|
|
1674
|
-
return this;
|
|
1675
|
-
var mergedSyncAttributes = __assign(__assign({}, this._syncAttributes), (_a2 = other._syncAttributes) !== null && _a2 !== void 0 ? _a2 : other.attributes);
|
|
1676
|
-
if (!this._asyncAttributesPromise && !other._asyncAttributesPromise) {
|
|
1677
|
-
return new Resource2(mergedSyncAttributes);
|
|
1678
|
-
}
|
|
1679
|
-
var mergedAttributesPromise = Promise.all([
|
|
1680
|
-
this._asyncAttributesPromise,
|
|
1681
|
-
other._asyncAttributesPromise
|
|
1682
|
-
]).then(function(_a3) {
|
|
1683
|
-
var _b;
|
|
1684
|
-
var _c = __read6(_a3, 2), thisAsyncAttributes = _c[0], otherAsyncAttributes = _c[1];
|
|
1685
|
-
return __assign(__assign(__assign(__assign({}, _this._syncAttributes), thisAsyncAttributes), (_b = other._syncAttributes) !== null && _b !== void 0 ? _b : other.attributes), otherAsyncAttributes);
|
|
1686
|
-
});
|
|
1687
|
-
return new Resource2(mergedSyncAttributes, mergedAttributesPromise);
|
|
1688
|
-
};
|
|
1689
|
-
Resource2.EMPTY = new Resource2({});
|
|
1690
|
-
return Resource2;
|
|
1691
|
-
}()
|
|
1692
|
-
);
|
|
1693
576
|
|
|
1694
577
|
// src/tracing.ts
|
|
1695
|
-
init_esm();
|
|
1696
|
-
import { DataloaderInstrumentation } from "@opentelemetry/instrumentation-dataloader";
|
|
1697
|
-
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
1698
|
-
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
1699
|
-
import { KnexInstrumentation } from "@opentelemetry/instrumentation-knex";
|
|
1700
|
-
import { MySQL2Instrumentation } from "@opentelemetry/instrumentation-mysql2";
|
|
1701
|
-
import { NetInstrumentation } from "@opentelemetry/instrumentation-net";
|
|
1702
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
1703
578
|
import {
|
|
1704
579
|
ParentBasedSampler,
|
|
1705
580
|
TraceIdRatioBasedSampler
|
|
1706
581
|
} from "@opentelemetry/sdk-trace-node";
|
|
1707
582
|
import { ExpressLayerType } from "@opentelemetry/instrumentation-express/build/src/enums/ExpressLayerType";
|
|
583
|
+
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
584
|
+
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
585
|
+
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
586
|
+
return AdditionalInstrumentation2;
|
|
587
|
+
})(AdditionalInstrumentation || {});
|
|
588
|
+
var additionalInstrumentationConstructors = {
|
|
589
|
+
KNEX: KnexInstrumentation,
|
|
590
|
+
PRISMA: PrismaInstrumentation
|
|
591
|
+
};
|
|
1708
592
|
var tracingDefaults = {
|
|
1709
593
|
serviceName: "unknown",
|
|
1710
594
|
release: "unknown",
|
|
@@ -1734,29 +618,34 @@ async function nodeSDKBuilder(config) {
|
|
|
1734
618
|
scheduledDelayMillis: 100
|
|
1735
619
|
});
|
|
1736
620
|
const _idGenerator = new AWSXRayIdGenerator();
|
|
621
|
+
let instrumentations = [
|
|
622
|
+
new AwsInstrumentation({
|
|
623
|
+
suppressInternalInstrumentation: true
|
|
624
|
+
}),
|
|
625
|
+
new DataloaderInstrumentation({}),
|
|
626
|
+
new ExpressInstrumentation({
|
|
627
|
+
ignoreLayersType: [ExpressLayerType.MIDDLEWARE]
|
|
628
|
+
}),
|
|
629
|
+
new GraphQLInstrumentation({
|
|
630
|
+
// optional params
|
|
631
|
+
depth: config.graphQLDepth,
|
|
632
|
+
//query depth
|
|
633
|
+
allowValues: true
|
|
634
|
+
}),
|
|
635
|
+
new HttpInstrumentation({
|
|
636
|
+
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
637
|
+
}),
|
|
638
|
+
new MySQL2Instrumentation({}),
|
|
639
|
+
new NetInstrumentation({})
|
|
640
|
+
];
|
|
641
|
+
config.additionalInstrumentations.forEach((instrumentation) => {
|
|
642
|
+
instrumentations.push(
|
|
643
|
+
new additionalInstrumentationConstructors[instrumentation]()
|
|
644
|
+
);
|
|
645
|
+
});
|
|
1737
646
|
const sdk = new NodeSDK({
|
|
1738
647
|
textMapPropagator: new AWSXRayPropagator(),
|
|
1739
|
-
instrumentations
|
|
1740
|
-
new AwsInstrumentation({
|
|
1741
|
-
suppressInternalInstrumentation: true
|
|
1742
|
-
}),
|
|
1743
|
-
new DataloaderInstrumentation({}),
|
|
1744
|
-
new ExpressInstrumentation({
|
|
1745
|
-
ignoreLayersType: [ExpressLayerType.MIDDLEWARE]
|
|
1746
|
-
}),
|
|
1747
|
-
new GraphQLInstrumentation({
|
|
1748
|
-
// optional params
|
|
1749
|
-
depth: config.graphQLDepth,
|
|
1750
|
-
//query depth
|
|
1751
|
-
allowValues: true
|
|
1752
|
-
}),
|
|
1753
|
-
new HttpInstrumentation({
|
|
1754
|
-
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
1755
|
-
}),
|
|
1756
|
-
new KnexInstrumentation({}),
|
|
1757
|
-
new MySQL2Instrumentation({}),
|
|
1758
|
-
new NetInstrumentation({})
|
|
1759
|
-
],
|
|
648
|
+
instrumentations,
|
|
1760
649
|
resource: _resource,
|
|
1761
650
|
spanProcessor: _spanProcessor,
|
|
1762
651
|
traceExporter: _traceExporter,
|
|
@@ -1767,12 +656,13 @@ async function nodeSDKBuilder(config) {
|
|
|
1767
656
|
})
|
|
1768
657
|
});
|
|
1769
658
|
await sdk.start();
|
|
1770
|
-
|
|
659
|
+
process.on("SIGTERM", () => {
|
|
1771
660
|
sdk.shutdown().then(() => diag.info("Tracing and Metrics terminated")).catch(
|
|
1772
661
|
(error) => diag.error("Error terminating tracing and metrics", error)
|
|
1773
|
-
).finally(() =>
|
|
662
|
+
).finally(() => process.exit(0));
|
|
1774
663
|
});
|
|
1775
664
|
}
|
|
1776
665
|
export {
|
|
666
|
+
AdditionalInstrumentation,
|
|
1777
667
|
nodeSDKBuilder
|
|
1778
668
|
};
|