@synnaxlabs/alamos 0.1.0 → 0.2.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.
@@ -0,0 +1,676 @@
1
+ var U = Object.defineProperty;
2
+ var W = (r, e, t) => e in r ? U(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var s = (r, e, t) => (W(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ const d = class d {
5
+ constructor(e, t, n = "", a = !1) {
6
+ s(this, "_noop", !1);
7
+ s(this, "key");
8
+ s(this, "path");
9
+ s(this, "serviceName");
10
+ this.key = e, this.path = t, this.serviceName = n, this._noop = a;
11
+ }
12
+ child(e) {
13
+ return new d(e, this.extendPath(e), this.serviceName, this.noop);
14
+ }
15
+ extendPath(e) {
16
+ return `${this.path}.${e}`;
17
+ }
18
+ get noop() {
19
+ return this._noop;
20
+ }
21
+ };
22
+ s(d, "NOOP", new d("", "", ""));
23
+ let b = d;
24
+ const S = ["debug", "info", "warn", "error"], Pe = (r) => {
25
+ const e = S.indexOf(r);
26
+ return ({ level: t }) => S.indexOf(t) >= e;
27
+ }, Re = (r) => {
28
+ const { include: e, exclude: t } = r;
29
+ return ({ path: n }) => !(e != null && !e.some((a) => n.startsWith(a)) || t != null && t.some((a) => n.startsWith(a)));
30
+ }, v = class v {
31
+ constructor(e = {}) {
32
+ s(this, "meta", b.NOOP);
33
+ s(this, "filters");
34
+ const { filters: t = [] } = e;
35
+ this.filters = t;
36
+ }
37
+ filter(e) {
38
+ return !this.meta.noop && this.filters.every(
39
+ (t) => t({
40
+ key: this.meta.key,
41
+ path: this.meta.path,
42
+ level: e
43
+ })
44
+ );
45
+ }
46
+ child(e) {
47
+ const t = new v({ filters: this.filters });
48
+ return t.meta = e, t;
49
+ }
50
+ debug(e, t) {
51
+ this.filter("debug") && (t == null ? console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e) : console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e, A(t)));
52
+ }
53
+ info(e, t) {
54
+ this.filter("info") && (t == null ? console.log("%cINFO", "color: #005eff;", this.meta.path, e) : console.log("%cINFO", "color: #005eff;", this.meta.path, e, A(t)));
55
+ }
56
+ warn(e, t) {
57
+ this.filter("warn") && (t == null ? console.warn("WARN", this.meta.path, e) : console.warn("WARN", this.meta.path, e, A(t)));
58
+ }
59
+ error(e, t) {
60
+ this.filter("error") && (t == null ? console.error("ERROR", this.meta.path, e) : console.error("ERROR", this.meta.path, e, A(t)));
61
+ }
62
+ };
63
+ s(v, "NOOP", new v());
64
+ let P = v;
65
+ const A = (r) => (Object.entries(r).forEach(([e, t]) => {
66
+ typeof t == "function" && (r[e] = t());
67
+ }), r);
68
+ var k = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {}, g = "1.6.0", F = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
69
+ function X(r) {
70
+ var e = /* @__PURE__ */ new Set([r]), t = /* @__PURE__ */ new Set(), n = r.match(F);
71
+ if (!n)
72
+ return function() {
73
+ return !1;
74
+ };
75
+ var a = {
76
+ major: +n[1],
77
+ minor: +n[2],
78
+ patch: +n[3],
79
+ prerelease: n[4]
80
+ };
81
+ if (a.prerelease != null)
82
+ return function(c) {
83
+ return c === r;
84
+ };
85
+ function o(u) {
86
+ return t.add(u), !1;
87
+ }
88
+ function i(u) {
89
+ return e.add(u), !0;
90
+ }
91
+ return function(c) {
92
+ if (e.has(c))
93
+ return !0;
94
+ if (t.has(c))
95
+ return !1;
96
+ var f = c.match(F);
97
+ if (!f)
98
+ return o(c);
99
+ var p = {
100
+ major: +f[1],
101
+ minor: +f[2],
102
+ patch: +f[3],
103
+ prerelease: f[4]
104
+ };
105
+ return p.prerelease != null || a.major !== p.major ? o(c) : a.major === 0 ? a.minor === p.minor && a.patch <= p.patch ? i(c) : o(c) : a.minor <= p.minor ? i(c) : o(c);
106
+ };
107
+ }
108
+ var Y = X(g), D = g.split(".")[0], _ = Symbol.for("opentelemetry.js.api." + D), w = k;
109
+ function I(r, e, t, n) {
110
+ var a;
111
+ n === void 0 && (n = !1);
112
+ var o = w[_] = (a = w[_]) !== null && a !== void 0 ? a : {
113
+ version: g
114
+ };
115
+ if (!n && o[r]) {
116
+ var i = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
117
+ return t.error(i.stack || i.message), !1;
118
+ }
119
+ if (o.version !== g) {
120
+ var i = new Error("@opentelemetry/api: Registration of version v" + o.version + " for " + r + " does not match previously registered API v" + g);
121
+ return t.error(i.stack || i.message), !1;
122
+ }
123
+ return o[r] = e, t.debug("@opentelemetry/api: Registered a global for " + r + " v" + g + "."), !0;
124
+ }
125
+ function O(r) {
126
+ var e, t, n = (e = w[_]) === null || e === void 0 ? void 0 : e.version;
127
+ if (!(!n || !Y(n)))
128
+ return (t = w[_]) === null || t === void 0 ? void 0 : t[r];
129
+ }
130
+ function T(r, e) {
131
+ e.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + g + ".");
132
+ var t = w[_];
133
+ t && delete t[r];
134
+ }
135
+ var q = function(r, e) {
136
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
137
+ if (!t)
138
+ return r;
139
+ var n = t.call(r), a, o = [], i;
140
+ try {
141
+ for (; (e === void 0 || e-- > 0) && !(a = n.next()).done; )
142
+ o.push(a.value);
143
+ } catch (u) {
144
+ i = { error: u };
145
+ } finally {
146
+ try {
147
+ a && !a.done && (t = n.return) && t.call(n);
148
+ } finally {
149
+ if (i)
150
+ throw i.error;
151
+ }
152
+ }
153
+ return o;
154
+ }, z = function(r, e, t) {
155
+ if (t || arguments.length === 2)
156
+ for (var n = 0, a = e.length, o; n < a; n++)
157
+ (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
158
+ return r.concat(o || Array.prototype.slice.call(e));
159
+ }, H = (
160
+ /** @class */
161
+ function() {
162
+ function r(e) {
163
+ this._namespace = e.namespace || "DiagComponentLogger";
164
+ }
165
+ return r.prototype.debug = function() {
166
+ for (var e = [], t = 0; t < arguments.length; t++)
167
+ e[t] = arguments[t];
168
+ return h("debug", this._namespace, e);
169
+ }, r.prototype.error = function() {
170
+ for (var e = [], t = 0; t < arguments.length; t++)
171
+ e[t] = arguments[t];
172
+ return h("error", this._namespace, e);
173
+ }, r.prototype.info = function() {
174
+ for (var e = [], t = 0; t < arguments.length; t++)
175
+ e[t] = arguments[t];
176
+ return h("info", this._namespace, e);
177
+ }, r.prototype.warn = function() {
178
+ for (var e = [], t = 0; t < arguments.length; t++)
179
+ e[t] = arguments[t];
180
+ return h("warn", this._namespace, e);
181
+ }, r.prototype.verbose = function() {
182
+ for (var e = [], t = 0; t < arguments.length; t++)
183
+ e[t] = arguments[t];
184
+ return h("verbose", this._namespace, e);
185
+ }, r;
186
+ }()
187
+ );
188
+ function h(r, e, t) {
189
+ var n = O("diag");
190
+ if (n)
191
+ return t.unshift(e), n[r].apply(n, z([], q(t), !1));
192
+ }
193
+ var l;
194
+ (function(r) {
195
+ r[r.NONE = 0] = "NONE", r[r.ERROR = 30] = "ERROR", r[r.WARN = 50] = "WARN", r[r.INFO = 60] = "INFO", r[r.DEBUG = 70] = "DEBUG", r[r.VERBOSE = 80] = "VERBOSE", r[r.ALL = 9999] = "ALL";
196
+ })(l || (l = {}));
197
+ function J(r, e) {
198
+ r < l.NONE ? r = l.NONE : r > l.ALL && (r = l.ALL), e = e || {};
199
+ function t(n, a) {
200
+ var o = e[n];
201
+ return typeof o == "function" && r >= a ? o.bind(e) : function() {
202
+ };
203
+ }
204
+ return {
205
+ error: t("error", l.ERROR),
206
+ warn: t("warn", l.WARN),
207
+ info: t("info", l.INFO),
208
+ debug: t("debug", l.DEBUG),
209
+ verbose: t("verbose", l.VERBOSE)
210
+ };
211
+ }
212
+ var Q = function(r, e) {
213
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
214
+ if (!t)
215
+ return r;
216
+ var n = t.call(r), a, o = [], i;
217
+ try {
218
+ for (; (e === void 0 || e-- > 0) && !(a = n.next()).done; )
219
+ o.push(a.value);
220
+ } catch (u) {
221
+ i = { error: u };
222
+ } finally {
223
+ try {
224
+ a && !a.done && (t = n.return) && t.call(n);
225
+ } finally {
226
+ if (i)
227
+ throw i.error;
228
+ }
229
+ }
230
+ return o;
231
+ }, Z = function(r, e, t) {
232
+ if (t || arguments.length === 2)
233
+ for (var n = 0, a = e.length, o; n < a; n++)
234
+ (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
235
+ return r.concat(o || Array.prototype.slice.call(e));
236
+ }, L = "diag", E = (
237
+ /** @class */
238
+ function() {
239
+ function r() {
240
+ function e(a) {
241
+ return function() {
242
+ for (var o = [], i = 0; i < arguments.length; i++)
243
+ o[i] = arguments[i];
244
+ var u = O("diag");
245
+ if (u)
246
+ return u[a].apply(u, Z([], Q(o), !1));
247
+ };
248
+ }
249
+ var t = this, n = function(a, o) {
250
+ var i, u, c;
251
+ if (o === void 0 && (o = { logLevel: l.INFO }), a === t) {
252
+ var f = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
253
+ return t.error((i = f.stack) !== null && i !== void 0 ? i : f.message), !1;
254
+ }
255
+ typeof o == "number" && (o = {
256
+ logLevel: o
257
+ });
258
+ var p = O("diag"), j = J((u = o.logLevel) !== null && u !== void 0 ? u : l.INFO, a);
259
+ if (p && !o.suppressOverrideMessage) {
260
+ var G = (c = new Error().stack) !== null && c !== void 0 ? c : "<failed to generate stacktrace>";
261
+ p.warn("Current logger will be overwritten from " + G), j.warn("Current logger will overwrite one already registered from " + G);
262
+ }
263
+ return I("diag", j, t, !0);
264
+ };
265
+ t.setLogger = n, t.disable = function() {
266
+ T(L, t);
267
+ }, t.createComponentLogger = function(a) {
268
+ return new H(a);
269
+ }, t.verbose = e("verbose"), t.debug = e("debug"), t.info = e("info"), t.warn = e("warn"), t.error = e("error");
270
+ }
271
+ return r.instance = function() {
272
+ return this._instance || (this._instance = new r()), this._instance;
273
+ }, r;
274
+ }()
275
+ ), ee = function(r, e) {
276
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
277
+ if (!t)
278
+ return r;
279
+ var n = t.call(r), a, o = [], i;
280
+ try {
281
+ for (; (e === void 0 || e-- > 0) && !(a = n.next()).done; )
282
+ o.push(a.value);
283
+ } catch (u) {
284
+ i = { error: u };
285
+ } finally {
286
+ try {
287
+ a && !a.done && (t = n.return) && t.call(n);
288
+ } finally {
289
+ if (i)
290
+ throw i.error;
291
+ }
292
+ }
293
+ return o;
294
+ }, te = function(r) {
295
+ var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
296
+ if (t)
297
+ return t.call(r);
298
+ if (r && typeof r.length == "number")
299
+ return {
300
+ next: function() {
301
+ return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
302
+ }
303
+ };
304
+ throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
305
+ }, re = (
306
+ /** @class */
307
+ function() {
308
+ function r(e) {
309
+ this._entries = e ? new Map(e) : /* @__PURE__ */ new Map();
310
+ }
311
+ return r.prototype.getEntry = function(e) {
312
+ var t = this._entries.get(e);
313
+ if (t)
314
+ return Object.assign({}, t);
315
+ }, r.prototype.getAllEntries = function() {
316
+ return Array.from(this._entries.entries()).map(function(e) {
317
+ var t = ee(e, 2), n = t[0], a = t[1];
318
+ return [n, a];
319
+ });
320
+ }, r.prototype.setEntry = function(e, t) {
321
+ var n = new r(this._entries);
322
+ return n._entries.set(e, t), n;
323
+ }, r.prototype.removeEntry = function(e) {
324
+ var t = new r(this._entries);
325
+ return t._entries.delete(e), t;
326
+ }, r.prototype.removeEntries = function() {
327
+ for (var e, t, n = [], a = 0; a < arguments.length; a++)
328
+ n[a] = arguments[a];
329
+ var o = new r(this._entries);
330
+ try {
331
+ for (var i = te(n), u = i.next(); !u.done; u = i.next()) {
332
+ var c = u.value;
333
+ o._entries.delete(c);
334
+ }
335
+ } catch (f) {
336
+ e = { error: f };
337
+ } finally {
338
+ try {
339
+ u && !u.done && (t = i.return) && t.call(i);
340
+ } finally {
341
+ if (e)
342
+ throw e.error;
343
+ }
344
+ }
345
+ return o;
346
+ }, r.prototype.clear = function() {
347
+ return new r();
348
+ }, r;
349
+ }()
350
+ );
351
+ E.instance();
352
+ function ne(r) {
353
+ return r === void 0 && (r = {}), new re(new Map(Object.entries(r)));
354
+ }
355
+ function ae(r) {
356
+ return Symbol.for(r);
357
+ }
358
+ var oe = (
359
+ /** @class */
360
+ /* @__PURE__ */ function() {
361
+ function r(e) {
362
+ var t = this;
363
+ t._currentContext = e ? new Map(e) : /* @__PURE__ */ new Map(), t.getValue = function(n) {
364
+ return t._currentContext.get(n);
365
+ }, t.setValue = function(n, a) {
366
+ var o = new r(t._currentContext);
367
+ return o._currentContext.set(n, a), o;
368
+ }, t.deleteValue = function(n) {
369
+ var a = new r(t._currentContext);
370
+ return a._currentContext.delete(n), a;
371
+ };
372
+ }
373
+ return r;
374
+ }()
375
+ ), ie = new oe(), ue = {
376
+ get: function(r, e) {
377
+ if (r != null)
378
+ return r[e];
379
+ },
380
+ keys: function(r) {
381
+ return r == null ? [] : Object.keys(r);
382
+ }
383
+ }, se = {
384
+ set: function(r, e, t) {
385
+ r != null && (r[e] = t);
386
+ }
387
+ }, ce = function(r, e) {
388
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
389
+ if (!t)
390
+ return r;
391
+ var n = t.call(r), a, o = [], i;
392
+ try {
393
+ for (; (e === void 0 || e-- > 0) && !(a = n.next()).done; )
394
+ o.push(a.value);
395
+ } catch (u) {
396
+ i = { error: u };
397
+ } finally {
398
+ try {
399
+ a && !a.done && (t = n.return) && t.call(n);
400
+ } finally {
401
+ if (i)
402
+ throw i.error;
403
+ }
404
+ }
405
+ return o;
406
+ }, le = function(r, e, t) {
407
+ if (t || arguments.length === 2)
408
+ for (var n = 0, a = e.length, o; n < a; n++)
409
+ (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
410
+ return r.concat(o || Array.prototype.slice.call(e));
411
+ }, fe = (
412
+ /** @class */
413
+ function() {
414
+ function r() {
415
+ }
416
+ return r.prototype.active = function() {
417
+ return ie;
418
+ }, r.prototype.with = function(e, t, n) {
419
+ for (var a = [], o = 3; o < arguments.length; o++)
420
+ a[o - 3] = arguments[o];
421
+ return t.call.apply(t, le([n], ce(a), !1));
422
+ }, r.prototype.bind = function(e, t) {
423
+ return t;
424
+ }, r.prototype.enable = function() {
425
+ return this;
426
+ }, r.prototype.disable = function() {
427
+ return this;
428
+ }, r;
429
+ }()
430
+ ), pe = function(r, e) {
431
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
432
+ if (!t)
433
+ return r;
434
+ var n = t.call(r), a, o = [], i;
435
+ try {
436
+ for (; (e === void 0 || e-- > 0) && !(a = n.next()).done; )
437
+ o.push(a.value);
438
+ } catch (u) {
439
+ i = { error: u };
440
+ } finally {
441
+ try {
442
+ a && !a.done && (t = n.return) && t.call(n);
443
+ } finally {
444
+ if (i)
445
+ throw i.error;
446
+ }
447
+ }
448
+ return o;
449
+ }, ge = function(r, e, t) {
450
+ if (t || arguments.length === 2)
451
+ for (var n = 0, a = e.length, o; n < a; n++)
452
+ (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
453
+ return r.concat(o || Array.prototype.slice.call(e));
454
+ }, N = "context", he = new fe(), V = (
455
+ /** @class */
456
+ function() {
457
+ function r() {
458
+ }
459
+ return r.getInstance = function() {
460
+ return this._instance || (this._instance = new r()), this._instance;
461
+ }, r.prototype.setGlobalContextManager = function(e) {
462
+ return I(N, e, E.instance());
463
+ }, r.prototype.active = function() {
464
+ return this._getContextManager().active();
465
+ }, r.prototype.with = function(e, t, n) {
466
+ for (var a, o = [], i = 3; i < arguments.length; i++)
467
+ o[i - 3] = arguments[i];
468
+ return (a = this._getContextManager()).with.apply(a, ge([e, t, n], pe(o), !1));
469
+ }, r.prototype.bind = function(e, t) {
470
+ return this._getContextManager().bind(e, t);
471
+ }, r.prototype._getContextManager = function() {
472
+ return O(N) || he;
473
+ }, r.prototype.disable = function() {
474
+ this._getContextManager().disable(), T(N, E.instance());
475
+ }, r;
476
+ }()
477
+ ), R;
478
+ (function(r) {
479
+ r[r.UNSET = 0] = "UNSET", r[r.OK = 1] = "OK", r[r.ERROR = 2] = "ERROR";
480
+ })(R || (R = {}));
481
+ var de = V.getInstance(), ve = (
482
+ /** @class */
483
+ function() {
484
+ function r() {
485
+ }
486
+ return r.prototype.inject = function(e, t) {
487
+ }, r.prototype.extract = function(e, t) {
488
+ return e;
489
+ }, r.prototype.fields = function() {
490
+ return [];
491
+ }, r;
492
+ }()
493
+ ), M = ae("OpenTelemetry Baggage Key");
494
+ function K(r) {
495
+ return r.getValue(M) || void 0;
496
+ }
497
+ function ye() {
498
+ return K(V.getInstance().active());
499
+ }
500
+ function me(r, e) {
501
+ return r.setValue(M, e);
502
+ }
503
+ function be(r) {
504
+ return r.deleteValue(M);
505
+ }
506
+ var x = "propagation", _e = new ve(), we = (
507
+ /** @class */
508
+ function() {
509
+ function r() {
510
+ this.createBaggage = ne, this.getBaggage = K, this.getActiveBaggage = ye, this.setBaggage = me, this.deleteBaggage = be;
511
+ }
512
+ return r.getInstance = function() {
513
+ return this._instance || (this._instance = new r()), this._instance;
514
+ }, r.prototype.setGlobalPropagator = function(e) {
515
+ return I(x, e, E.instance());
516
+ }, r.prototype.inject = function(e, t, n) {
517
+ return n === void 0 && (n = se), this._getGlobalPropagator().inject(e, t, n);
518
+ }, r.prototype.extract = function(e, t, n) {
519
+ return n === void 0 && (n = ue), this._getGlobalPropagator().extract(e, t, n);
520
+ }, r.prototype.fields = function() {
521
+ return this._getGlobalPropagator().fields();
522
+ }, r.prototype.disable = function() {
523
+ T(x, E.instance());
524
+ }, r.prototype._getGlobalPropagator = function() {
525
+ return O(x) || _e;
526
+ }, r;
527
+ }()
528
+ ), Oe = we.getInstance();
529
+ const $ = ["bench", "debug", "prod"], Ee = (r) => (e) => $.indexOf(e) >= $.indexOf(r), y = class y {
530
+ constructor(e, t = Ee("debug")) {
531
+ s(this, "meta", b.NOOP);
532
+ s(this, "tracer");
533
+ s(this, "filter");
534
+ this.tracer = e, this.filter = t;
535
+ }
536
+ child(e) {
537
+ const t = new y(this.tracer, this.filter);
538
+ return t.meta = e, t;
539
+ }
540
+ /**
541
+ * Starts a new span in the debug environment. If a span already exists in the
542
+ * current context, it will be used as the parent span.
543
+ *
544
+ * @param key - The name of the span.
545
+ * @param f - The function to run under the span.
546
+ * @returns A span that tracks program execution. If the Tracer's environment
547
+ * rejects the 'debug' environment or the Tracer is noop, a NoopSpan is returned.
548
+ */
549
+ debug(e, t) {
550
+ return this.trace(e, "debug", t);
551
+ }
552
+ /**
553
+ * Starts a new span in the bench environment. If a span already exists in the
554
+ * current context, it will be used as the parent span.
555
+ *
556
+ * @param key - The name of the span.
557
+ * @param f - The function to run under the span.
558
+ * @returns A span that tracks program execution. If the Tracer's environment
559
+ * rejects the 'bench' environment or the Tracer is noop, a NoopSpan is returned.
560
+ */
561
+ bench(e, t) {
562
+ return this.trace(e, "bench", t);
563
+ }
564
+ /**
565
+ * Starts a new span in the prod environment. If a span already exists in the
566
+ * current context, it will be used as the parent span.
567
+ *
568
+ * @param key - The name of the span.
569
+ * @param f - The function to run under the span.
570
+ * @returns A span that tracks program execution. If the Tracer's environment
571
+ * rejects the 'prod' environment or the Tracer is noop, a NoopSpan is returned.
572
+ */
573
+ prod(e, t) {
574
+ return this.trace(e, "prod", t);
575
+ }
576
+ /**
577
+ * Stars a new span with the given key and environment. If a span already
578
+ * exists in the current context, it will be used as the parent span.
579
+ *
580
+ * @param key - The name of the span.
581
+ * @param env - The environment to run the span under.
582
+ * @param f - The function to run under the span.
583
+ * @returns A span that tracks program execution. If the Tracer's environment
584
+ * rejects the provided span or the Tracer is noop, a NoopSpan is returned.
585
+ */
586
+ trace(e, t, n) {
587
+ return this.meta.noop || !this.filter(t) ? n(new Ne(e)) : this.tracer.startActiveSpan(e, (a) => {
588
+ const o = new Ae(e, a), i = n(o);
589
+ return a.end(), i;
590
+ });
591
+ }
592
+ /**
593
+ * Injects metadata about the current trace into the provided carrier. This
594
+ * metadata can be paresed on teh other side of a network or IPC request to
595
+ * allow the trace to proapgate across services.
596
+ *
597
+ * @param carrier - The carrier to inject the metadata into.
598
+ */
599
+ propagate(e) {
600
+ if (this.meta.noop)
601
+ return;
602
+ const t = de.active();
603
+ Oe.inject(t, e, {
604
+ set: (n, a, o) => {
605
+ n[a] = o;
606
+ }
607
+ });
608
+ }
609
+ };
610
+ /** Tracer implementation that does nothing */
611
+ s(y, "NOOP", new y());
612
+ let C = y;
613
+ class Ae {
614
+ constructor(e, t) {
615
+ s(this, "key");
616
+ s(this, "otel");
617
+ this.key = e, this.otel = t;
618
+ }
619
+ set(e, t) {
620
+ this.otel.setAttribute(e, t);
621
+ }
622
+ recordError(e) {
623
+ e != null && (this.otel.recordException(e), this.otel.setStatus({ code: R.ERROR }));
624
+ }
625
+ }
626
+ class Ne {
627
+ constructor(e) {
628
+ s(this, "key");
629
+ this.key = e;
630
+ }
631
+ set(e, t) {
632
+ }
633
+ recordError(e) {
634
+ }
635
+ }
636
+ const m = class m {
637
+ constructor({
638
+ key: e = "",
639
+ serviceName: t = "",
640
+ logger: n = P.NOOP,
641
+ tracer: a = C.NOOP,
642
+ noop: o = !1,
643
+ // eslint-disable-next-line @typescript-eslint/naming-convention
644
+ __meta: i
645
+ }) {
646
+ s(this, "meta");
647
+ s(this, "T");
648
+ s(this, "L");
649
+ this.meta = i ?? new b(e, e, t, o), this.T = a.child(this.meta), this.L = n.child(this.meta);
650
+ }
651
+ child(e) {
652
+ const t = this.meta.child(e);
653
+ return new m({ __meta: t, tracer: this.T, logger: this.L });
654
+ }
655
+ };
656
+ s(m, "NOOP", new m({ noop: !0 }));
657
+ let B = m;
658
+ const Ce = B.NOOP;
659
+ export {
660
+ V as C,
661
+ E as D,
662
+ B as I,
663
+ S as L,
664
+ Ce as N,
665
+ C as T,
666
+ Ae as _,
667
+ P as a,
668
+ Ne as b,
669
+ Pe as c,
670
+ ae as d,
671
+ O as g,
672
+ Re as l,
673
+ I as r,
674
+ T as u
675
+ };
676
+ //# sourceMappingURL=instrumentation-wOKsWHkZ.js.map