@synnaxlabs/alamos 0.45.1 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +21 -0
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{instrumentation-Bmq0SwpZ.js → instrumentation-B82TXsFM.js} +16 -16
- package/dist/instrumentation-BUpiX8Rz.cjs +1 -0
- package/package.json +5 -5
- package/dist/instrumentation-CGaKhn8G.cjs +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
> @synnaxlabs/alamos@0.46.0 build /home/runner/work/synnax/synnax/alamos/ts
|
|
3
|
+
> tsc --noEmit && vite build
|
|
4
|
+
|
|
5
|
+
[34m Synnax - Production mode[0m
|
|
6
|
+
[36mvite v7.1.5 [32mbuilding for production...[36m[39m
|
|
7
|
+
transforming...
|
|
8
|
+
[32m✓[39m 54 modules transformed.
|
|
9
|
+
rendering chunks...
|
|
10
|
+
|
|
11
|
+
[vite:dts] Start generate declaration files...
|
|
12
|
+
computing gzip size...
|
|
13
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m 0.61 kB[22m[1m[22m[2m │ gzip: 0.36 kB[22m
|
|
14
|
+
[2mdist/[22m[36mdev.js [39m[1m[2m 5.29 kB[22m[1m[22m[2m │ gzip: 1.50 kB[22m
|
|
15
|
+
[2mdist/[22m[36minstrumentation-B82TXsFM.js [39m[1m[2m20.58 kB[22m[1m[22m[2m │ gzip: 5.09 kB[22m
|
|
16
|
+
[vite:dts] Declaration files built in 2163ms.
|
|
17
|
+
|
|
18
|
+
[2mdist/[22m[36mindex.cjs [39m[1m[2m 0.74 kB[22m[1m[22m[2m │ gzip: 0.33 kB[22m
|
|
19
|
+
[2mdist/[22m[36mdev.cjs [39m[1m[2m 4.09 kB[22m[1m[22m[2m │ gzip: 1.37 kB[22m
|
|
20
|
+
[2mdist/[22m[36minstrumentation-BUpiX8Rz.cjs [39m[1m[2m13.63 kB[22m[1m[22m[2m │ gzip: 4.14 kB[22m
|
|
21
|
+
[32m✓ built in 2.58s[39m
|
package/dist/dev.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./instrumentation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./instrumentation-BUpiX8Rz.cjs");var v;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(v||(v={}));var T="0000000000000000",S="00000000000000000000000000000000",N={traceId:S,spanId:T,traceFlags:v.NONE},u=(function(){function t(e){e===void 0&&(e=N),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})(),d=o.createContextKey("OpenTelemetry Context Key SPAN");function l(t){return t.getValue(d)||void 0}function m(){return l(o.ContextAPI.getInstance().active())}function g(t,e){return t.setValue(d,e)}function D(t){return t.deleteValue(d)}function E(t,e){return g(t,new u(e))}function P(t){var e;return(e=l(t))===null||e===void 0?void 0:e.spanContext()}var w=/^([0-9a-f]{32})$/i,C=/^[0-9a-f]{16}$/i;function R(t){return w.test(t)&&t!==S}function b(t){return C.test(t)&&t!==T}function A(t){return R(t.traceId)&&b(t.spanId)}function V(t){return new u(t)}var p=o.ContextAPI.getInstance(),I=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=p.active());var i=!!r?.root;if(i)return new u;var a=n&&P(n);return O(a)&&A(a)?new u(a):new u},t.prototype.startActiveSpan=function(e,r,n,i){var a,c,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(a=r,s=n):(a=r,c=n,s=i);var _=c??p.active(),h=this.startSpan(e,a,_),x=g(_,h);return p.with(x,s,void 0,h)}},t})();function O(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var L=new I,k=(function(){function t(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,i){var a=this._getTracer();return Reflect.apply(a.startActiveSpan,a,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):L},t})(),G=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new I},t})(),M=new G,y=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new k(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:M},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)},t})(),f="trace",K=(function(){function t(){this._proxyTracerProvider=new y,this.wrapSpanContext=V,this.isSpanContextValid=A,this.deleteSpan=D,this.getSpan=l,this.getActiveSpan=m,this.getSpanContext=P,this.setSpan=g,this.setSpanContext=E}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=o.registerGlobal(f,this._proxyTracerProvider,o.DiagAPI.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return o.getGlobal(f)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){o.unregisterGlobal(f,o.DiagAPI.instance()),this._proxyTracerProvider=new y},t})(),X=K.getInstance();const $=()=>{const t="synnax";return new o.Instrumentation({key:"",serviceName:t,logger:new o.Logger,tracer:new o.Tracer(X.getTracerProvider().getTracer("synnax"))})};exports.instrumentation=$;
|
package/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as m, C as T, r as D, D as h, g as E, u as w, I as C, T as R, a as V } from "./instrumentation-
|
|
1
|
+
import { d as m, C as T, r as D, D as h, g as E, u as w, I as C, T as R, a as V } from "./instrumentation-B82TXsFM.js";
|
|
2
2
|
var f;
|
|
3
3
|
(function(t) {
|
|
4
4
|
t[t.NONE = 0] = "NONE", t[t.SAMPLED = 1] = "SAMPLED";
|
|
@@ -9,7 +9,7 @@ var S = "0000000000000000", P = "00000000000000000000000000000000", b = {
|
|
|
9
9
|
traceFlags: f.NONE
|
|
10
10
|
}, i = (
|
|
11
11
|
/** @class */
|
|
12
|
-
function() {
|
|
12
|
+
(function() {
|
|
13
13
|
function t(e) {
|
|
14
14
|
e === void 0 && (e = b), this._spanContext = e;
|
|
15
15
|
}
|
|
@@ -34,7 +34,7 @@ var S = "0000000000000000", P = "00000000000000000000000000000000", b = {
|
|
|
34
34
|
return !1;
|
|
35
35
|
}, t.prototype.recordException = function(e, r) {
|
|
36
36
|
}, t;
|
|
37
|
-
}()
|
|
37
|
+
})()
|
|
38
38
|
), v = m("OpenTelemetry Context Key SPAN");
|
|
39
39
|
function d(t) {
|
|
40
40
|
return t.getValue(v) || void 0;
|
|
@@ -70,7 +70,7 @@ function $(t) {
|
|
|
70
70
|
}
|
|
71
71
|
var c = T.getInstance(), x = (
|
|
72
72
|
/** @class */
|
|
73
|
-
function() {
|
|
73
|
+
(function() {
|
|
74
74
|
function t() {
|
|
75
75
|
}
|
|
76
76
|
return t.prototype.startSpan = function(e, r, n) {
|
|
@@ -88,14 +88,14 @@ var c = T.getInstance(), x = (
|
|
|
88
88
|
return c.with(N, u, void 0, _);
|
|
89
89
|
}
|
|
90
90
|
}, t;
|
|
91
|
-
}()
|
|
91
|
+
})()
|
|
92
92
|
);
|
|
93
93
|
function j(t) {
|
|
94
94
|
return typeof t == "object" && typeof t.spanId == "string" && typeof t.traceId == "string" && typeof t.traceFlags == "number";
|
|
95
95
|
}
|
|
96
96
|
var B = new x(), F = (
|
|
97
97
|
/** @class */
|
|
98
|
-
function() {
|
|
98
|
+
(function() {
|
|
99
99
|
function t(e, r, n, a) {
|
|
100
100
|
this._provider = e, this.name = r, this.version = n, this.options = a;
|
|
101
101
|
}
|
|
@@ -110,19 +110,19 @@ var B = new x(), F = (
|
|
|
110
110
|
var e = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
111
111
|
return e ? (this._delegate = e, this._delegate) : B;
|
|
112
112
|
}, t;
|
|
113
|
-
}()
|
|
113
|
+
})()
|
|
114
114
|
), W = (
|
|
115
115
|
/** @class */
|
|
116
|
-
function() {
|
|
116
|
+
(function() {
|
|
117
117
|
function t() {
|
|
118
118
|
}
|
|
119
119
|
return t.prototype.getTracer = function(e, r, n) {
|
|
120
120
|
return new x();
|
|
121
121
|
}, t;
|
|
122
|
-
}()
|
|
122
|
+
})()
|
|
123
123
|
), Y = new W(), y = (
|
|
124
124
|
/** @class */
|
|
125
|
-
function() {
|
|
125
|
+
(function() {
|
|
126
126
|
function t() {
|
|
127
127
|
}
|
|
128
128
|
return t.prototype.getTracer = function(e, r, n) {
|
|
@@ -137,10 +137,10 @@ var B = new x(), F = (
|
|
|
137
137
|
var a;
|
|
138
138
|
return (a = this._delegate) === null || a === void 0 ? void 0 : a.getTracer(e, r, n);
|
|
139
139
|
}, t;
|
|
140
|
-
}()
|
|
140
|
+
})()
|
|
141
141
|
), p = "trace", q = (
|
|
142
142
|
/** @class */
|
|
143
|
-
function() {
|
|
143
|
+
(function() {
|
|
144
144
|
function t() {
|
|
145
145
|
this._proxyTracerProvider = new y(), this.wrapSpanContext = $, this.isSpanContextValid = I, this.deleteSpan = O, this.getSpan = d, this.getActiveSpan = L, this.getSpanContext = A, this.setSpan = l, this.setSpanContext = k;
|
|
146
146
|
}
|
|
@@ -156,7 +156,7 @@ var B = new x(), F = (
|
|
|
156
156
|
}, t.prototype.disable = function() {
|
|
157
157
|
w(p, h.instance()), this._proxyTracerProvider = new y();
|
|
158
158
|
}, t;
|
|
159
|
-
}()
|
|
159
|
+
})()
|
|
160
160
|
), z = q.getInstance();
|
|
161
161
|
const J = () => {
|
|
162
162
|
const t = "synnax";
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./instrumentation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./instrumentation-BUpiX8Rz.cjs"),o=Object.freeze(Object.defineProperty({__proto__:null,Instrumentation:e.Instrumentation,LOG_LEVELS:e.LOG_LEVELS,Logger:e.Logger,NOOP:e.NOOP,NoopSpan:e.NoopSpan,Tracer:e.Tracer,_Span:e._Span,logLevelKeyFiler:e.logLevelKeyFiler,logThresholdFilter:e.logThresholdFilter},Symbol.toStringTag,{value:"Module"}));exports.Instrumentation=e.Instrumentation;exports.LOG_LEVELS=e.LOG_LEVELS;exports.Logger=e.Logger;exports.NOOP=e.NOOP;exports.NoopSpan=e.NoopSpan;exports.Tracer=e.Tracer;exports._Span=e._Span;exports.logLevelKeyFiler=e.logLevelKeyFiler;exports.logThresholdFilter=e.logThresholdFilter;exports.alamos=o;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as e, L as a, a as o, N as r, b as l, T as s, _ as t, l as n, c as p } from "./instrumentation-
|
|
1
|
+
import { I as e, L as a, a as o, N as r, b as l, T as s, _ as t, l as n, c as p } from "./instrumentation-B82TXsFM.js";
|
|
2
2
|
const g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
3
|
__proto__: null,
|
|
4
4
|
Instrumentation: e,
|
|
@@ -148,7 +148,7 @@ var K = function(r, e) {
|
|
|
148
148
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
149
149
|
}, W = (
|
|
150
150
|
/** @class */
|
|
151
|
-
function() {
|
|
151
|
+
(function() {
|
|
152
152
|
function r(e) {
|
|
153
153
|
this._namespace = e.namespace || "DiagComponentLogger";
|
|
154
154
|
}
|
|
@@ -173,7 +173,7 @@ var K = function(r, e) {
|
|
|
173
173
|
e[t] = arguments[t];
|
|
174
174
|
return d("verbose", this._namespace, e);
|
|
175
175
|
}, r;
|
|
176
|
-
}()
|
|
176
|
+
})()
|
|
177
177
|
);
|
|
178
178
|
function d(r, e, t) {
|
|
179
179
|
var n = y("diag");
|
|
@@ -221,7 +221,7 @@ var Y = function(r, e) {
|
|
|
221
221
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
222
222
|
}, q = "diag", m = (
|
|
223
223
|
/** @class */
|
|
224
|
-
function() {
|
|
224
|
+
(function() {
|
|
225
225
|
function r() {
|
|
226
226
|
function e(o) {
|
|
227
227
|
return function() {
|
|
@@ -257,7 +257,7 @@ var Y = function(r, e) {
|
|
|
257
257
|
return r.instance = function() {
|
|
258
258
|
return this._instance || (this._instance = new r()), this._instance;
|
|
259
259
|
}, r;
|
|
260
|
-
}()
|
|
260
|
+
})()
|
|
261
261
|
), z = function(r, e) {
|
|
262
262
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
263
263
|
if (!t) return r;
|
|
@@ -285,7 +285,7 @@ var Y = function(r, e) {
|
|
|
285
285
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
286
286
|
}, J = (
|
|
287
287
|
/** @class */
|
|
288
|
-
function() {
|
|
288
|
+
(function() {
|
|
289
289
|
function r(e) {
|
|
290
290
|
this._entries = e ? new Map(e) : /* @__PURE__ */ new Map();
|
|
291
291
|
}
|
|
@@ -326,7 +326,7 @@ var Y = function(r, e) {
|
|
|
326
326
|
}, r.prototype.clear = function() {
|
|
327
327
|
return new r();
|
|
328
328
|
}, r;
|
|
329
|
-
}()
|
|
329
|
+
})()
|
|
330
330
|
);
|
|
331
331
|
m.instance();
|
|
332
332
|
function Q(r) {
|
|
@@ -337,7 +337,7 @@ function Z(r) {
|
|
|
337
337
|
}
|
|
338
338
|
var L = (
|
|
339
339
|
/** @class */
|
|
340
|
-
/* @__PURE__ */ function() {
|
|
340
|
+
/* @__PURE__ */ (function() {
|
|
341
341
|
function r(e) {
|
|
342
342
|
var t = this;
|
|
343
343
|
t._currentContext = e ? new Map(e) : /* @__PURE__ */ new Map(), t.getValue = function(n) {
|
|
@@ -351,7 +351,7 @@ var L = (
|
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
353
|
return r;
|
|
354
|
-
}()
|
|
354
|
+
})()
|
|
355
355
|
), ee = new L(), te = {
|
|
356
356
|
get: function(r, e) {
|
|
357
357
|
if (r != null)
|
|
@@ -386,7 +386,7 @@ var L = (
|
|
|
386
386
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
387
387
|
}, oe = (
|
|
388
388
|
/** @class */
|
|
389
|
-
function() {
|
|
389
|
+
(function() {
|
|
390
390
|
function r() {
|
|
391
391
|
}
|
|
392
392
|
return r.prototype.active = function() {
|
|
@@ -402,7 +402,7 @@ var L = (
|
|
|
402
402
|
}, r.prototype.disable = function() {
|
|
403
403
|
return this;
|
|
404
404
|
}, r;
|
|
405
|
-
}()
|
|
405
|
+
})()
|
|
406
406
|
), ie = function(r, e) {
|
|
407
407
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
408
408
|
if (!t) return r;
|
|
@@ -425,7 +425,7 @@ var L = (
|
|
|
425
425
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
426
426
|
}, E = "context", ue = new oe(), G = (
|
|
427
427
|
/** @class */
|
|
428
|
-
function() {
|
|
428
|
+
(function() {
|
|
429
429
|
function r() {
|
|
430
430
|
}
|
|
431
431
|
return r.getInstance = function() {
|
|
@@ -445,14 +445,14 @@ var L = (
|
|
|
445
445
|
}, r.prototype.disable = function() {
|
|
446
446
|
this._getContextManager().disable(), P(E, m.instance());
|
|
447
447
|
}, r;
|
|
448
|
-
}()
|
|
448
|
+
})()
|
|
449
449
|
), N;
|
|
450
450
|
(function(r) {
|
|
451
451
|
r[r.UNSET = 0] = "UNSET", r[r.OK = 1] = "OK", r[r.ERROR = 2] = "ERROR";
|
|
452
452
|
})(N || (N = {}));
|
|
453
453
|
var ce = G.getInstance(), le = (
|
|
454
454
|
/** @class */
|
|
455
|
-
function() {
|
|
455
|
+
(function() {
|
|
456
456
|
function r() {
|
|
457
457
|
}
|
|
458
458
|
return r.prototype.inject = function(e, t) {
|
|
@@ -461,7 +461,7 @@ var ce = G.getInstance(), le = (
|
|
|
461
461
|
}, r.prototype.fields = function() {
|
|
462
462
|
return [];
|
|
463
463
|
}, r;
|
|
464
|
-
}()
|
|
464
|
+
})()
|
|
465
465
|
), R = Z("OpenTelemetry Baggage Key");
|
|
466
466
|
function j(r) {
|
|
467
467
|
return r.getValue(R) || void 0;
|
|
@@ -477,7 +477,7 @@ function he(r) {
|
|
|
477
477
|
}
|
|
478
478
|
var A = "propagation", de = new le(), ge = (
|
|
479
479
|
/** @class */
|
|
480
|
-
function() {
|
|
480
|
+
(function() {
|
|
481
481
|
function r() {
|
|
482
482
|
this.createBaggage = Q, this.getBaggage = j, this.getActiveBaggage = fe, this.setBaggage = pe, this.deleteBaggage = he;
|
|
483
483
|
}
|
|
@@ -496,7 +496,7 @@ var A = "propagation", de = new le(), ge = (
|
|
|
496
496
|
}, r.prototype._getGlobalPropagator = function() {
|
|
497
497
|
return y(A) || de;
|
|
498
498
|
}, r;
|
|
499
|
-
}()
|
|
499
|
+
})()
|
|
500
500
|
), ve = ge.getInstance();
|
|
501
501
|
const M = ["bench", "debug", "prod"], ye = (r) => (e) => M.indexOf(e) >= M.indexOf(r);
|
|
502
502
|
class w {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class h{_noop=!1;key;path;serviceName;constructor(e,t,n="",o=!1){this.key=e,this.path=t,this.serviceName=n,this._noop=o}child(e){return new h(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}static NOOP=new h("","","")}const P=["debug","info","warn","error"],K=r=>{const e=P.indexOf(r);return({level:t})=>P.indexOf(t)>=e},V=r=>{const{include:e,exclude:t}=r;return({path:n})=>!(e!=null&&!e.some(o=>n.startsWith(o))||t!=null&&t.some(o=>n.startsWith(o)))};class y{meta=h.NOOP;filters;constructor(e={}){const{filters:t=[]}=e;this.filters=t}filter(e){return!this.meta.noop&&this.filters.every(t=>t({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const t=new y({filters:this.filters});return t.meta=e,t}debug(e,t,n=!1){!this.filter("debug")&&!n||(t==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,O(t)))}info(e,t,n=!1){!this.filter("info")&&!n||(t==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,O(t)))}warn(e,t,n=!1){!this.filter("warn")&&!n||(t==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,O(t)))}error(e,t,n=!1){!this.filter("error")&&!n||(t==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,O(t)))}static NOOP=new y}const O=r=>typeof r=="function"?r():r;var k=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},p="1.9.0",M=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function U(r){var e=new Set([r]),t=new Set,n=r.match(M);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(s){return s===r};function a(u){return t.add(u),!1}function i(u){return e.add(u),!0}return function(s){if(e.has(s))return!0;if(t.has(s))return!1;var l=s.match(M);if(!l)return a(s);var f={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return f.prerelease!=null||o.major!==f.major?a(s):o.major===0?o.minor===f.minor&&o.patch<=f.patch?i(s):a(s):o.minor<=f.minor?i(s):a(s)}}var W=U(p),X=p.split(".")[0],m=Symbol.for("opentelemetry.js.api."+X),b=k;function E(r,e,t,n){var o;n===void 0&&(n=!1);var a=b[m]=(o=b[m])!==null&&o!==void 0?o:{version:p};if(!n&&a[r]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return t.error(i.stack||i.message),!1}if(a.version!==p){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+r+" does not match previously registered API v"+p);return t.error(i.stack||i.message),!1}return a[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+p+"."),!0}function g(r){var e,t,n=(e=b[m])===null||e===void 0?void 0:e.version;if(!(!n||!W(n)))return(t=b[m])===null||t===void 0?void 0:t[r]}function A(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+p+".");var t=b[m];t&&delete t[r]}var Y=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},D=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},q=(function(){function r(e){this._namespace=e.namespace||"DiagComponentLogger"}return r.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("debug",this._namespace,e)},r.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("error",this._namespace,e)},r.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("info",this._namespace,e)},r.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("warn",this._namespace,e)},r.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("verbose",this._namespace,e)},r})();function v(r,e,t){var n=g("diag");if(n)return t.unshift(e),n[r].apply(n,D([],Y(t),!1))}var c;(function(r){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"})(c||(c={}));function z(r,e){r<c.NONE?r=c.NONE:r>c.ALL&&(r=c.ALL),e=e||{};function t(n,o){var a=e[n];return typeof a=="function"&&r>=o?a.bind(e):function(){}}return{error:t("error",c.ERROR),warn:t("warn",c.WARN),info:t("info",c.INFO),debug:t("debug",c.DEBUG),verbose:t("verbose",c.VERBOSE)}}var H=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},J=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},Q="diag",d=(function(){function r(){function e(o){return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var u=g("diag");if(u)return u[o].apply(u,J([],H(a),!1))}}var t=this,n=function(o,a){var i,u,s;if(a===void 0&&(a={logLevel:c.INFO}),o===t){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof a=="number"&&(a={logLevel:a});var f=g("diag"),B=z((u=a.logLevel)!==null&&u!==void 0?u:c.INFO,o);if(f&&!a.suppressOverrideMessage){var G=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+G),B.warn("Current logger will overwrite one already registered from "+G)}return E("diag",B,t,!0)};t.setLogger=n,t.disable=function(){A(Q,t)},t.createComponentLogger=function(o){return new q(o)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return r.instance=function(){return this._instance||(this._instance=new r),this._instance},r})(),Z=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},L=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ee=(function(){function r(e){this._entries=e?new Map(e):new Map}return r.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},r.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=Z(e,2),n=t[0],o=t[1];return[n,o]})},r.prototype.setEntry=function(e,t){var n=new r(this._entries);return n._entries.set(e,t),n},r.prototype.removeEntry=function(e){var t=new r(this._entries);return t._entries.delete(e),t},r.prototype.removeEntries=function(){for(var e,t,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var a=new r(this._entries);try{for(var i=L(n),u=i.next();!u.done;u=i.next()){var s=u.value;a._entries.delete(s)}}catch(l){e={error:l}}finally{try{u&&!u.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return a},r.prototype.clear=function(){return new r},r})();d.instance();function te(r){return r===void 0&&(r={}),new ee(new Map(Object.entries(r)))}function j(r){return Symbol.for(r)}var re=(function(){function r(e){var t=this;t._currentContext=e?new Map(e):new Map,t.getValue=function(n){return t._currentContext.get(n)},t.setValue=function(n,o){var a=new r(t._currentContext);return a._currentContext.set(n,o),a},t.deleteValue=function(n){var o=new r(t._currentContext);return o._currentContext.delete(n),o}}return r})(),ne=new re,ae={get:function(r,e){if(r!=null)return r[e]},keys:function(r){return r==null?[]:Object.keys(r)}},oe={set:function(r,e,t){r!=null&&(r[e]=t)}},ie=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},ue=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},se=(function(){function r(){}return r.prototype.active=function(){return ne},r.prototype.with=function(e,t,n){for(var o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return t.call.apply(t,ue([n],ie(o),!1))},r.prototype.bind=function(e,t){return t},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r})(),ce=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},le=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},N="context",fe=new se,I=(function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(e){return E(N,e,d.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(e,t,n){for(var o,a=[],i=3;i<arguments.length;i++)a[i-3]=arguments[i];return(o=this._getContextManager()).with.apply(o,le([e,t,n],ce(a),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return g(N)||fe},r.prototype.disable=function(){this._getContextManager().disable(),A(N,d.instance())},r})(),R;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(R||(R={}));var pe=I.getInstance(),he=(function(){function r(){}return r.prototype.inject=function(e,t){},r.prototype.extract=function(e,t){return e},r.prototype.fields=function(){return[]},r})(),C=j("OpenTelemetry Baggage Key");function $(r){return r.getValue(C)||void 0}function ge(){return $(I.getInstance().active())}function de(r,e){return r.setValue(C,e)}function ve(r){return r.deleteValue(C)}var x="propagation",ye=new he,me=(function(){function r(){this.createBaggage=te,this.getBaggage=$,this.getActiveBaggage=ge,this.setBaggage=de,this.deleteBaggage=ve}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(e){return E(x,e,d.instance())},r.prototype.inject=function(e,t,n){return n===void 0&&(n=oe),this._getGlobalPropagator().inject(e,t,n)},r.prototype.extract=function(e,t,n){return n===void 0&&(n=ae),this._getGlobalPropagator().extract(e,t,n)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){A(x,d.instance())},r.prototype._getGlobalPropagator=function(){return g(x)||ye},r})(),be=me.getInstance();const S=["bench","debug","prod"],_e=r=>e=>S.indexOf(e)>=S.indexOf(r);class _{meta=h.NOOP;otelTracer;filter;constructor(e,t=_e("debug")){this.otelTracer=e,this.filter=t}child(e){const t=new _(this.otelTracer,this.filter);return t.meta=e,t}debug(e,t){return this.trace(e,"debug",t)}bench(e,t){return this.trace(e,"bench",t)}prod(e,t){return this.trace(e,"prod",t)}trace(e,t,n){const o=this.meta.noop||!this.filter(t)||this.otelTracer==null;if(n==null){if(o)return()=>{};const a=new T(e,this.otelTracer.startSpan(e));return a.start(),()=>a.end()}return o?n(new F(e)):this.otelTracer.startActiveSpan(e,a=>{const i=new T(e,a);return n(i)})}propagate(e){if(this.meta.noop)return;const t=pe.active();be.inject(t,e,{set:(n,o,a)=>{n[o]=a}})}static NOOP=new _}class T{key;otel;constructor(e,t){this.key=e,this.otel=t}set(e,t){this.otel.setAttribute(e,t)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:R.ERROR}))}start(){performance.mark(`alamos.trace.start.${this.key}`)}end(){try{performance.mark(`alamos.trace.end.${this.key}`);const e=performance.measure(`alamos.trace.duration.${this.key}`,`alamos.trace.start.${this.key}`,`alamos.trace.end.${this.key}`);this.set("duration",e.duration),this.otel.end()}catch(e){console.error(e)}}}class F{key;constructor(e){this.key=e}set(){}recordError(e){}}class w{meta;T;L;constructor({key:e="",serviceName:t="",logger:n=y.NOOP,tracer:o=_.NOOP,noop:a=!1,__meta:i}){this.meta=i??new h(e,e,t,a),this.T=o.child(this.meta),this.L=n.child(this.meta)}child(e){const t=this.meta.child(e);return new w({__meta:t,tracer:this.T,logger:this.L})}static NOOP=new w({noop:!0})}const we=w.NOOP;exports.ContextAPI=I;exports.DiagAPI=d;exports.Instrumentation=w;exports.LOG_LEVELS=P;exports.Logger=y;exports.NOOP=we;exports.NoopSpan=F;exports.Tracer=_;exports._Span=T;exports.createContextKey=j;exports.getGlobal=g;exports.logLevelKeyFiler=V;exports.logThresholdFilter=K;exports.registerGlobal=E;exports.unregisterGlobal=A;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/alamos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed instrumentation for Synnax",
|
|
6
6
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/freighter/ts",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@opentelemetry/api": "^1.9.0",
|
|
19
|
-
"@synnaxlabs/x": "^0.
|
|
19
|
+
"@synnaxlabs/x": "^0.46.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"eslint": "^9.
|
|
22
|
+
"eslint": "^9.35.0",
|
|
23
23
|
"madge": "^8.0.0",
|
|
24
|
-
"typescript": "^5.
|
|
25
|
-
"vite": "^7.
|
|
24
|
+
"typescript": "^5.9.2",
|
|
25
|
+
"vite": "^7.1.5",
|
|
26
26
|
"vitest": "^3.2.4",
|
|
27
27
|
"@synnaxlabs/tsconfig": "^0.43.0",
|
|
28
28
|
"@synnaxlabs/vite-plugin": "^0.43.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";class h{_noop=!1;key;path;serviceName;constructor(e,t,n="",o=!1){this.key=e,this.path=t,this.serviceName=n,this._noop=o}child(e){return new h(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}static NOOP=new h("","","")}const P=["debug","info","warn","error"],K=r=>{const e=P.indexOf(r);return({level:t})=>P.indexOf(t)>=e},V=r=>{const{include:e,exclude:t}=r;return({path:n})=>!(e!=null&&!e.some(o=>n.startsWith(o))||t!=null&&t.some(o=>n.startsWith(o)))};class y{meta=h.NOOP;filters;constructor(e={}){const{filters:t=[]}=e;this.filters=t}filter(e){return!this.meta.noop&&this.filters.every(t=>t({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const t=new y({filters:this.filters});return t.meta=e,t}debug(e,t,n=!1){!this.filter("debug")&&!n||(t==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,O(t)))}info(e,t,n=!1){!this.filter("info")&&!n||(t==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,O(t)))}warn(e,t,n=!1){!this.filter("warn")&&!n||(t==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,O(t)))}error(e,t,n=!1){!this.filter("error")&&!n||(t==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,O(t)))}static NOOP=new y}const O=r=>typeof r=="function"?r():r;var k=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},p="1.9.0",M=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function U(r){var e=new Set([r]),t=new Set,n=r.match(M);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(s){return s===r};function a(u){return t.add(u),!1}function i(u){return e.add(u),!0}return function(s){if(e.has(s))return!0;if(t.has(s))return!1;var l=s.match(M);if(!l)return a(s);var f={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return f.prerelease!=null||o.major!==f.major?a(s):o.major===0?o.minor===f.minor&&o.patch<=f.patch?i(s):a(s):o.minor<=f.minor?i(s):a(s)}}var W=U(p),X=p.split(".")[0],m=Symbol.for("opentelemetry.js.api."+X),b=k;function E(r,e,t,n){var o;n===void 0&&(n=!1);var a=b[m]=(o=b[m])!==null&&o!==void 0?o:{version:p};if(!n&&a[r]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return t.error(i.stack||i.message),!1}if(a.version!==p){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+r+" does not match previously registered API v"+p);return t.error(i.stack||i.message),!1}return a[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+p+"."),!0}function g(r){var e,t,n=(e=b[m])===null||e===void 0?void 0:e.version;if(!(!n||!W(n)))return(t=b[m])===null||t===void 0?void 0:t[r]}function A(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+p+".");var t=b[m];t&&delete t[r]}var Y=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},D=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},q=function(){function r(e){this._namespace=e.namespace||"DiagComponentLogger"}return r.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("debug",this._namespace,e)},r.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("error",this._namespace,e)},r.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("info",this._namespace,e)},r.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("warn",this._namespace,e)},r.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v("verbose",this._namespace,e)},r}();function v(r,e,t){var n=g("diag");if(n)return t.unshift(e),n[r].apply(n,D([],Y(t),!1))}var c;(function(r){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"})(c||(c={}));function z(r,e){r<c.NONE?r=c.NONE:r>c.ALL&&(r=c.ALL),e=e||{};function t(n,o){var a=e[n];return typeof a=="function"&&r>=o?a.bind(e):function(){}}return{error:t("error",c.ERROR),warn:t("warn",c.WARN),info:t("info",c.INFO),debug:t("debug",c.DEBUG),verbose:t("verbose",c.VERBOSE)}}var H=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},J=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},Q="diag",d=function(){function r(){function e(o){return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var u=g("diag");if(u)return u[o].apply(u,J([],H(a),!1))}}var t=this,n=function(o,a){var i,u,s;if(a===void 0&&(a={logLevel:c.INFO}),o===t){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof a=="number"&&(a={logLevel:a});var f=g("diag"),B=z((u=a.logLevel)!==null&&u!==void 0?u:c.INFO,o);if(f&&!a.suppressOverrideMessage){var G=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+G),B.warn("Current logger will overwrite one already registered from "+G)}return E("diag",B,t,!0)};t.setLogger=n,t.disable=function(){A(Q,t)},t.createComponentLogger=function(o){return new q(o)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return r.instance=function(){return this._instance||(this._instance=new r),this._instance},r}(),Z=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},L=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ee=function(){function r(e){this._entries=e?new Map(e):new Map}return r.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},r.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=Z(e,2),n=t[0],o=t[1];return[n,o]})},r.prototype.setEntry=function(e,t){var n=new r(this._entries);return n._entries.set(e,t),n},r.prototype.removeEntry=function(e){var t=new r(this._entries);return t._entries.delete(e),t},r.prototype.removeEntries=function(){for(var e,t,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var a=new r(this._entries);try{for(var i=L(n),u=i.next();!u.done;u=i.next()){var s=u.value;a._entries.delete(s)}}catch(l){e={error:l}}finally{try{u&&!u.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return a},r.prototype.clear=function(){return new r},r}();d.instance();function te(r){return r===void 0&&(r={}),new ee(new Map(Object.entries(r)))}function j(r){return Symbol.for(r)}var re=function(){function r(e){var t=this;t._currentContext=e?new Map(e):new Map,t.getValue=function(n){return t._currentContext.get(n)},t.setValue=function(n,o){var a=new r(t._currentContext);return a._currentContext.set(n,o),a},t.deleteValue=function(n){var o=new r(t._currentContext);return o._currentContext.delete(n),o}}return r}(),ne=new re,ae={get:function(r,e){if(r!=null)return r[e]},keys:function(r){return r==null?[]:Object.keys(r)}},oe={set:function(r,e,t){r!=null&&(r[e]=t)}},ie=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},ue=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},se=function(){function r(){}return r.prototype.active=function(){return ne},r.prototype.with=function(e,t,n){for(var o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return t.call.apply(t,ue([n],ie(o),!1))},r.prototype.bind=function(e,t){return t},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}(),ce=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,a=[],i;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(u){i={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},le=function(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},N="context",fe=new se,I=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(e){return E(N,e,d.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(e,t,n){for(var o,a=[],i=3;i<arguments.length;i++)a[i-3]=arguments[i];return(o=this._getContextManager()).with.apply(o,le([e,t,n],ce(a),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return g(N)||fe},r.prototype.disable=function(){this._getContextManager().disable(),A(N,d.instance())},r}(),R;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(R||(R={}));var pe=I.getInstance(),he=function(){function r(){}return r.prototype.inject=function(e,t){},r.prototype.extract=function(e,t){return e},r.prototype.fields=function(){return[]},r}(),C=j("OpenTelemetry Baggage Key");function $(r){return r.getValue(C)||void 0}function ge(){return $(I.getInstance().active())}function de(r,e){return r.setValue(C,e)}function ve(r){return r.deleteValue(C)}var x="propagation",ye=new he,me=function(){function r(){this.createBaggage=te,this.getBaggage=$,this.getActiveBaggage=ge,this.setBaggage=de,this.deleteBaggage=ve}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(e){return E(x,e,d.instance())},r.prototype.inject=function(e,t,n){return n===void 0&&(n=oe),this._getGlobalPropagator().inject(e,t,n)},r.prototype.extract=function(e,t,n){return n===void 0&&(n=ae),this._getGlobalPropagator().extract(e,t,n)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){A(x,d.instance())},r.prototype._getGlobalPropagator=function(){return g(x)||ye},r}(),be=me.getInstance();const S=["bench","debug","prod"],_e=r=>e=>S.indexOf(e)>=S.indexOf(r);class _{meta=h.NOOP;otelTracer;filter;constructor(e,t=_e("debug")){this.otelTracer=e,this.filter=t}child(e){const t=new _(this.otelTracer,this.filter);return t.meta=e,t}debug(e,t){return this.trace(e,"debug",t)}bench(e,t){return this.trace(e,"bench",t)}prod(e,t){return this.trace(e,"prod",t)}trace(e,t,n){const o=this.meta.noop||!this.filter(t)||this.otelTracer==null;if(n==null){if(o)return()=>{};const a=new T(e,this.otelTracer.startSpan(e));return a.start(),()=>a.end()}return o?n(new F(e)):this.otelTracer.startActiveSpan(e,a=>{const i=new T(e,a);return n(i)})}propagate(e){if(this.meta.noop)return;const t=pe.active();be.inject(t,e,{set:(n,o,a)=>{n[o]=a}})}static NOOP=new _}class T{key;otel;constructor(e,t){this.key=e,this.otel=t}set(e,t){this.otel.setAttribute(e,t)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:R.ERROR}))}start(){performance.mark(`alamos.trace.start.${this.key}`)}end(){try{performance.mark(`alamos.trace.end.${this.key}`);const e=performance.measure(`alamos.trace.duration.${this.key}`,`alamos.trace.start.${this.key}`,`alamos.trace.end.${this.key}`);this.set("duration",e.duration),this.otel.end()}catch(e){console.error(e)}}}class F{key;constructor(e){this.key=e}set(){}recordError(e){}}class w{meta;T;L;constructor({key:e="",serviceName:t="",logger:n=y.NOOP,tracer:o=_.NOOP,noop:a=!1,__meta:i}){this.meta=i??new h(e,e,t,a),this.T=o.child(this.meta),this.L=n.child(this.meta)}child(e){const t=this.meta.child(e);return new w({__meta:t,tracer:this.T,logger:this.L})}static NOOP=new w({noop:!0})}const we=w.NOOP;exports.ContextAPI=I;exports.DiagAPI=d;exports.Instrumentation=w;exports.LOG_LEVELS=P;exports.Logger=y;exports.NOOP=we;exports.NoopSpan=F;exports.Tracer=_;exports._Span=T;exports.createContextKey=j;exports.getGlobal=g;exports.logLevelKeyFiler=V;exports.logThresholdFilter=K;exports.registerGlobal=E;exports.unregisterGlobal=A;
|