@pocket-tools/tracing 1.0.1 → 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/dist/index.mjs CHANGED
@@ -1,39 +1,21 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __esm = (fn, res) => function __init() {
3
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
- };
5
-
6
- // ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
7
- var _globalThis;
8
- var init_globalThis = __esm({
9
- "../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js"() {
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.8.0/node_modules/@opentelemetry/api/build/esm/platform/index.js
22
- var init_platform = __esm({
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.8.0/node_modules/@opentelemetry/api/build/esm/version.js
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.8.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js
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 re, isCompatible;
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.8.0/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
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 _a2;
89
+ var _a;
112
90
  if (allowOverride === void 0) {
113
91
  allowOverride = false;
114
92
  }
115
- var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a2 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a2 !== void 0 ? _a2 : {
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 _a2, _b;
134
- var globalVersion = (_a2 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a2 === void 0 ? void 0 : _a2.version;
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.8.0/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
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.8.0/node_modules/@opentelemetry/api/build/esm/diag/types.js
212
+ // ../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
250
213
  var DiagLogLevel;
251
- var init_types = __esm({
252
- "../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
253
- (function(DiagLogLevel2) {
254
- DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
255
- DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
256
- DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
257
- DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
258
- DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
259
- DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
260
- DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
261
- })(DiagLogLevel || (DiagLogLevel = {}));
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,658 +245,154 @@ 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.8.0/node_modules/@opentelemetry/api/build/esm/api/diag.js
296
- var __read2, __spreadArray2, API_NAME, DiagAPI;
297
- var init_diag = __esm({
298
- "../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/api/diag.js"() {
299
- init_ComponentLogger();
300
- init_logLevelLogger();
301
- init_types();
302
- init_global_utils();
303
- __read2 = function(o, n) {
304
- var m = typeof Symbol === "function" && o[Symbol.iterator];
305
- if (!m)
306
- return o;
307
- var i = m.call(o), r, ar = [], e;
308
- try {
309
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
310
- ar.push(r.value);
311
- } catch (error) {
312
- e = { error };
313
- } finally {
314
- try {
315
- if (r && !r.done && (m = i["return"]))
316
- m.call(i);
317
- } finally {
318
- if (e)
319
- throw e.error;
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
- return ar;
323
- };
324
- __spreadArray2 = function(to, from, pack) {
325
- if (pack || arguments.length === 2)
326
- for (var i = 0, l = from.length, ar; i < l; i++) {
327
- if (ar || !(i in from)) {
328
- if (!ar)
329
- ar = Array.prototype.slice.call(from, 0, i);
330
- ar[i] = from[i];
331
- }
332
- }
333
- return to.concat(ar || Array.prototype.slice.call(from));
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
- return registerGlobal("diag", newLogger, self, true);
375
- };
376
- self.setLogger = setLogger;
377
- self.disable = function() {
378
- unregisterGlobal(API_NAME, self);
293
+ var logger = getGlobal("diag");
294
+ if (!logger)
295
+ return;
296
+ return logger[funcName].apply(logger, __spreadArray2([], __read2(args), false));
379
297
  };
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
298
  }
389
- DiagAPI2.instance = function() {
390
- if (!this._instance) {
391
- this._instance = new DiagAPI2();
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 };
392
304
  }
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;
424
- };
425
- }
426
- return BaseContext2;
427
- }();
428
- ROOT_CONTEXT = new BaseContext();
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);
465
- }
466
- }
467
- return DiagConsoleLogger2;
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
- return ar;
497
- };
498
- __spreadArray3 = function(to, from, pack) {
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
- return to.concat(ar || Array.prototype.slice.call(from));
508
- };
509
- NoopContextManager = /** @class */
510
- function() {
511
- function NoopContextManager2() {
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 fn.call.apply(fn, __spreadArray3([thisArg], __read3(args), false));
522
- };
523
- NoopContextManager2.prototype.bind = function(_context, target) {
524
- return target;
322
+ return registerGlobal("diag", newLogger, self, true);
525
323
  };
526
- NoopContextManager2.prototype.enable = function() {
527
- return this;
324
+ self.setLogger = setLogger;
325
+ self.disable = function() {
326
+ unregisterGlobal(API_NAME, self);
528
327
  };
529
- NoopContextManager2.prototype.disable = function() {
530
- return this;
328
+ self.createComponentLogger = function(options) {
329
+ return new DiagComponentLogger(options);
531
330
  };
532
- return NoopContextManager2;
533
- }();
534
- }
535
- });
536
-
537
- // ../../node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/build/esm/api/context.js
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 ar;
564
- };
565
- __spreadArray4 = function(to, from, pack) {
566
- if (pack || arguments.length === 2)
567
- for (var i = 0, l = from.length, ar; i < l; i++) {
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));
341
+ return this._instance;
575
342
  };
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.24.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.24.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.24.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.24.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.24.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+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/environment.js
728
- var DEFAULT_LIST_SEPARATOR = ",";
729
- var ENVIRONMENT_BOOLEAN_KEYS = ["OTEL_SDK_DISABLED"];
730
- function isEnvVarABoolean(key) {
731
- return ENVIRONMENT_BOOLEAN_KEYS.indexOf(key) > -1;
732
- }
733
- var ENVIRONMENT_NUMBERS_KEYS = [
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"
757
- ];
758
- function isEnvVarANumber(key) {
759
- return ENVIRONMENT_NUMBERS_KEYS.indexOf(key) > -1;
760
- }
761
- var ENVIRONMENT_LISTS_KEYS = [
762
- "OTEL_NO_PATCH_MODULES",
763
- "OTEL_PROPAGATORS"
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" }
764
354
  ];
765
- function isEnvVarAList(key) {
766
- return ENVIRONMENT_LISTS_KEYS.indexOf(key) > -1;
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
- return environment;
931
- }
380
+ return DiagConsoleLogger2;
381
+ }()
382
+ );
932
383
 
933
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/platform/node/environment.js
934
- function getEnv() {
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
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/version.js
940
- var VERSION2 = "1.24.0";
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
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__
@@ -1035,10 +490,6 @@ var TMP_TELEMETRY_AUTO_VERSION = "telemetry.auto.version";
1035
490
  var TMP_WEBENGINE_NAME = "webengine.name";
1036
491
  var TMP_WEBENGINE_VERSION = "webengine.version";
1037
492
  var TMP_WEBENGINE_DESCRIPTION = "webengine.description";
1038
- var SEMRESATTRS_SERVICE_NAME = TMP_SERVICE_NAME;
1039
- var SEMRESATTRS_TELEMETRY_SDK_NAME = TMP_TELEMETRY_SDK_NAME;
1040
- var SEMRESATTRS_TELEMETRY_SDK_LANGUAGE = TMP_TELEMETRY_SDK_LANGUAGE;
1041
- var SEMRESATTRS_TELEMETRY_SDK_VERSION = TMP_TELEMETRY_SDK_VERSION;
1042
493
  var SemanticResourceAttributes = /* @__PURE__ */ createConstMap([
1043
494
  TMP_CLOUD_PROVIDER,
1044
495
  TMP_CLOUD_ACCOUNT_ID,
@@ -1122,768 +573,6 @@ var SemanticResourceAttributes = /* @__PURE__ */ createConstMap([
1122
573
  TMP_WEBENGINE_VERSION,
1123
574
  TMP_WEBENGINE_DESCRIPTION
1124
575
  ]);
1125
- var TMP_TELEMETRYSDKLANGUAGEVALUES_CPP = "cpp";
1126
- var TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET = "dotnet";
1127
- var TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG = "erlang";
1128
- var TMP_TELEMETRYSDKLANGUAGEVALUES_GO = "go";
1129
- var TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA = "java";
1130
- var TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS = "nodejs";
1131
- var TMP_TELEMETRYSDKLANGUAGEVALUES_PHP = "php";
1132
- var TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON = "python";
1133
- var TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY = "ruby";
1134
- var TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS = "webjs";
1135
- var TelemetrySdkLanguageValues = /* @__PURE__ */ createConstMap([
1136
- TMP_TELEMETRYSDKLANGUAGEVALUES_CPP,
1137
- TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET,
1138
- TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG,
1139
- TMP_TELEMETRYSDKLANGUAGEVALUES_GO,
1140
- TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA,
1141
- TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS,
1142
- TMP_TELEMETRYSDKLANGUAGEVALUES_PHP,
1143
- TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON,
1144
- TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY,
1145
- TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS
1146
- ]);
1147
-
1148
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js
1149
- var _a;
1150
- 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);
1151
-
1152
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/platform/node/timer-util.js
1153
- function unrefTimer(timer) {
1154
- timer.unref();
1155
- }
1156
-
1157
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/ExportResult.js
1158
- var ExportResultCode;
1159
- (function(ExportResultCode2) {
1160
- ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
1161
- ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
1162
- })(ExportResultCode || (ExportResultCode = {}));
1163
-
1164
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/promise.js
1165
- var Deferred = (
1166
- /** @class */
1167
- function() {
1168
- function Deferred2() {
1169
- var _this = this;
1170
- this._promise = new Promise(function(resolve, reject) {
1171
- _this._resolve = resolve;
1172
- _this._reject = reject;
1173
- });
1174
- }
1175
- Object.defineProperty(Deferred2.prototype, "promise", {
1176
- get: function() {
1177
- return this._promise;
1178
- },
1179
- enumerable: false,
1180
- configurable: true
1181
- });
1182
- Deferred2.prototype.resolve = function(val) {
1183
- this._resolve(val);
1184
- };
1185
- Deferred2.prototype.reject = function(err) {
1186
- this._reject(err);
1187
- };
1188
- return Deferred2;
1189
- }()
1190
- );
1191
-
1192
- // ../../node_modules/.pnpm/@opentelemetry+core@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/core/build/esm/utils/callback.js
1193
- var __read5 = function(o, n) {
1194
- var m = typeof Symbol === "function" && o[Symbol.iterator];
1195
- if (!m)
1196
- return o;
1197
- var i = m.call(o), r, ar = [], e;
1198
- try {
1199
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
1200
- ar.push(r.value);
1201
- } catch (error) {
1202
- e = { error };
1203
- } finally {
1204
- try {
1205
- if (r && !r.done && (m = i["return"]))
1206
- m.call(i);
1207
- } finally {
1208
- if (e)
1209
- throw e.error;
1210
- }
1211
- }
1212
- return ar;
1213
- };
1214
- var __spreadArray5 = function(to, from, pack) {
1215
- if (pack || arguments.length === 2)
1216
- for (var i = 0, l = from.length, ar; i < l; i++) {
1217
- if (ar || !(i in from)) {
1218
- if (!ar)
1219
- ar = Array.prototype.slice.call(from, 0, i);
1220
- ar[i] = from[i];
1221
- }
1222
- }
1223
- return to.concat(ar || Array.prototype.slice.call(from));
1224
- };
1225
- var BindOnceFuture = (
1226
- /** @class */
1227
- function() {
1228
- function BindOnceFuture2(_callback, _that) {
1229
- this._callback = _callback;
1230
- this._that = _that;
1231
- this._isCalled = false;
1232
- this._deferred = new Deferred();
1233
- }
1234
- Object.defineProperty(BindOnceFuture2.prototype, "isCalled", {
1235
- get: function() {
1236
- return this._isCalled;
1237
- },
1238
- enumerable: false,
1239
- configurable: true
1240
- });
1241
- Object.defineProperty(BindOnceFuture2.prototype, "promise", {
1242
- get: function() {
1243
- return this._deferred.promise;
1244
- },
1245
- enumerable: false,
1246
- configurable: true
1247
- });
1248
- BindOnceFuture2.prototype.call = function() {
1249
- var _a2;
1250
- var _this = this;
1251
- var args = [];
1252
- for (var _i = 0; _i < arguments.length; _i++) {
1253
- args[_i] = arguments[_i];
1254
- }
1255
- if (!this._isCalled) {
1256
- this._isCalled = true;
1257
- try {
1258
- Promise.resolve((_a2 = this._callback).call.apply(_a2, __spreadArray5([this._that], __read5(args), false))).then(function(val) {
1259
- return _this._deferred.resolve(val);
1260
- }, function(err) {
1261
- return _this._deferred.reject(err);
1262
- });
1263
- } catch (err) {
1264
- this._deferred.reject(err);
1265
- }
1266
- }
1267
- return this._deferred.promise;
1268
- };
1269
- return BindOnceFuture2;
1270
- }()
1271
- );
1272
-
1273
- // ../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js
1274
- init_esm();
1275
- var BatchSpanProcessorBase = (
1276
- /** @class */
1277
- function() {
1278
- function BatchSpanProcessorBase2(_exporter, config) {
1279
- this._exporter = _exporter;
1280
- this._isExporting = false;
1281
- this._finishedSpans = [];
1282
- this._droppedSpansCount = 0;
1283
- var env = getEnv();
1284
- this._maxExportBatchSize = typeof (config === null || config === void 0 ? void 0 : config.maxExportBatchSize) === "number" ? config.maxExportBatchSize : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE;
1285
- this._maxQueueSize = typeof (config === null || config === void 0 ? void 0 : config.maxQueueSize) === "number" ? config.maxQueueSize : env.OTEL_BSP_MAX_QUEUE_SIZE;
1286
- this._scheduledDelayMillis = typeof (config === null || config === void 0 ? void 0 : config.scheduledDelayMillis) === "number" ? config.scheduledDelayMillis : env.OTEL_BSP_SCHEDULE_DELAY;
1287
- this._exportTimeoutMillis = typeof (config === null || config === void 0 ? void 0 : config.exportTimeoutMillis) === "number" ? config.exportTimeoutMillis : env.OTEL_BSP_EXPORT_TIMEOUT;
1288
- this._shutdownOnce = new BindOnceFuture(this._shutdown, this);
1289
- if (this._maxExportBatchSize > this._maxQueueSize) {
1290
- diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize");
1291
- this._maxExportBatchSize = this._maxQueueSize;
1292
- }
1293
- }
1294
- BatchSpanProcessorBase2.prototype.forceFlush = function() {
1295
- if (this._shutdownOnce.isCalled) {
1296
- return this._shutdownOnce.promise;
1297
- }
1298
- return this._flushAll();
1299
- };
1300
- BatchSpanProcessorBase2.prototype.onStart = function(_span, _parentContext) {
1301
- };
1302
- BatchSpanProcessorBase2.prototype.onEnd = function(span) {
1303
- if (this._shutdownOnce.isCalled) {
1304
- return;
1305
- }
1306
- if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {
1307
- return;
1308
- }
1309
- this._addToBuffer(span);
1310
- };
1311
- BatchSpanProcessorBase2.prototype.shutdown = function() {
1312
- return this._shutdownOnce.call();
1313
- };
1314
- BatchSpanProcessorBase2.prototype._shutdown = function() {
1315
- var _this = this;
1316
- return Promise.resolve().then(function() {
1317
- return _this.onShutdown();
1318
- }).then(function() {
1319
- return _this._flushAll();
1320
- }).then(function() {
1321
- return _this._exporter.shutdown();
1322
- });
1323
- };
1324
- BatchSpanProcessorBase2.prototype._addToBuffer = function(span) {
1325
- if (this._finishedSpans.length >= this._maxQueueSize) {
1326
- if (this._droppedSpansCount === 0) {
1327
- diag.debug("maxQueueSize reached, dropping spans");
1328
- }
1329
- this._droppedSpansCount++;
1330
- return;
1331
- }
1332
- if (this._droppedSpansCount > 0) {
1333
- diag.warn("Dropped " + this._droppedSpansCount + " spans because maxQueueSize reached");
1334
- this._droppedSpansCount = 0;
1335
- }
1336
- this._finishedSpans.push(span);
1337
- this._maybeStartTimer();
1338
- };
1339
- BatchSpanProcessorBase2.prototype._flushAll = function() {
1340
- var _this = this;
1341
- return new Promise(function(resolve, reject) {
1342
- var promises = [];
1343
- var count = Math.ceil(_this._finishedSpans.length / _this._maxExportBatchSize);
1344
- for (var i = 0, j = count; i < j; i++) {
1345
- promises.push(_this._flushOneBatch());
1346
- }
1347
- Promise.all(promises).then(function() {
1348
- resolve();
1349
- }).catch(reject);
1350
- });
1351
- };
1352
- BatchSpanProcessorBase2.prototype._flushOneBatch = function() {
1353
- var _this = this;
1354
- this._clearTimer();
1355
- if (this._finishedSpans.length === 0) {
1356
- return Promise.resolve();
1357
- }
1358
- return new Promise(function(resolve, reject) {
1359
- var timer = setTimeout(function() {
1360
- reject(new Error("Timeout"));
1361
- }, _this._exportTimeoutMillis);
1362
- context.with(suppressTracing(context.active()), function() {
1363
- var spans;
1364
- if (_this._finishedSpans.length <= _this._maxExportBatchSize) {
1365
- spans = _this._finishedSpans;
1366
- _this._finishedSpans = [];
1367
- } else {
1368
- spans = _this._finishedSpans.splice(0, _this._maxExportBatchSize);
1369
- }
1370
- var doExport = function() {
1371
- return _this._exporter.export(spans, function(result) {
1372
- var _a2;
1373
- clearTimeout(timer);
1374
- if (result.code === ExportResultCode.SUCCESS) {
1375
- resolve();
1376
- } else {
1377
- reject((_a2 = result.error) !== null && _a2 !== void 0 ? _a2 : new Error("BatchSpanProcessor: span export failed"));
1378
- }
1379
- });
1380
- };
1381
- var pendingResources = null;
1382
- for (var i = 0, len = spans.length; i < len; i++) {
1383
- var span = spans[i];
1384
- if (span.resource.asyncAttributesPending && span.resource.waitForAsyncAttributes) {
1385
- pendingResources !== null && pendingResources !== void 0 ? pendingResources : pendingResources = [];
1386
- pendingResources.push(span.resource.waitForAsyncAttributes());
1387
- }
1388
- }
1389
- if (pendingResources === null) {
1390
- doExport();
1391
- } else {
1392
- Promise.all(pendingResources).then(doExport, function(err) {
1393
- globalErrorHandler(err);
1394
- reject(err);
1395
- });
1396
- }
1397
- });
1398
- });
1399
- };
1400
- BatchSpanProcessorBase2.prototype._maybeStartTimer = function() {
1401
- var _this = this;
1402
- if (this._isExporting)
1403
- return;
1404
- var flush = function() {
1405
- _this._isExporting = true;
1406
- _this._flushOneBatch().finally(function() {
1407
- _this._isExporting = false;
1408
- if (_this._finishedSpans.length > 0) {
1409
- _this._clearTimer();
1410
- _this._maybeStartTimer();
1411
- }
1412
- }).catch(function(e) {
1413
- _this._isExporting = false;
1414
- globalErrorHandler(e);
1415
- });
1416
- };
1417
- if (this._finishedSpans.length >= this._maxExportBatchSize) {
1418
- return flush();
1419
- }
1420
- if (this._timer !== void 0)
1421
- return;
1422
- this._timer = setTimeout(function() {
1423
- return flush();
1424
- }, this._scheduledDelayMillis);
1425
- unrefTimer(this._timer);
1426
- };
1427
- BatchSpanProcessorBase2.prototype._clearTimer = function() {
1428
- if (this._timer !== void 0) {
1429
- clearTimeout(this._timer);
1430
- this._timer = void 0;
1431
- }
1432
- };
1433
- return BatchSpanProcessorBase2;
1434
- }()
1435
- );
1436
-
1437
- // ../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/node/export/BatchSpanProcessor.js
1438
- var __extends = /* @__PURE__ */ function() {
1439
- var extendStatics = function(d, b) {
1440
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
1441
- d2.__proto__ = b2;
1442
- } || function(d2, b2) {
1443
- for (var p in b2)
1444
- if (Object.prototype.hasOwnProperty.call(b2, p))
1445
- d2[p] = b2[p];
1446
- };
1447
- return extendStatics(d, b);
1448
- };
1449
- return function(d, b) {
1450
- if (typeof b !== "function" && b !== null)
1451
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1452
- extendStatics(d, b);
1453
- function __() {
1454
- this.constructor = d;
1455
- }
1456
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1457
- };
1458
- }();
1459
- var BatchSpanProcessor = (
1460
- /** @class */
1461
- function(_super) {
1462
- __extends(BatchSpanProcessor2, _super);
1463
- function BatchSpanProcessor2() {
1464
- return _super !== null && _super.apply(this, arguments) || this;
1465
- }
1466
- BatchSpanProcessor2.prototype.onShutdown = function() {
1467
- };
1468
- return BatchSpanProcessor2;
1469
- }(BatchSpanProcessorBase)
1470
- );
1471
-
1472
- // ../../node_modules/.pnpm/@opentelemetry+resources@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/Resource.js
1473
- init_esm();
1474
-
1475
- // ../../node_modules/.pnpm/@opentelemetry+resources@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/platform/node/default-service-name.js
1476
- function defaultServiceName() {
1477
- return "unknown_service:" + process.argv0;
1478
- }
1479
-
1480
- // ../../node_modules/.pnpm/@opentelemetry+resources@1.24.0_@opentelemetry+api@1.8.0/node_modules/@opentelemetry/resources/build/esm/Resource.js
1481
- var __assign = function() {
1482
- __assign = Object.assign || function(t) {
1483
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1484
- s = arguments[i];
1485
- for (var p in s)
1486
- if (Object.prototype.hasOwnProperty.call(s, p))
1487
- t[p] = s[p];
1488
- }
1489
- return t;
1490
- };
1491
- return __assign.apply(this, arguments);
1492
- };
1493
- var __awaiter = function(thisArg, _arguments, P, generator) {
1494
- function adopt(value) {
1495
- return value instanceof P ? value : new P(function(resolve) {
1496
- resolve(value);
1497
- });
1498
- }
1499
- return new (P || (P = Promise))(function(resolve, reject) {
1500
- function fulfilled(value) {
1501
- try {
1502
- step(generator.next(value));
1503
- } catch (e) {
1504
- reject(e);
1505
- }
1506
- }
1507
- function rejected(value) {
1508
- try {
1509
- step(generator["throw"](value));
1510
- } catch (e) {
1511
- reject(e);
1512
- }
1513
- }
1514
- function step(result) {
1515
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1516
- }
1517
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1518
- });
1519
- };
1520
- var __generator = function(thisArg, body) {
1521
- var _ = { label: 0, sent: function() {
1522
- if (t[0] & 1)
1523
- throw t[1];
1524
- return t[1];
1525
- }, trys: [], ops: [] }, f, y, t, g;
1526
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1527
- return this;
1528
- }), g;
1529
- function verb(n) {
1530
- return function(v) {
1531
- return step([n, v]);
1532
- };
1533
- }
1534
- function step(op) {
1535
- if (f)
1536
- throw new TypeError("Generator is already executing.");
1537
- while (_)
1538
- try {
1539
- 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)
1540
- return t;
1541
- if (y = 0, t)
1542
- op = [op[0] & 2, t.value];
1543
- switch (op[0]) {
1544
- case 0:
1545
- case 1:
1546
- t = op;
1547
- break;
1548
- case 4:
1549
- _.label++;
1550
- return { value: op[1], done: false };
1551
- case 5:
1552
- _.label++;
1553
- y = op[1];
1554
- op = [0];
1555
- continue;
1556
- case 7:
1557
- op = _.ops.pop();
1558
- _.trys.pop();
1559
- continue;
1560
- default:
1561
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1562
- _ = 0;
1563
- continue;
1564
- }
1565
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1566
- _.label = op[1];
1567
- break;
1568
- }
1569
- if (op[0] === 6 && _.label < t[1]) {
1570
- _.label = t[1];
1571
- t = op;
1572
- break;
1573
- }
1574
- if (t && _.label < t[2]) {
1575
- _.label = t[2];
1576
- _.ops.push(op);
1577
- break;
1578
- }
1579
- if (t[2])
1580
- _.ops.pop();
1581
- _.trys.pop();
1582
- continue;
1583
- }
1584
- op = body.call(thisArg, _);
1585
- } catch (e) {
1586
- op = [6, e];
1587
- y = 0;
1588
- } finally {
1589
- f = t = 0;
1590
- }
1591
- if (op[0] & 5)
1592
- throw op[1];
1593
- return { value: op[0] ? op[1] : void 0, done: true };
1594
- }
1595
- };
1596
- var __read6 = function(o, n) {
1597
- var m = typeof Symbol === "function" && o[Symbol.iterator];
1598
- if (!m)
1599
- return o;
1600
- var i = m.call(o), r, ar = [], e;
1601
- try {
1602
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
1603
- ar.push(r.value);
1604
- } catch (error) {
1605
- e = { error };
1606
- } finally {
1607
- try {
1608
- if (r && !r.done && (m = i["return"]))
1609
- m.call(i);
1610
- } finally {
1611
- if (e)
1612
- throw e.error;
1613
- }
1614
- }
1615
- return ar;
1616
- };
1617
- var Resource = (
1618
- /** @class */
1619
- function() {
1620
- function Resource2(attributes, asyncAttributesPromise) {
1621
- var _this = this;
1622
- var _a2;
1623
- this._attributes = attributes;
1624
- this.asyncAttributesPending = asyncAttributesPromise != null;
1625
- this._syncAttributes = (_a2 = this._attributes) !== null && _a2 !== void 0 ? _a2 : {};
1626
- this._asyncAttributesPromise = asyncAttributesPromise === null || asyncAttributesPromise === void 0 ? void 0 : asyncAttributesPromise.then(function(asyncAttributes) {
1627
- _this._attributes = Object.assign({}, _this._attributes, asyncAttributes);
1628
- _this.asyncAttributesPending = false;
1629
- return asyncAttributes;
1630
- }, function(err) {
1631
- diag.debug("a resource's async attributes promise rejected: %s", err);
1632
- _this.asyncAttributesPending = false;
1633
- return {};
1634
- });
1635
- }
1636
- Resource2.empty = function() {
1637
- return Resource2.EMPTY;
1638
- };
1639
- Resource2.default = function() {
1640
- var _a2;
1641
- return new Resource2((_a2 = {}, _a2[SEMRESATTRS_SERVICE_NAME] = defaultServiceName(), _a2[SEMRESATTRS_TELEMETRY_SDK_LANGUAGE] = SDK_INFO[SEMRESATTRS_TELEMETRY_SDK_LANGUAGE], _a2[SEMRESATTRS_TELEMETRY_SDK_NAME] = SDK_INFO[SEMRESATTRS_TELEMETRY_SDK_NAME], _a2[SEMRESATTRS_TELEMETRY_SDK_VERSION] = SDK_INFO[SEMRESATTRS_TELEMETRY_SDK_VERSION], _a2));
1642
- };
1643
- Object.defineProperty(Resource2.prototype, "attributes", {
1644
- get: function() {
1645
- var _a2;
1646
- if (this.asyncAttributesPending) {
1647
- diag.error("Accessing resource attributes before async attributes settled");
1648
- }
1649
- return (_a2 = this._attributes) !== null && _a2 !== void 0 ? _a2 : {};
1650
- },
1651
- enumerable: false,
1652
- configurable: true
1653
- });
1654
- Resource2.prototype.waitForAsyncAttributes = function() {
1655
- return __awaiter(this, void 0, void 0, function() {
1656
- return __generator(this, function(_a2) {
1657
- switch (_a2.label) {
1658
- case 0:
1659
- if (!this.asyncAttributesPending)
1660
- return [3, 2];
1661
- return [4, this._asyncAttributesPromise];
1662
- case 1:
1663
- _a2.sent();
1664
- _a2.label = 2;
1665
- case 2:
1666
- return [
1667
- 2
1668
- /*return*/
1669
- ];
1670
- }
1671
- });
1672
- });
1673
- };
1674
- Resource2.prototype.merge = function(other) {
1675
- var _this = this;
1676
- var _a2;
1677
- if (!other)
1678
- return this;
1679
- var mergedSyncAttributes = __assign(__assign({}, this._syncAttributes), (_a2 = other._syncAttributes) !== null && _a2 !== void 0 ? _a2 : other.attributes);
1680
- if (!this._asyncAttributesPromise && !other._asyncAttributesPromise) {
1681
- return new Resource2(mergedSyncAttributes);
1682
- }
1683
- var mergedAttributesPromise = Promise.all([
1684
- this._asyncAttributesPromise,
1685
- other._asyncAttributesPromise
1686
- ]).then(function(_a3) {
1687
- var _b;
1688
- var _c = __read6(_a3, 2), thisAsyncAttributes = _c[0], otherAsyncAttributes = _c[1];
1689
- return __assign(__assign(__assign(__assign({}, _this._syncAttributes), thisAsyncAttributes), (_b = other._syncAttributes) !== null && _b !== void 0 ? _b : other.attributes), otherAsyncAttributes);
1690
- });
1691
- return new Resource2(mergedSyncAttributes, mergedAttributesPromise);
1692
- };
1693
- Resource2.EMPTY = new Resource2({});
1694
- return Resource2;
1695
- }()
1696
- );
1697
-
1698
- // src/tracing.ts
1699
- init_esm();
1700
- import { DataloaderInstrumentation } from "@opentelemetry/instrumentation-dataloader";
1701
- import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
1702
- import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
1703
- import { KnexInstrumentation } from "@opentelemetry/instrumentation-knex";
1704
- import { MySQL2Instrumentation } from "@opentelemetry/instrumentation-mysql2";
1705
- import { NetInstrumentation } from "@opentelemetry/instrumentation-net";
1706
- import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
1707
-
1708
- // ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.23.0/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js
1709
- // @__NO_SIDE_EFFECTS__
1710
- function createConstMap2(values) {
1711
- var res = {};
1712
- var len = values.length;
1713
- for (var lp = 0; lp < len; lp++) {
1714
- var val = values[lp];
1715
- if (val) {
1716
- res[String(val).toUpperCase().replace(/[-.]/g, "_")] = val;
1717
- }
1718
- }
1719
- return res;
1720
- }
1721
-
1722
- // ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.23.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js
1723
- var TMP_CLOUD_PROVIDER2 = "cloud.provider";
1724
- var TMP_CLOUD_ACCOUNT_ID2 = "cloud.account.id";
1725
- var TMP_CLOUD_REGION2 = "cloud.region";
1726
- var TMP_CLOUD_AVAILABILITY_ZONE2 = "cloud.availability_zone";
1727
- var TMP_CLOUD_PLATFORM2 = "cloud.platform";
1728
- var TMP_AWS_ECS_CONTAINER_ARN2 = "aws.ecs.container.arn";
1729
- var TMP_AWS_ECS_CLUSTER_ARN2 = "aws.ecs.cluster.arn";
1730
- var TMP_AWS_ECS_LAUNCHTYPE2 = "aws.ecs.launchtype";
1731
- var TMP_AWS_ECS_TASK_ARN2 = "aws.ecs.task.arn";
1732
- var TMP_AWS_ECS_TASK_FAMILY2 = "aws.ecs.task.family";
1733
- var TMP_AWS_ECS_TASK_REVISION2 = "aws.ecs.task.revision";
1734
- var TMP_AWS_EKS_CLUSTER_ARN2 = "aws.eks.cluster.arn";
1735
- var TMP_AWS_LOG_GROUP_NAMES2 = "aws.log.group.names";
1736
- var TMP_AWS_LOG_GROUP_ARNS2 = "aws.log.group.arns";
1737
- var TMP_AWS_LOG_STREAM_NAMES2 = "aws.log.stream.names";
1738
- var TMP_AWS_LOG_STREAM_ARNS2 = "aws.log.stream.arns";
1739
- var TMP_CONTAINER_NAME2 = "container.name";
1740
- var TMP_CONTAINER_ID2 = "container.id";
1741
- var TMP_CONTAINER_RUNTIME2 = "container.runtime";
1742
- var TMP_CONTAINER_IMAGE_NAME2 = "container.image.name";
1743
- var TMP_CONTAINER_IMAGE_TAG2 = "container.image.tag";
1744
- var TMP_DEPLOYMENT_ENVIRONMENT2 = "deployment.environment";
1745
- var TMP_DEVICE_ID2 = "device.id";
1746
- var TMP_DEVICE_MODEL_IDENTIFIER2 = "device.model.identifier";
1747
- var TMP_DEVICE_MODEL_NAME2 = "device.model.name";
1748
- var TMP_FAAS_NAME2 = "faas.name";
1749
- var TMP_FAAS_ID2 = "faas.id";
1750
- var TMP_FAAS_VERSION2 = "faas.version";
1751
- var TMP_FAAS_INSTANCE2 = "faas.instance";
1752
- var TMP_FAAS_MAX_MEMORY2 = "faas.max_memory";
1753
- var TMP_HOST_ID2 = "host.id";
1754
- var TMP_HOST_NAME2 = "host.name";
1755
- var TMP_HOST_TYPE2 = "host.type";
1756
- var TMP_HOST_ARCH2 = "host.arch";
1757
- var TMP_HOST_IMAGE_NAME2 = "host.image.name";
1758
- var TMP_HOST_IMAGE_ID2 = "host.image.id";
1759
- var TMP_HOST_IMAGE_VERSION2 = "host.image.version";
1760
- var TMP_K8S_CLUSTER_NAME2 = "k8s.cluster.name";
1761
- var TMP_K8S_NODE_NAME2 = "k8s.node.name";
1762
- var TMP_K8S_NODE_UID2 = "k8s.node.uid";
1763
- var TMP_K8S_NAMESPACE_NAME2 = "k8s.namespace.name";
1764
- var TMP_K8S_POD_UID2 = "k8s.pod.uid";
1765
- var TMP_K8S_POD_NAME2 = "k8s.pod.name";
1766
- var TMP_K8S_CONTAINER_NAME2 = "k8s.container.name";
1767
- var TMP_K8S_REPLICASET_UID2 = "k8s.replicaset.uid";
1768
- var TMP_K8S_REPLICASET_NAME2 = "k8s.replicaset.name";
1769
- var TMP_K8S_DEPLOYMENT_UID2 = "k8s.deployment.uid";
1770
- var TMP_K8S_DEPLOYMENT_NAME2 = "k8s.deployment.name";
1771
- var TMP_K8S_STATEFULSET_UID2 = "k8s.statefulset.uid";
1772
- var TMP_K8S_STATEFULSET_NAME2 = "k8s.statefulset.name";
1773
- var TMP_K8S_DAEMONSET_UID2 = "k8s.daemonset.uid";
1774
- var TMP_K8S_DAEMONSET_NAME2 = "k8s.daemonset.name";
1775
- var TMP_K8S_JOB_UID2 = "k8s.job.uid";
1776
- var TMP_K8S_JOB_NAME2 = "k8s.job.name";
1777
- var TMP_K8S_CRONJOB_UID2 = "k8s.cronjob.uid";
1778
- var TMP_K8S_CRONJOB_NAME2 = "k8s.cronjob.name";
1779
- var TMP_OS_TYPE2 = "os.type";
1780
- var TMP_OS_DESCRIPTION2 = "os.description";
1781
- var TMP_OS_NAME2 = "os.name";
1782
- var TMP_OS_VERSION2 = "os.version";
1783
- var TMP_PROCESS_PID2 = "process.pid";
1784
- var TMP_PROCESS_EXECUTABLE_NAME2 = "process.executable.name";
1785
- var TMP_PROCESS_EXECUTABLE_PATH2 = "process.executable.path";
1786
- var TMP_PROCESS_COMMAND2 = "process.command";
1787
- var TMP_PROCESS_COMMAND_LINE2 = "process.command_line";
1788
- var TMP_PROCESS_COMMAND_ARGS2 = "process.command_args";
1789
- var TMP_PROCESS_OWNER2 = "process.owner";
1790
- var TMP_PROCESS_RUNTIME_NAME2 = "process.runtime.name";
1791
- var TMP_PROCESS_RUNTIME_VERSION2 = "process.runtime.version";
1792
- var TMP_PROCESS_RUNTIME_DESCRIPTION2 = "process.runtime.description";
1793
- var TMP_SERVICE_NAME2 = "service.name";
1794
- var TMP_SERVICE_NAMESPACE2 = "service.namespace";
1795
- var TMP_SERVICE_INSTANCE_ID2 = "service.instance.id";
1796
- var TMP_SERVICE_VERSION2 = "service.version";
1797
- var TMP_TELEMETRY_SDK_NAME2 = "telemetry.sdk.name";
1798
- var TMP_TELEMETRY_SDK_LANGUAGE2 = "telemetry.sdk.language";
1799
- var TMP_TELEMETRY_SDK_VERSION2 = "telemetry.sdk.version";
1800
- var TMP_TELEMETRY_AUTO_VERSION2 = "telemetry.auto.version";
1801
- var TMP_WEBENGINE_NAME2 = "webengine.name";
1802
- var TMP_WEBENGINE_VERSION2 = "webengine.version";
1803
- var TMP_WEBENGINE_DESCRIPTION2 = "webengine.description";
1804
- var SemanticResourceAttributes2 = /* @__PURE__ */ createConstMap2([
1805
- TMP_CLOUD_PROVIDER2,
1806
- TMP_CLOUD_ACCOUNT_ID2,
1807
- TMP_CLOUD_REGION2,
1808
- TMP_CLOUD_AVAILABILITY_ZONE2,
1809
- TMP_CLOUD_PLATFORM2,
1810
- TMP_AWS_ECS_CONTAINER_ARN2,
1811
- TMP_AWS_ECS_CLUSTER_ARN2,
1812
- TMP_AWS_ECS_LAUNCHTYPE2,
1813
- TMP_AWS_ECS_TASK_ARN2,
1814
- TMP_AWS_ECS_TASK_FAMILY2,
1815
- TMP_AWS_ECS_TASK_REVISION2,
1816
- TMP_AWS_EKS_CLUSTER_ARN2,
1817
- TMP_AWS_LOG_GROUP_NAMES2,
1818
- TMP_AWS_LOG_GROUP_ARNS2,
1819
- TMP_AWS_LOG_STREAM_NAMES2,
1820
- TMP_AWS_LOG_STREAM_ARNS2,
1821
- TMP_CONTAINER_NAME2,
1822
- TMP_CONTAINER_ID2,
1823
- TMP_CONTAINER_RUNTIME2,
1824
- TMP_CONTAINER_IMAGE_NAME2,
1825
- TMP_CONTAINER_IMAGE_TAG2,
1826
- TMP_DEPLOYMENT_ENVIRONMENT2,
1827
- TMP_DEVICE_ID2,
1828
- TMP_DEVICE_MODEL_IDENTIFIER2,
1829
- TMP_DEVICE_MODEL_NAME2,
1830
- TMP_FAAS_NAME2,
1831
- TMP_FAAS_ID2,
1832
- TMP_FAAS_VERSION2,
1833
- TMP_FAAS_INSTANCE2,
1834
- TMP_FAAS_MAX_MEMORY2,
1835
- TMP_HOST_ID2,
1836
- TMP_HOST_NAME2,
1837
- TMP_HOST_TYPE2,
1838
- TMP_HOST_ARCH2,
1839
- TMP_HOST_IMAGE_NAME2,
1840
- TMP_HOST_IMAGE_ID2,
1841
- TMP_HOST_IMAGE_VERSION2,
1842
- TMP_K8S_CLUSTER_NAME2,
1843
- TMP_K8S_NODE_NAME2,
1844
- TMP_K8S_NODE_UID2,
1845
- TMP_K8S_NAMESPACE_NAME2,
1846
- TMP_K8S_POD_UID2,
1847
- TMP_K8S_POD_NAME2,
1848
- TMP_K8S_CONTAINER_NAME2,
1849
- TMP_K8S_REPLICASET_UID2,
1850
- TMP_K8S_REPLICASET_NAME2,
1851
- TMP_K8S_DEPLOYMENT_UID2,
1852
- TMP_K8S_DEPLOYMENT_NAME2,
1853
- TMP_K8S_STATEFULSET_UID2,
1854
- TMP_K8S_STATEFULSET_NAME2,
1855
- TMP_K8S_DAEMONSET_UID2,
1856
- TMP_K8S_DAEMONSET_NAME2,
1857
- TMP_K8S_JOB_UID2,
1858
- TMP_K8S_JOB_NAME2,
1859
- TMP_K8S_CRONJOB_UID2,
1860
- TMP_K8S_CRONJOB_NAME2,
1861
- TMP_OS_TYPE2,
1862
- TMP_OS_DESCRIPTION2,
1863
- TMP_OS_NAME2,
1864
- TMP_OS_VERSION2,
1865
- TMP_PROCESS_PID2,
1866
- TMP_PROCESS_EXECUTABLE_NAME2,
1867
- TMP_PROCESS_EXECUTABLE_PATH2,
1868
- TMP_PROCESS_COMMAND2,
1869
- TMP_PROCESS_COMMAND_LINE2,
1870
- TMP_PROCESS_COMMAND_ARGS2,
1871
- TMP_PROCESS_OWNER2,
1872
- TMP_PROCESS_RUNTIME_NAME2,
1873
- TMP_PROCESS_RUNTIME_VERSION2,
1874
- TMP_PROCESS_RUNTIME_DESCRIPTION2,
1875
- TMP_SERVICE_NAME2,
1876
- TMP_SERVICE_NAMESPACE2,
1877
- TMP_SERVICE_INSTANCE_ID2,
1878
- TMP_SERVICE_VERSION2,
1879
- TMP_TELEMETRY_SDK_NAME2,
1880
- TMP_TELEMETRY_SDK_LANGUAGE2,
1881
- TMP_TELEMETRY_SDK_VERSION2,
1882
- TMP_TELEMETRY_AUTO_VERSION2,
1883
- TMP_WEBENGINE_NAME2,
1884
- TMP_WEBENGINE_VERSION2,
1885
- TMP_WEBENGINE_DESCRIPTION2
1886
- ]);
1887
576
 
1888
577
  // src/tracing.ts
1889
578
  import {
@@ -1891,6 +580,15 @@ import {
1891
580
  TraceIdRatioBasedSampler
1892
581
  } from "@opentelemetry/sdk-trace-node";
1893
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
+ };
1894
592
  var tracingDefaults = {
1895
593
  serviceName: "unknown",
1896
594
  release: "unknown",
@@ -1906,8 +604,8 @@ async function nodeSDKBuilder(config) {
1906
604
  diag.setLogger(config.logger, DiagLogLevel.WARN);
1907
605
  const _resource = Resource.default().merge(
1908
606
  new Resource({
1909
- [SemanticResourceAttributes2.SERVICE_NAME]: config.serviceName,
1910
- [SemanticResourceAttributes2.SERVICE_VERSION]: config.release
607
+ [SemanticResourceAttributes.SERVICE_NAME]: config.serviceName,
608
+ [SemanticResourceAttributes.SERVICE_VERSION]: config.release
1911
609
  })
1912
610
  );
1913
611
  const _traceExporter = new OTLPTraceExporter({
@@ -1920,29 +618,34 @@ async function nodeSDKBuilder(config) {
1920
618
  scheduledDelayMillis: 100
1921
619
  });
1922
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
+ });
1923
646
  const sdk = new NodeSDK({
1924
647
  textMapPropagator: new AWSXRayPropagator(),
1925
- instrumentations: [
1926
- new AwsInstrumentation({
1927
- suppressInternalInstrumentation: true
1928
- }),
1929
- new DataloaderInstrumentation({}),
1930
- new ExpressInstrumentation({
1931
- ignoreLayersType: [ExpressLayerType.MIDDLEWARE]
1932
- }),
1933
- new GraphQLInstrumentation({
1934
- // optional params
1935
- depth: config.graphQLDepth,
1936
- //query depth
1937
- allowValues: true
1938
- }),
1939
- new HttpInstrumentation({
1940
- ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
1941
- }),
1942
- new KnexInstrumentation({}),
1943
- new MySQL2Instrumentation({}),
1944
- new NetInstrumentation({})
1945
- ],
648
+ instrumentations,
1946
649
  resource: _resource,
1947
650
  spanProcessor: _spanProcessor,
1948
651
  traceExporter: _traceExporter,
@@ -1953,12 +656,13 @@ async function nodeSDKBuilder(config) {
1953
656
  })
1954
657
  });
1955
658
  await sdk.start();
1956
- process2.on("SIGTERM", () => {
659
+ process.on("SIGTERM", () => {
1957
660
  sdk.shutdown().then(() => diag.info("Tracing and Metrics terminated")).catch(
1958
661
  (error) => diag.error("Error terminating tracing and metrics", error)
1959
- ).finally(() => process2.exit(0));
662
+ ).finally(() => process.exit(0));
1960
663
  });
1961
664
  }
1962
665
  export {
666
+ AdditionalInstrumentation,
1963
667
  nodeSDKBuilder
1964
668
  };