@synnaxlabs/alamos 0.37.0 → 0.38.1
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/dev.cjs +1 -1
- package/dist/dev.js +21 -21
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{instrumentation-CBvwb_K0.js → instrumentation-CfVO_4Ij.js} +23 -23
- package/dist/{instrumentation-CoYi8Yfu.cjs → instrumentation-D7FDm_xn.cjs} +1 -1
- package/eslint.config.js +1 -1
- package/package.json +7 -9
- package/src/dev/index.ts +1 -1
- package/src/environment.ts +1 -1
- package/src/external.ts +1 -1
- package/src/index.ts +1 -1
- package/src/instrumentation.ts +3 -3
- package/src/log.ts +1 -1
- package/src/meta.ts +1 -1
- package/src/trace.spec.ts +1 -1
- package/src/trace.ts +1 -1
- package/vite.config.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./instrumentation-D7FDm_xn.cjs");var d;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(d||(d={}));var T="0000000000000000",S="00000000000000000000000000000000",N={traceId:S,spanId:T,traceFlags:d.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,n){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,n){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,n){},t}(),l=a.createContextKey("OpenTelemetry Context Key SPAN");function v(t){return t.getValue(l)||void 0}function m(){return v(a.ContextAPI.getInstance().active())}function g(t,e){return t.setValue(l,e)}function D(t){return t.deleteValue(l)}function E(t,e){return g(t,new u(e))}function P(t){var e;return(e=v(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=a.ContextAPI.getInstance(),I=function(){function t(){}return t.prototype.startSpan=function(e,n,r){r===void 0&&(r=p.active());var i=!!(n!=null&&n.root);if(i)return new u;var o=r&&P(r);return O(o)&&A(o)?new u(o):new u},t.prototype.startActiveSpan=function(e,n,r,i){var o,c,s;if(!(arguments.length<2)){arguments.length===2?s=n:arguments.length===3?(o=n,s=r):(o=n,c=r,s=i);var _=c??p.active(),h=this.startSpan(e,o,_),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,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}return t.prototype.startSpan=function(e,n,r){return this._getTracer().startSpan(e,n,r)},t.prototype.startActiveSpan=function(e,n,r,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,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,n,r){return new I},t}(),M=new G,y=function(){function t(){}return t.prototype.getTracer=function(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new k(this,e,n,r)},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,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)},t}(),f="trace",K=function(){function t(){this._proxyTracerProvider=new y,this.wrapSpanContext=V,this.isSpanContextValid=A,this.deleteSpan=D,this.getSpan=v,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 n=a.registerGlobal(f,this._proxyTracerProvider,a.DiagAPI.instance());return n&&this._proxyTracerProvider.setDelegate(e),n},t.prototype.getTracerProvider=function(){return a.getGlobal(f)||this._proxyTracerProvider},t.prototype.getTracer=function(e,n){return this.getTracerProvider().getTracer(e,n)},t.prototype.disable=function(){a.unregisterGlobal(f,a.DiagAPI.instance()),this._proxyTracerProvider=new y},t}(),X=K.getInstance();const $=()=>{const t="synnax";return new a.Instrumentation({key:"",serviceName:t,logger:new a.Logger,tracer:new a.Tracer(X.getTracerProvider().getTracer("synnax"))})};exports.instrumentation=$;
|
package/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as T, d as m, r as D, D as h, g as E, u as w, I as C, a as R, T as V } from "./instrumentation-
|
|
1
|
+
import { C as T, d as m, r as D, D as h, g as E, u as w, I as C, a as R, T as V } from "./instrumentation-CfVO_4Ij.js";
|
|
2
2
|
var f;
|
|
3
3
|
(function(t) {
|
|
4
4
|
t[t.NONE = 0] = "NONE", t[t.SAMPLED = 1] = "SAMPLED";
|
|
@@ -7,7 +7,7 @@ var S = "0000000000000000", P = "00000000000000000000000000000000", b = {
|
|
|
7
7
|
traceId: P,
|
|
8
8
|
spanId: S,
|
|
9
9
|
traceFlags: f.NONE
|
|
10
|
-
},
|
|
10
|
+
}, o = (
|
|
11
11
|
/** @class */
|
|
12
12
|
function() {
|
|
13
13
|
function t(e) {
|
|
@@ -35,25 +35,25 @@ var S = "0000000000000000", P = "00000000000000000000000000000000", b = {
|
|
|
35
35
|
}, t.prototype.recordException = function(e, r) {
|
|
36
36
|
}, t;
|
|
37
37
|
}()
|
|
38
|
-
),
|
|
39
|
-
function
|
|
40
|
-
return t.getValue(
|
|
38
|
+
), d = m("OpenTelemetry Context Key SPAN");
|
|
39
|
+
function v(t) {
|
|
40
|
+
return t.getValue(d) || void 0;
|
|
41
41
|
}
|
|
42
42
|
function L() {
|
|
43
|
-
return
|
|
43
|
+
return v(T.getInstance().active());
|
|
44
44
|
}
|
|
45
45
|
function l(t, e) {
|
|
46
|
-
return t.setValue(
|
|
46
|
+
return t.setValue(d, e);
|
|
47
47
|
}
|
|
48
48
|
function O(t) {
|
|
49
|
-
return t.deleteValue(
|
|
49
|
+
return t.deleteValue(d);
|
|
50
50
|
}
|
|
51
51
|
function k(t, e) {
|
|
52
|
-
return l(t, new
|
|
52
|
+
return l(t, new o(e));
|
|
53
53
|
}
|
|
54
54
|
function A(t) {
|
|
55
55
|
var e;
|
|
56
|
-
return (e =
|
|
56
|
+
return (e = v(t)) === null || e === void 0 ? void 0 : e.spanContext();
|
|
57
57
|
}
|
|
58
58
|
var G = /^([0-9a-f]{32})$/i, K = /^[0-9a-f]{16}$/i;
|
|
59
59
|
function M(t) {
|
|
@@ -66,7 +66,7 @@ function I(t) {
|
|
|
66
66
|
return M(t.traceId) && X(t.spanId);
|
|
67
67
|
}
|
|
68
68
|
function $(t) {
|
|
69
|
-
return new
|
|
69
|
+
return new o(t);
|
|
70
70
|
}
|
|
71
71
|
var c = T.getInstance(), x = (
|
|
72
72
|
/** @class */
|
|
@@ -77,15 +77,15 @@ var c = T.getInstance(), x = (
|
|
|
77
77
|
n === void 0 && (n = c.active());
|
|
78
78
|
var a = !!(r != null && r.root);
|
|
79
79
|
if (a)
|
|
80
|
-
return new
|
|
81
|
-
var
|
|
82
|
-
return j(
|
|
80
|
+
return new o();
|
|
81
|
+
var i = n && A(n);
|
|
82
|
+
return j(i) && I(i) ? new o(i) : new o();
|
|
83
83
|
}, t.prototype.startActiveSpan = function(e, r, n, a) {
|
|
84
|
-
var
|
|
84
|
+
var i, u, s;
|
|
85
85
|
if (!(arguments.length < 2)) {
|
|
86
|
-
arguments.length === 2 ?
|
|
87
|
-
var g =
|
|
88
|
-
return c.with(N,
|
|
86
|
+
arguments.length === 2 ? s = r : arguments.length === 3 ? (i = r, s = n) : (i = r, u = n, s = a);
|
|
87
|
+
var g = u ?? c.active(), _ = this.startSpan(e, i, g), N = l(g, _);
|
|
88
|
+
return c.with(N, s, void 0, _);
|
|
89
89
|
}
|
|
90
90
|
}, t;
|
|
91
91
|
}()
|
|
@@ -102,8 +102,8 @@ var B = new x(), F = (
|
|
|
102
102
|
return t.prototype.startSpan = function(e, r, n) {
|
|
103
103
|
return this._getTracer().startSpan(e, r, n);
|
|
104
104
|
}, t.prototype.startActiveSpan = function(e, r, n, a) {
|
|
105
|
-
var
|
|
106
|
-
return Reflect.apply(
|
|
105
|
+
var i = this._getTracer();
|
|
106
|
+
return Reflect.apply(i.startActiveSpan, i, arguments);
|
|
107
107
|
}, t.prototype._getTracer = function() {
|
|
108
108
|
if (this._delegate)
|
|
109
109
|
return this._delegate;
|
|
@@ -142,7 +142,7 @@ var B = new x(), F = (
|
|
|
142
142
|
/** @class */
|
|
143
143
|
function() {
|
|
144
144
|
function t() {
|
|
145
|
-
this._proxyTracerProvider = new y(), this.wrapSpanContext = $, this.isSpanContextValid = I, this.deleteSpan = O, this.getSpan =
|
|
145
|
+
this._proxyTracerProvider = new y(), this.wrapSpanContext = $, this.isSpanContextValid = I, this.deleteSpan = O, this.getSpan = v, this.getActiveSpan = L, this.getSpanContext = A, this.setSpan = l, this.setSpanContext = k;
|
|
146
146
|
}
|
|
147
147
|
return t.getInstance = function() {
|
|
148
148
|
return this._instance || (this._instance = new t()), this._instance;
|
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-D7FDm_xn.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-CfVO_4Ij.js";
|
|
2
2
|
const g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
3
|
__proto__: null,
|
|
4
4
|
Instrumentation: e,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var U = Object.defineProperty;
|
|
2
2
|
var W = (r, e, t) => e in r ? U(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var s = (r, e, t) => W(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
const
|
|
4
|
+
const h = class h {
|
|
5
5
|
constructor(e, t, n = "", a = !1) {
|
|
6
6
|
s(this, "_noop", !1);
|
|
7
7
|
s(this, "key");
|
|
@@ -10,7 +10,7 @@ const d = class d {
|
|
|
10
10
|
this.key = e, this.path = t, this.serviceName = n, this._noop = a;
|
|
11
11
|
}
|
|
12
12
|
child(e) {
|
|
13
|
-
return new
|
|
13
|
+
return new h(e, this.extendPath(e), this.serviceName, this.noop);
|
|
14
14
|
}
|
|
15
15
|
extendPath(e) {
|
|
16
16
|
return `${this.path}.${e}`;
|
|
@@ -19,8 +19,8 @@ const d = class d {
|
|
|
19
19
|
return this._noop;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
s(
|
|
23
|
-
let b =
|
|
22
|
+
s(h, "NOOP", new h("", "", ""));
|
|
23
|
+
let b = h;
|
|
24
24
|
const S = ["debug", "info", "warn", "error"], Pe = (r) => {
|
|
25
25
|
const e = S.indexOf(r);
|
|
26
26
|
return ({ level: t }) => S.indexOf(t) >= e;
|
|
@@ -63,7 +63,7 @@ const S = ["debug", "info", "warn", "error"], Pe = (r) => {
|
|
|
63
63
|
s(v, "NOOP", new v());
|
|
64
64
|
let P = v;
|
|
65
65
|
const A = (r) => typeof r == "function" ? r() : r;
|
|
66
|
-
var X = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {},
|
|
66
|
+
var X = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {}, d = "1.9.0", F = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
67
67
|
function Y(r) {
|
|
68
68
|
var e = /* @__PURE__ */ new Set([r]), t = /* @__PURE__ */ new Set(), n = r.match(F);
|
|
69
69
|
if (!n)
|
|
@@ -103,22 +103,22 @@ function Y(r) {
|
|
|
103
103
|
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);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
var k = Y(
|
|
106
|
+
var k = Y(d), D = d.split(".")[0], _ = Symbol.for("opentelemetry.js.api." + D), w = X;
|
|
107
107
|
function I(r, e, t, n) {
|
|
108
108
|
var a;
|
|
109
109
|
n === void 0 && (n = !1);
|
|
110
110
|
var o = w[_] = (a = w[_]) !== null && a !== void 0 ? a : {
|
|
111
|
-
version:
|
|
111
|
+
version: d
|
|
112
112
|
};
|
|
113
113
|
if (!n && o[r]) {
|
|
114
114
|
var i = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
115
115
|
return t.error(i.stack || i.message), !1;
|
|
116
116
|
}
|
|
117
|
-
if (o.version !==
|
|
118
|
-
var i = new Error("@opentelemetry/api: Registration of version v" + o.version + " for " + r + " does not match previously registered API v" +
|
|
117
|
+
if (o.version !== d) {
|
|
118
|
+
var i = new Error("@opentelemetry/api: Registration of version v" + o.version + " for " + r + " does not match previously registered API v" + d);
|
|
119
119
|
return t.error(i.stack || i.message), !1;
|
|
120
120
|
}
|
|
121
|
-
return o[r] = e, t.debug("@opentelemetry/api: Registered a global for " + r + " v" +
|
|
121
|
+
return o[r] = e, t.debug("@opentelemetry/api: Registered a global for " + r + " v" + d + "."), !0;
|
|
122
122
|
}
|
|
123
123
|
function O(r) {
|
|
124
124
|
var e, t, n = (e = w[_]) === null || e === void 0 ? void 0 : e.version;
|
|
@@ -126,7 +126,7 @@ function O(r) {
|
|
|
126
126
|
return (t = w[_]) === null || t === void 0 ? void 0 : t[r];
|
|
127
127
|
}
|
|
128
128
|
function T(r, e) {
|
|
129
|
-
e.debug("@opentelemetry/api: Unregistering a global for " + r + " v" +
|
|
129
|
+
e.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + d + ".");
|
|
130
130
|
var t = w[_];
|
|
131
131
|
t && delete t[r];
|
|
132
132
|
}
|
|
@@ -159,27 +159,27 @@ var q = function(r, e) {
|
|
|
159
159
|
return r.prototype.debug = function() {
|
|
160
160
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
161
161
|
e[t] = arguments[t];
|
|
162
|
-
return
|
|
162
|
+
return g("debug", this._namespace, e);
|
|
163
163
|
}, r.prototype.error = function() {
|
|
164
164
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
165
165
|
e[t] = arguments[t];
|
|
166
|
-
return
|
|
166
|
+
return g("error", this._namespace, e);
|
|
167
167
|
}, r.prototype.info = function() {
|
|
168
168
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
169
169
|
e[t] = arguments[t];
|
|
170
|
-
return
|
|
170
|
+
return g("info", this._namespace, e);
|
|
171
171
|
}, r.prototype.warn = function() {
|
|
172
172
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
173
173
|
e[t] = arguments[t];
|
|
174
|
-
return
|
|
174
|
+
return g("warn", this._namespace, e);
|
|
175
175
|
}, r.prototype.verbose = function() {
|
|
176
176
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
177
177
|
e[t] = arguments[t];
|
|
178
|
-
return
|
|
178
|
+
return g("verbose", this._namespace, e);
|
|
179
179
|
}, r;
|
|
180
180
|
}()
|
|
181
181
|
);
|
|
182
|
-
function
|
|
182
|
+
function g(r, e, t) {
|
|
183
183
|
var n = O("diag");
|
|
184
184
|
if (n)
|
|
185
185
|
return t.unshift(e), n[r].apply(n, z([], q(t), !1));
|
|
@@ -423,11 +423,11 @@ var oe = (
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
return o;
|
|
426
|
-
},
|
|
426
|
+
}, de = function(r, e, t) {
|
|
427
427
|
if (t || arguments.length === 2) for (var n = 0, a = e.length, o; n < a; n++)
|
|
428
428
|
(o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
|
|
429
429
|
return r.concat(o || Array.prototype.slice.call(e));
|
|
430
|
-
}, N = "context",
|
|
430
|
+
}, N = "context", ge = new fe(), V = (
|
|
431
431
|
/** @class */
|
|
432
432
|
function() {
|
|
433
433
|
function r() {
|
|
@@ -441,11 +441,11 @@ var oe = (
|
|
|
441
441
|
}, r.prototype.with = function(e, t, n) {
|
|
442
442
|
for (var a, o = [], i = 3; i < arguments.length; i++)
|
|
443
443
|
o[i - 3] = arguments[i];
|
|
444
|
-
return (a = this._getContextManager()).with.apply(a,
|
|
444
|
+
return (a = this._getContextManager()).with.apply(a, de([e, t, n], pe(o), !1));
|
|
445
445
|
}, r.prototype.bind = function(e, t) {
|
|
446
446
|
return this._getContextManager().bind(e, t);
|
|
447
447
|
}, r.prototype._getContextManager = function() {
|
|
448
|
-
return O(N) ||
|
|
448
|
+
return O(N) || ge;
|
|
449
449
|
}, r.prototype.disable = function() {
|
|
450
450
|
this._getContextManager().disable(), T(N, E.instance());
|
|
451
451
|
}, r;
|
|
@@ -454,7 +454,7 @@ var oe = (
|
|
|
454
454
|
(function(r) {
|
|
455
455
|
r[r.UNSET = 0] = "UNSET", r[r.OK = 1] = "OK", r[r.ERROR = 2] = "ERROR";
|
|
456
456
|
})(R || (R = {}));
|
|
457
|
-
var
|
|
457
|
+
var he = V.getInstance(), ve = (
|
|
458
458
|
/** @class */
|
|
459
459
|
function() {
|
|
460
460
|
function r() {
|
|
@@ -574,7 +574,7 @@ const $ = ["bench", "debug", "prod"], Ee = (r) => (e) => $.indexOf(e) >= $.index
|
|
|
574
574
|
*/
|
|
575
575
|
propagate(e) {
|
|
576
576
|
if (this.meta.noop) return;
|
|
577
|
-
const t =
|
|
577
|
+
const t = he.active();
|
|
578
578
|
Oe.inject(t, e, {
|
|
579
579
|
set: (n, a, o) => {
|
|
580
580
|
n[a] = o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=Object.defineProperty;var k=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>k(r,typeof e!="symbol"?e+"":e,t);const y=class y{constructor(e,t,n="",a=!1){s(this,"_noop",!1);s(this,"key");s(this,"path");s(this,"serviceName");this.key=e,this.path=t,this.serviceName=n,this._noop=a}child(e){return new y(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};s(y,"NOOP",new y("","",""));let w=y;const T=["debug","info","warn","error"],D=r=>{const e=T.indexOf(r);return({level:t})=>T.indexOf(t)>=e},q=r=>{const{include:e,exclude:t}=r;return({path:n})=>!(e!=null&&!e.some(a=>n.startsWith(a))||t!=null&&t.some(a=>n.startsWith(a)))},m=class m{constructor(e={}){s(this,"meta",w.NOOP);s(this,"filters");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 m({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,A(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,A(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,A(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,A(t)))}};s(m,"NOOP",new m);let N=m;const A=r=>typeof r=="function"?r():r;var z=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},g="1.9.0",$=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function H(r){var e=new Set([r]),t=new Set,n=r.match($);if(!n)return function(){return!1};var a={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(a.prerelease!=null)return function(c){return c===r};function o(u){return t.add(u),!1}function i(u){return e.add(u),!0}return function(c){if(e.has(c))return!0;if(t.has(c))return!1;var f=c.match($);if(!f)return o(c);var p={major:+f[1],minor:+f[2],patch:+f[3],prerelease:f[4]};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)}}var J=H(g),Q=g.split(".")[0],O=Symbol.for("opentelemetry.js.api."+Q),E=z;function R(r,e,t,n){var a;n===void 0&&(n=!1);var o=E[O]=(a=E[O])!==null&&a!==void 0?a:{version:g};if(!n&&o[r]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return t.error(i.stack||i.message),!1}if(o.version!==g){var i=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+r+" does not match previously registered API v"+g);return t.error(i.stack||i.message),!1}return o[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+g+"."),!0}function h(r){var e,t,n=(e=E[O])===null||e===void 0?void 0:e.version;if(!(!n||!J(n)))return(t=E[O])===null||t===void 0?void 0:t[r]}function C(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+g+".");var t=E[O];t&&delete t[r]}var Z=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},L=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},ee=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=h("diag");if(n)return t.unshift(e),n[r].apply(n,L([],Z(t),!1))}var l;(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"})(l||(l={}));function te(r,e){r<l.NONE?r=l.NONE:r>l.ALL&&(r=l.ALL),e=e||{};function t(n,a){var o=e[n];return typeof o=="function"&&r>=a?o.bind(e):function(){}}return{error:t("error",l.ERROR),warn:t("warn",l.WARN),info:t("info",l.INFO),debug:t("debug",l.DEBUG),verbose:t("verbose",l.VERBOSE)}}var re=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ne=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},ae="diag",d=function(){function r(){function e(a){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var u=h("diag");if(u)return u[a].apply(u,ne([],re(o),!1))}}var t=this,n=function(a,o){var i,u,c;if(o===void 0&&(o={logLevel:l.INFO}),a===t){var f=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=f.stack)!==null&&i!==void 0?i:f.message),!1}typeof o=="number"&&(o={logLevel:o});var p=h("diag"),j=te((u=o.logLevel)!==null&&u!==void 0?u:l.INFO,a);if(p&&!o.suppressOverrideMessage){var F=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+F),j.warn("Current logger will overwrite one already registered from "+F)}return R("diag",j,t,!0)};t.setLogger=n,t.disable=function(){C(ae,t)},t.createComponentLogger=function(a){return new ee(a)},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}(),oe=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ie=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.")},ue=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=oe(e,2),n=t[0],a=t[1];return[n,a]})},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=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var o=new r(this._entries);try{for(var i=ie(n),u=i.next();!u.done;u=i.next()){var c=u.value;o._entries.delete(c)}}catch(f){e={error:f}}finally{try{u&&!u.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o},r.prototype.clear=function(){return new r},r}();d.instance();function se(r){return r===void 0&&(r={}),new ue(new Map(Object.entries(r)))}function V(r){return Symbol.for(r)}var ce=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,a){var o=new r(t._currentContext);return o._currentContext.set(n,a),o},t.deleteValue=function(n){var a=new r(t._currentContext);return a._currentContext.delete(n),a}}return r}(),le=new ce,fe={get:function(r,e){if(r!=null)return r[e]},keys:function(r){return r==null?[]:Object.keys(r)}},pe={set:function(r,e,t){r!=null&&(r[e]=t)}},ge=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},he=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},de=function(){function r(){}return r.prototype.active=function(){return le},r.prototype.with=function(e,t,n){for(var a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return t.call.apply(t,he([n],ge(a),!1))},r.prototype.bind=function(e,t){return t},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}(),ve=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ye=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},I="context",me=new de,M=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(e){return R(I,e,d.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(e,t,n){for(var a,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(a=this._getContextManager()).with.apply(a,ye([e,t,n],ve(o),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return h(I)||me},r.prototype.disable=function(){this._getContextManager().disable(),C(I,d.instance())},r}(),G;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(G||(G={}));var be=M.getInstance(),_e=function(){function r(){}return r.prototype.inject=function(e,t){},r.prototype.extract=function(e,t){return e},r.prototype.fields=function(){return[]},r}(),S=V("OpenTelemetry Baggage Key");function U(r){return r.getValue(S)||void 0}function we(){return U(M.getInstance().active())}function Oe(r,e){return r.setValue(S,e)}function Ee(r){return r.deleteValue(S)}var B="propagation",Ae=new _e,Ne=function(){function r(){this.createBaggage=se,this.getBaggage=U,this.getActiveBaggage=we,this.setBaggage=Oe,this.deleteBaggage=Ee}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(e){return R(B,e,d.instance())},r.prototype.inject=function(e,t,n){return n===void 0&&(n=pe),this._getGlobalPropagator().inject(e,t,n)},r.prototype.extract=function(e,t,n){return n===void 0&&(n=fe),this._getGlobalPropagator().extract(e,t,n)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){C(B,d.instance())},r.prototype._getGlobalPropagator=function(){return h(B)||Ae},r}(),xe=Ne.getInstance();const K=["bench","debug","prod"],Pe=r=>e=>K.indexOf(e)>=K.indexOf(r),b=class b{constructor(e,t=Pe("debug")){s(this,"meta",w.NOOP);s(this,"tracer");s(this,"filter");this.tracer=e,this.filter=t}child(e){const t=new b(this.tracer,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){return this.meta.noop||!this.filter(t)?n(new X(e)):this.tracer.startActiveSpan(e,a=>{const o=new W(e,a),i=n(o);return a.end(),i})}propagate(e){if(this.meta.noop)return;const t=be.active();xe.inject(t,e,{set:(n,a,o)=>{n[a]=o}})}};s(b,"NOOP",new b);let x=b;class W{constructor(e,t){s(this,"key");s(this,"otel");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:G.ERROR}))}}class X{constructor(e){s(this,"key");this.key=e}set(){}recordError(e){}}const _=class _{constructor({key:e="",serviceName:t="",logger:n=N.NOOP,tracer:a=x.NOOP,noop:o=!1,__meta:i}){s(this,"meta");s(this,"T");s(this,"L");this.meta=i??new w(e,e,t,o),this.T=a.child(this.meta),this.L=n.child(this.meta)}child(e){const t=this.meta.child(e);return new _({__meta:t,tracer:this.T,logger:this.L})}};s(_,"NOOP",new _({noop:!0}));let P=_;const Re=P.NOOP;exports.ContextAPI=M;exports.DiagAPI=d;exports.Instrumentation=P;exports.LOG_LEVELS=T;exports.Logger=N;exports.NOOP=Re;exports.NoopSpan=X;exports.Tracer=x;exports._Span=W;exports.createContextKey=V;exports.getGlobal=h;exports.logLevelKeyFiler=q;exports.logThresholdFilter=D;exports.registerGlobal=R;exports.unregisterGlobal=C;
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var k=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>k(r,typeof e!="symbol"?e+"":e,t);const y=class y{constructor(e,t,n="",a=!1){s(this,"_noop",!1);s(this,"key");s(this,"path");s(this,"serviceName");this.key=e,this.path=t,this.serviceName=n,this._noop=a}child(e){return new y(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};s(y,"NOOP",new y("","",""));let w=y;const T=["debug","info","warn","error"],D=r=>{const e=T.indexOf(r);return({level:t})=>T.indexOf(t)>=e},q=r=>{const{include:e,exclude:t}=r;return({path:n})=>!(e!=null&&!e.some(a=>n.startsWith(a))||t!=null&&t.some(a=>n.startsWith(a)))},m=class m{constructor(e={}){s(this,"meta",w.NOOP);s(this,"filters");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 m({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,A(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,A(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,A(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,A(t)))}};s(m,"NOOP",new m);let N=m;const A=r=>typeof r=="function"?r():r;var z=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},d="1.9.0",$=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function H(r){var e=new Set([r]),t=new Set,n=r.match($);if(!n)return function(){return!1};var a={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(a.prerelease!=null)return function(c){return c===r};function o(u){return t.add(u),!1}function i(u){return e.add(u),!0}return function(c){if(e.has(c))return!0;if(t.has(c))return!1;var f=c.match($);if(!f)return o(c);var p={major:+f[1],minor:+f[2],patch:+f[3],prerelease:f[4]};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)}}var J=H(d),Q=d.split(".")[0],O=Symbol.for("opentelemetry.js.api."+Q),E=z;function R(r,e,t,n){var a;n===void 0&&(n=!1);var o=E[O]=(a=E[O])!==null&&a!==void 0?a:{version:d};if(!n&&o[r]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return t.error(i.stack||i.message),!1}if(o.version!==d){var i=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+r+" does not match previously registered API v"+d);return t.error(i.stack||i.message),!1}return o[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+d+"."),!0}function g(r){var e,t,n=(e=E[O])===null||e===void 0?void 0:e.version;if(!(!n||!J(n)))return(t=E[O])===null||t===void 0?void 0:t[r]}function C(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+d+".");var t=E[O];t&&delete t[r]}var Z=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},L=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},ee=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,L([],Z(t),!1))}var l;(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"})(l||(l={}));function te(r,e){r<l.NONE?r=l.NONE:r>l.ALL&&(r=l.ALL),e=e||{};function t(n,a){var o=e[n];return typeof o=="function"&&r>=a?o.bind(e):function(){}}return{error:t("error",l.ERROR),warn:t("warn",l.WARN),info:t("info",l.INFO),debug:t("debug",l.DEBUG),verbose:t("verbose",l.VERBOSE)}}var re=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ne=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},ae="diag",h=function(){function r(){function e(a){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var u=g("diag");if(u)return u[a].apply(u,ne([],re(o),!1))}}var t=this,n=function(a,o){var i,u,c;if(o===void 0&&(o={logLevel:l.INFO}),a===t){var f=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=f.stack)!==null&&i!==void 0?i:f.message),!1}typeof o=="number"&&(o={logLevel:o});var p=g("diag"),j=te((u=o.logLevel)!==null&&u!==void 0?u:l.INFO,a);if(p&&!o.suppressOverrideMessage){var F=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+F),j.warn("Current logger will overwrite one already registered from "+F)}return R("diag",j,t,!0)};t.setLogger=n,t.disable=function(){C(ae,t)},t.createComponentLogger=function(a){return new ee(a)},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}(),oe=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ie=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.")},ue=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=oe(e,2),n=t[0],a=t[1];return[n,a]})},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=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var o=new r(this._entries);try{for(var i=ie(n),u=i.next();!u.done;u=i.next()){var c=u.value;o._entries.delete(c)}}catch(f){e={error:f}}finally{try{u&&!u.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o},r.prototype.clear=function(){return new r},r}();h.instance();function se(r){return r===void 0&&(r={}),new ue(new Map(Object.entries(r)))}function V(r){return Symbol.for(r)}var ce=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,a){var o=new r(t._currentContext);return o._currentContext.set(n,a),o},t.deleteValue=function(n){var a=new r(t._currentContext);return a._currentContext.delete(n),a}}return r}(),le=new ce,fe={get:function(r,e){if(r!=null)return r[e]},keys:function(r){return r==null?[]:Object.keys(r)}},pe={set:function(r,e,t){r!=null&&(r[e]=t)}},de=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ge=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},he=function(){function r(){}return r.prototype.active=function(){return le},r.prototype.with=function(e,t,n){for(var a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return t.call.apply(t,ge([n],de(a),!1))},r.prototype.bind=function(e,t){return t},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}(),ve=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,o=[],i;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(u){i={error:u}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o},ye=function(r,e,t){if(t||arguments.length===2)for(var n=0,a=e.length,o;n<a;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},I="context",me=new he,M=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(e){return R(I,e,h.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(e,t,n){for(var a,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(a=this._getContextManager()).with.apply(a,ye([e,t,n],ve(o),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return g(I)||me},r.prototype.disable=function(){this._getContextManager().disable(),C(I,h.instance())},r}(),G;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(G||(G={}));var be=M.getInstance(),_e=function(){function r(){}return r.prototype.inject=function(e,t){},r.prototype.extract=function(e,t){return e},r.prototype.fields=function(){return[]},r}(),S=V("OpenTelemetry Baggage Key");function U(r){return r.getValue(S)||void 0}function we(){return U(M.getInstance().active())}function Oe(r,e){return r.setValue(S,e)}function Ee(r){return r.deleteValue(S)}var B="propagation",Ae=new _e,Ne=function(){function r(){this.createBaggage=se,this.getBaggage=U,this.getActiveBaggage=we,this.setBaggage=Oe,this.deleteBaggage=Ee}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(e){return R(B,e,h.instance())},r.prototype.inject=function(e,t,n){return n===void 0&&(n=pe),this._getGlobalPropagator().inject(e,t,n)},r.prototype.extract=function(e,t,n){return n===void 0&&(n=fe),this._getGlobalPropagator().extract(e,t,n)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){C(B,h.instance())},r.prototype._getGlobalPropagator=function(){return g(B)||Ae},r}(),xe=Ne.getInstance();const K=["bench","debug","prod"],Pe=r=>e=>K.indexOf(e)>=K.indexOf(r),b=class b{constructor(e,t=Pe("debug")){s(this,"meta",w.NOOP);s(this,"tracer");s(this,"filter");this.tracer=e,this.filter=t}child(e){const t=new b(this.tracer,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){return this.meta.noop||!this.filter(t)?n(new X(e)):this.tracer.startActiveSpan(e,a=>{const o=new W(e,a),i=n(o);return a.end(),i})}propagate(e){if(this.meta.noop)return;const t=be.active();xe.inject(t,e,{set:(n,a,o)=>{n[a]=o}})}};s(b,"NOOP",new b);let x=b;class W{constructor(e,t){s(this,"key");s(this,"otel");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:G.ERROR}))}}class X{constructor(e){s(this,"key");this.key=e}set(){}recordError(e){}}const _=class _{constructor({key:e="",serviceName:t="",logger:n=N.NOOP,tracer:a=x.NOOP,noop:o=!1,__meta:i}){s(this,"meta");s(this,"T");s(this,"L");this.meta=i??new w(e,e,t,o),this.T=a.child(this.meta),this.L=n.child(this.meta)}child(e){const t=this.meta.child(e);return new _({__meta:t,tracer:this.T,logger:this.L})}};s(_,"NOOP",new _({noop:!0}));let P=_;const Re=P.NOOP;exports.ContextAPI=M;exports.DiagAPI=h;exports.Instrumentation=P;exports.LOG_LEVELS=T;exports.Logger=N;exports.NOOP=Re;exports.NoopSpan=X;exports.Tracer=x;exports._Span=W;exports.createContextKey=V;exports.getGlobal=g;exports.logLevelKeyFiler=q;exports.logThresholdFilter=D;exports.registerGlobal=R;exports.unregisterGlobal=C;
|
package/eslint.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/alamos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed instrumentation for Synnax",
|
|
6
6
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/freighter/ts",
|
|
@@ -19,17 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@opentelemetry/api": "^1.9.0",
|
|
22
|
-
"@synnaxlabs/x": "0.
|
|
22
|
+
"@synnaxlabs/x": "0.38.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"vite": "^6.0.3",
|
|
25
|
+
"eslint": "^9.18.0",
|
|
26
|
+
"typescript": "^5.7.3",
|
|
27
|
+
"vite": "^6.0.7",
|
|
29
28
|
"vitest": "^2.1.8",
|
|
30
|
-
"@synnaxlabs/
|
|
29
|
+
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
31
30
|
"eslint-config-synnaxlabs": "0.0.1",
|
|
32
|
-
"@synnaxlabs/
|
|
31
|
+
"@synnaxlabs/tsconfig": "0.0.2"
|
|
33
32
|
},
|
|
34
33
|
"main": "dist/index.js",
|
|
35
34
|
"module": "dist/index.js",
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"build": "tsc --noEmit && vite build",
|
|
50
49
|
"watch": "tsc --noEmit && vite build --watch",
|
|
51
50
|
"test": "vitest",
|
|
52
|
-
"cov": "vitest --coverage",
|
|
53
51
|
"lint": "eslint --cache",
|
|
54
52
|
"fix": "eslint --cache --fix"
|
|
55
53
|
}
|
package/src/dev/index.ts
CHANGED
package/src/environment.ts
CHANGED
package/src/external.ts
CHANGED
package/src/index.ts
CHANGED
package/src/instrumentation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -31,7 +31,7 @@ export class Instrumentation {
|
|
|
31
31
|
logger = Logger.NOOP,
|
|
32
32
|
tracer = Tracer.NOOP,
|
|
33
33
|
noop = false,
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
__meta,
|
|
36
36
|
}: InstrumentationOptions) {
|
|
37
37
|
this.meta = __meta ?? new Meta(key, key, serviceName, noop);
|
|
@@ -40,7 +40,7 @@ export class Instrumentation {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
child(key: string): Instrumentation {
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const __meta = this.meta.child(key);
|
|
45
45
|
return new Instrumentation({ __meta, tracer: this.T, logger: this.L });
|
|
46
46
|
}
|
package/src/log.ts
CHANGED
package/src/meta.ts
CHANGED
package/src/trace.spec.ts
CHANGED
package/src/trace.ts
CHANGED
package/vite.config.ts
CHANGED