@synnaxlabs/alamos 0.43.0 → 0.44.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 +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{instrumentation-fXoCOVPg.js → instrumentation-Bmq0SwpZ.js} +180 -185
- package/dist/instrumentation-CGaKhn8G.cjs +1 -0
- package/dist/log.d.ts +2 -2
- package/dist/log.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/log.ts +3 -3
- package/dist/instrumentation-lwMkPABv.cjs +0 -1
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-CGaKhn8G.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-Bmq0SwpZ.js";
|
|
2
2
|
var f;
|
|
3
3
|
(function(t) {
|
|
4
4
|
t[t.NONE = 0] = "NONE", t[t.SAMPLED = 1] = "SAMPLED";
|
|
@@ -75,7 +75,7 @@ var c = T.getInstance(), x = (
|
|
|
75
75
|
}
|
|
76
76
|
return t.prototype.startSpan = function(e, r, n) {
|
|
77
77
|
n === void 0 && (n = c.active());
|
|
78
|
-
var a = !!
|
|
78
|
+
var a = !!r?.root;
|
|
79
79
|
if (a)
|
|
80
80
|
return new i();
|
|
81
81
|
var o = n && A(n);
|
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-CGaKhn8G.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-Bmq0SwpZ.js";
|
|
2
2
|
const g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
3
|
__proto__: null,
|
|
4
4
|
Instrumentation: e,
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
class h {
|
|
2
|
+
_noop = !1;
|
|
3
|
+
key;
|
|
4
|
+
path;
|
|
5
|
+
serviceName;
|
|
5
6
|
constructor(e, t, n = "", o = !1) {
|
|
6
|
-
u(this, "_noop", !1);
|
|
7
|
-
u(this, "key");
|
|
8
|
-
u(this, "path");
|
|
9
|
-
u(this, "serviceName");
|
|
10
7
|
this.key = e, this.path = t, this.serviceName = n, this._noop = o;
|
|
11
8
|
}
|
|
12
9
|
child(e) {
|
|
13
|
-
return new
|
|
10
|
+
return new h(e, this.extendPath(e), this.serviceName, this.noop);
|
|
14
11
|
}
|
|
15
12
|
extendPath(e) {
|
|
16
13
|
return `${this.path}.${e}`;
|
|
@@ -18,19 +15,19 @@ const g = class g {
|
|
|
18
15
|
get noop() {
|
|
19
16
|
return this._noop;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, Re = (r) => {
|
|
18
|
+
static NOOP = new h("", "", "");
|
|
19
|
+
}
|
|
20
|
+
const I = ["debug", "info", "warn", "error"], be = (r) => {
|
|
21
|
+
const e = I.indexOf(r);
|
|
22
|
+
return ({ level: t }) => I.indexOf(t) >= e;
|
|
23
|
+
}, _e = (r) => {
|
|
28
24
|
const { include: e, exclude: t } = r;
|
|
29
25
|
return ({ path: n }) => !(e != null && !e.some((o) => n.startsWith(o)) || t != null && t.some((o) => n.startsWith(o)));
|
|
30
|
-
}
|
|
26
|
+
};
|
|
27
|
+
class _ {
|
|
28
|
+
meta = h.NOOP;
|
|
29
|
+
filters;
|
|
31
30
|
constructor(e = {}) {
|
|
32
|
-
u(this, "meta", b.NOOP);
|
|
33
|
-
u(this, "filters");
|
|
34
31
|
const { filters: t = [] } = e;
|
|
35
32
|
this.filters = t;
|
|
36
33
|
}
|
|
@@ -44,28 +41,27 @@ const j = ["debug", "info", "warn", "error"], Pe = (r) => {
|
|
|
44
41
|
);
|
|
45
42
|
}
|
|
46
43
|
child(e) {
|
|
47
|
-
const t = new
|
|
44
|
+
const t = new _({ filters: this.filters });
|
|
48
45
|
return t.meta = e, t;
|
|
49
46
|
}
|
|
50
47
|
debug(e, t, n = !1) {
|
|
51
|
-
!this.filter("debug") && !n || (t == null ? console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e) : console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e,
|
|
48
|
+
!this.filter("debug") && !n || (t == null ? console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e) : console.log("%cDEBUG", "color: #8c00f0;", this.meta.path, e, b(t)));
|
|
52
49
|
}
|
|
53
50
|
info(e, t, n = !1) {
|
|
54
|
-
!this.filter("info") && !n || (t == null ? console.log("%cINFO", "color: #005eff;", this.meta.path, e) : console.log("%cINFO", "color: #005eff;", this.meta.path, e,
|
|
51
|
+
!this.filter("info") && !n || (t == null ? console.log("%cINFO", "color: #005eff;", this.meta.path, e) : console.log("%cINFO", "color: #005eff;", this.meta.path, e, b(t)));
|
|
55
52
|
}
|
|
56
53
|
warn(e, t, n = !1) {
|
|
57
|
-
!this.filter("warn") && !n || (t == null ? console.warn("WARN", this.meta.path, e) : console.warn("WARN", this.meta.path, e,
|
|
54
|
+
!this.filter("warn") && !n || (t == null ? console.warn("WARN", this.meta.path, e) : console.warn("WARN", this.meta.path, e, b(t)));
|
|
58
55
|
}
|
|
59
56
|
error(e, t, n = !1) {
|
|
60
|
-
!this.filter("error") && !n || (t == null ? console.error("ERROR", this.meta.path, e) : console.error("ERROR", this.meta.path, e,
|
|
57
|
+
!this.filter("error") && !n || (t == null ? console.error("ERROR", this.meta.path, e) : console.error("ERROR", this.meta.path, e, b(t)));
|
|
61
58
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var e = /* @__PURE__ */ new Set([r]), t = /* @__PURE__ */ new Set(), n = r.match($);
|
|
59
|
+
static NOOP = new _();
|
|
60
|
+
}
|
|
61
|
+
const b = (r) => typeof r == "function" ? r() : r;
|
|
62
|
+
var $ = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {}, p = "1.9.0", B = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
63
|
+
function F(r) {
|
|
64
|
+
var e = /* @__PURE__ */ new Set([r]), t = /* @__PURE__ */ new Set(), n = r.match(B);
|
|
69
65
|
if (!n)
|
|
70
66
|
return function() {
|
|
71
67
|
return !1;
|
|
@@ -77,8 +73,8 @@ function Y(r) {
|
|
|
77
73
|
prerelease: n[4]
|
|
78
74
|
};
|
|
79
75
|
if (o.prerelease != null)
|
|
80
|
-
return function(
|
|
81
|
-
return
|
|
76
|
+
return function(u) {
|
|
77
|
+
return u === r;
|
|
82
78
|
};
|
|
83
79
|
function a(s) {
|
|
84
80
|
return t.add(s), !1;
|
|
@@ -86,51 +82,51 @@ function Y(r) {
|
|
|
86
82
|
function i(s) {
|
|
87
83
|
return e.add(s), !0;
|
|
88
84
|
}
|
|
89
|
-
return function(
|
|
90
|
-
if (e.has(
|
|
85
|
+
return function(u) {
|
|
86
|
+
if (e.has(u))
|
|
91
87
|
return !0;
|
|
92
|
-
if (t.has(
|
|
88
|
+
if (t.has(u))
|
|
93
89
|
return !1;
|
|
94
|
-
var
|
|
95
|
-
if (!
|
|
96
|
-
return a(
|
|
97
|
-
var
|
|
98
|
-
major: +
|
|
99
|
-
minor: +
|
|
100
|
-
patch: +
|
|
101
|
-
prerelease:
|
|
90
|
+
var l = u.match(B);
|
|
91
|
+
if (!l)
|
|
92
|
+
return a(u);
|
|
93
|
+
var f = {
|
|
94
|
+
major: +l[1],
|
|
95
|
+
minor: +l[2],
|
|
96
|
+
patch: +l[3],
|
|
97
|
+
prerelease: l[4]
|
|
102
98
|
};
|
|
103
|
-
return
|
|
99
|
+
return f.prerelease != null || o.major !== f.major ? a(u) : o.major === 0 ? o.minor === f.minor && o.patch <= f.patch ? i(u) : a(u) : o.minor <= f.minor ? i(u) : a(u);
|
|
104
100
|
};
|
|
105
101
|
}
|
|
106
|
-
var
|
|
107
|
-
function
|
|
102
|
+
var V = F(p), k = p.split(".")[0], g = Symbol.for("opentelemetry.js.api." + k), v = $;
|
|
103
|
+
function x(r, e, t, n) {
|
|
108
104
|
var o;
|
|
109
105
|
n === void 0 && (n = !1);
|
|
110
|
-
var a =
|
|
111
|
-
version:
|
|
106
|
+
var a = v[g] = (o = v[g]) !== null && o !== void 0 ? o : {
|
|
107
|
+
version: p
|
|
112
108
|
};
|
|
113
109
|
if (!n && a[r]) {
|
|
114
110
|
var i = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + r);
|
|
115
111
|
return t.error(i.stack || i.message), !1;
|
|
116
112
|
}
|
|
117
|
-
if (a.version !==
|
|
118
|
-
var i = new Error("@opentelemetry/api: Registration of version v" + a.version + " for " + r + " does not match previously registered API v" +
|
|
113
|
+
if (a.version !== p) {
|
|
114
|
+
var i = new Error("@opentelemetry/api: Registration of version v" + a.version + " for " + r + " does not match previously registered API v" + p);
|
|
119
115
|
return t.error(i.stack || i.message), !1;
|
|
120
116
|
}
|
|
121
|
-
return a[r] = e, t.debug("@opentelemetry/api: Registered a global for " + r + " v" +
|
|
117
|
+
return a[r] = e, t.debug("@opentelemetry/api: Registered a global for " + r + " v" + p + "."), !0;
|
|
122
118
|
}
|
|
123
|
-
function
|
|
124
|
-
var e, t, n = (e =
|
|
125
|
-
if (!(!n || !
|
|
126
|
-
return (t =
|
|
119
|
+
function y(r) {
|
|
120
|
+
var e, t, n = (e = v[g]) === null || e === void 0 ? void 0 : e.version;
|
|
121
|
+
if (!(!n || !V(n)))
|
|
122
|
+
return (t = v[g]) === null || t === void 0 ? void 0 : t[r];
|
|
127
123
|
}
|
|
128
|
-
function
|
|
129
|
-
e.debug("@opentelemetry/api: Unregistering a global for " + r + " v" +
|
|
130
|
-
var t =
|
|
124
|
+
function P(r, e) {
|
|
125
|
+
e.debug("@opentelemetry/api: Unregistering a global for " + r + " v" + p + ".");
|
|
126
|
+
var t = v[g];
|
|
131
127
|
t && delete t[r];
|
|
132
128
|
}
|
|
133
|
-
var
|
|
129
|
+
var K = function(r, e) {
|
|
134
130
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
135
131
|
if (!t) return r;
|
|
136
132
|
var n = t.call(r), o, a = [], i;
|
|
@@ -146,11 +142,11 @@ var z = function(r, e) {
|
|
|
146
142
|
}
|
|
147
143
|
}
|
|
148
144
|
return a;
|
|
149
|
-
},
|
|
145
|
+
}, U = function(r, e, t) {
|
|
150
146
|
if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
|
|
151
147
|
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
152
148
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
153
|
-
},
|
|
149
|
+
}, W = (
|
|
154
150
|
/** @class */
|
|
155
151
|
function() {
|
|
156
152
|
function r(e) {
|
|
@@ -180,30 +176,30 @@ var z = function(r, e) {
|
|
|
180
176
|
}()
|
|
181
177
|
);
|
|
182
178
|
function d(r, e, t) {
|
|
183
|
-
var n =
|
|
179
|
+
var n = y("diag");
|
|
184
180
|
if (n)
|
|
185
|
-
return t.unshift(e), n[r].apply(n,
|
|
181
|
+
return t.unshift(e), n[r].apply(n, U([], K(t), !1));
|
|
186
182
|
}
|
|
187
|
-
var
|
|
183
|
+
var c;
|
|
188
184
|
(function(r) {
|
|
189
185
|
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";
|
|
190
|
-
})(
|
|
191
|
-
function
|
|
192
|
-
r <
|
|
186
|
+
})(c || (c = {}));
|
|
187
|
+
function X(r, e) {
|
|
188
|
+
r < c.NONE ? r = c.NONE : r > c.ALL && (r = c.ALL), e = e || {};
|
|
193
189
|
function t(n, o) {
|
|
194
190
|
var a = e[n];
|
|
195
191
|
return typeof a == "function" && r >= o ? a.bind(e) : function() {
|
|
196
192
|
};
|
|
197
193
|
}
|
|
198
194
|
return {
|
|
199
|
-
error: t("error",
|
|
200
|
-
warn: t("warn",
|
|
201
|
-
info: t("info",
|
|
202
|
-
debug: t("debug",
|
|
203
|
-
verbose: t("verbose",
|
|
195
|
+
error: t("error", c.ERROR),
|
|
196
|
+
warn: t("warn", c.WARN),
|
|
197
|
+
info: t("info", c.INFO),
|
|
198
|
+
debug: t("debug", c.DEBUG),
|
|
199
|
+
verbose: t("verbose", c.VERBOSE)
|
|
204
200
|
};
|
|
205
201
|
}
|
|
206
|
-
var
|
|
202
|
+
var Y = function(r, e) {
|
|
207
203
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
208
204
|
if (!t) return r;
|
|
209
205
|
var n = t.call(r), o, a = [], i;
|
|
@@ -219,11 +215,11 @@ var Z = function(r, e) {
|
|
|
219
215
|
}
|
|
220
216
|
}
|
|
221
217
|
return a;
|
|
222
|
-
},
|
|
218
|
+
}, D = function(r, e, t) {
|
|
223
219
|
if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
|
|
224
220
|
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
225
221
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
226
|
-
},
|
|
222
|
+
}, q = "diag", m = (
|
|
227
223
|
/** @class */
|
|
228
224
|
function() {
|
|
229
225
|
function r() {
|
|
@@ -231,38 +227,38 @@ var Z = function(r, e) {
|
|
|
231
227
|
return function() {
|
|
232
228
|
for (var a = [], i = 0; i < arguments.length; i++)
|
|
233
229
|
a[i] = arguments[i];
|
|
234
|
-
var s =
|
|
230
|
+
var s = y("diag");
|
|
235
231
|
if (s)
|
|
236
|
-
return s[o].apply(s,
|
|
232
|
+
return s[o].apply(s, D([], Y(a), !1));
|
|
237
233
|
};
|
|
238
234
|
}
|
|
239
235
|
var t = this, n = function(o, a) {
|
|
240
|
-
var i, s,
|
|
241
|
-
if (a === void 0 && (a = { logLevel:
|
|
242
|
-
var
|
|
243
|
-
return t.error((i =
|
|
236
|
+
var i, s, u;
|
|
237
|
+
if (a === void 0 && (a = { logLevel: c.INFO }), o === t) {
|
|
238
|
+
var l = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
239
|
+
return t.error((i = l.stack) !== null && i !== void 0 ? i : l.message), !1;
|
|
244
240
|
}
|
|
245
241
|
typeof a == "number" && (a = {
|
|
246
242
|
logLevel: a
|
|
247
243
|
});
|
|
248
|
-
var
|
|
249
|
-
if (
|
|
250
|
-
var
|
|
251
|
-
|
|
244
|
+
var f = y("diag"), T = X((s = a.logLevel) !== null && s !== void 0 ? s : c.INFO, o);
|
|
245
|
+
if (f && !a.suppressOverrideMessage) {
|
|
246
|
+
var C = (u = new Error().stack) !== null && u !== void 0 ? u : "<failed to generate stacktrace>";
|
|
247
|
+
f.warn("Current logger will be overwritten from " + C), T.warn("Current logger will overwrite one already registered from " + C);
|
|
252
248
|
}
|
|
253
|
-
return
|
|
249
|
+
return x("diag", T, t, !0);
|
|
254
250
|
};
|
|
255
251
|
t.setLogger = n, t.disable = function() {
|
|
256
|
-
|
|
252
|
+
P(q, t);
|
|
257
253
|
}, t.createComponentLogger = function(o) {
|
|
258
|
-
return new
|
|
254
|
+
return new W(o);
|
|
259
255
|
}, t.verbose = e("verbose"), t.debug = e("debug"), t.info = e("info"), t.warn = e("warn"), t.error = e("error");
|
|
260
256
|
}
|
|
261
257
|
return r.instance = function() {
|
|
262
258
|
return this._instance || (this._instance = new r()), this._instance;
|
|
263
259
|
}, r;
|
|
264
260
|
}()
|
|
265
|
-
),
|
|
261
|
+
), z = function(r, e) {
|
|
266
262
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
267
263
|
if (!t) return r;
|
|
268
264
|
var n = t.call(r), o, a = [], i;
|
|
@@ -278,7 +274,7 @@ var Z = function(r, e) {
|
|
|
278
274
|
}
|
|
279
275
|
}
|
|
280
276
|
return a;
|
|
281
|
-
},
|
|
277
|
+
}, H = function(r) {
|
|
282
278
|
var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
|
|
283
279
|
if (t) return t.call(r);
|
|
284
280
|
if (r && typeof r.length == "number") return {
|
|
@@ -287,7 +283,7 @@ var Z = function(r, e) {
|
|
|
287
283
|
}
|
|
288
284
|
};
|
|
289
285
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
290
|
-
},
|
|
286
|
+
}, J = (
|
|
291
287
|
/** @class */
|
|
292
288
|
function() {
|
|
293
289
|
function r(e) {
|
|
@@ -299,7 +295,7 @@ var Z = function(r, e) {
|
|
|
299
295
|
return Object.assign({}, t);
|
|
300
296
|
}, r.prototype.getAllEntries = function() {
|
|
301
297
|
return Array.from(this._entries.entries()).map(function(e) {
|
|
302
|
-
var t =
|
|
298
|
+
var t = z(e, 2), n = t[0], o = t[1];
|
|
303
299
|
return [n, o];
|
|
304
300
|
});
|
|
305
301
|
}, r.prototype.setEntry = function(e, t) {
|
|
@@ -313,12 +309,12 @@ var Z = function(r, e) {
|
|
|
313
309
|
n[o] = arguments[o];
|
|
314
310
|
var a = new r(this._entries);
|
|
315
311
|
try {
|
|
316
|
-
for (var i =
|
|
317
|
-
var
|
|
318
|
-
a._entries.delete(
|
|
312
|
+
for (var i = H(n), s = i.next(); !s.done; s = i.next()) {
|
|
313
|
+
var u = s.value;
|
|
314
|
+
a._entries.delete(u);
|
|
319
315
|
}
|
|
320
|
-
} catch (
|
|
321
|
-
e = { error:
|
|
316
|
+
} catch (l) {
|
|
317
|
+
e = { error: l };
|
|
322
318
|
} finally {
|
|
323
319
|
try {
|
|
324
320
|
s && !s.done && (t = i.return) && t.call(i);
|
|
@@ -332,14 +328,14 @@ var Z = function(r, e) {
|
|
|
332
328
|
}, r;
|
|
333
329
|
}()
|
|
334
330
|
);
|
|
335
|
-
|
|
336
|
-
function
|
|
337
|
-
return r === void 0 && (r = {}), new
|
|
331
|
+
m.instance();
|
|
332
|
+
function Q(r) {
|
|
333
|
+
return r === void 0 && (r = {}), new J(new Map(Object.entries(r)));
|
|
338
334
|
}
|
|
339
|
-
function
|
|
335
|
+
function Z(r) {
|
|
340
336
|
return Symbol.for(r);
|
|
341
337
|
}
|
|
342
|
-
var
|
|
338
|
+
var L = (
|
|
343
339
|
/** @class */
|
|
344
340
|
/* @__PURE__ */ function() {
|
|
345
341
|
function r(e) {
|
|
@@ -356,7 +352,7 @@ var ie = (
|
|
|
356
352
|
}
|
|
357
353
|
return r;
|
|
358
354
|
}()
|
|
359
|
-
),
|
|
355
|
+
), ee = new L(), te = {
|
|
360
356
|
get: function(r, e) {
|
|
361
357
|
if (r != null)
|
|
362
358
|
return r[e];
|
|
@@ -364,11 +360,11 @@ var ie = (
|
|
|
364
360
|
keys: function(r) {
|
|
365
361
|
return r == null ? [] : Object.keys(r);
|
|
366
362
|
}
|
|
367
|
-
},
|
|
363
|
+
}, re = {
|
|
368
364
|
set: function(r, e, t) {
|
|
369
365
|
r != null && (r[e] = t);
|
|
370
366
|
}
|
|
371
|
-
},
|
|
367
|
+
}, ne = function(r, e) {
|
|
372
368
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
373
369
|
if (!t) return r;
|
|
374
370
|
var n = t.call(r), o, a = [], i;
|
|
@@ -384,21 +380,21 @@ var ie = (
|
|
|
384
380
|
}
|
|
385
381
|
}
|
|
386
382
|
return a;
|
|
387
|
-
},
|
|
383
|
+
}, ae = function(r, e, t) {
|
|
388
384
|
if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
|
|
389
385
|
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
390
386
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
391
|
-
},
|
|
387
|
+
}, oe = (
|
|
392
388
|
/** @class */
|
|
393
389
|
function() {
|
|
394
390
|
function r() {
|
|
395
391
|
}
|
|
396
392
|
return r.prototype.active = function() {
|
|
397
|
-
return
|
|
393
|
+
return ee;
|
|
398
394
|
}, r.prototype.with = function(e, t, n) {
|
|
399
395
|
for (var o = [], a = 3; a < arguments.length; a++)
|
|
400
396
|
o[a - 3] = arguments[a];
|
|
401
|
-
return t.call.apply(t,
|
|
397
|
+
return t.call.apply(t, ae([n], ne(o), !1));
|
|
402
398
|
}, r.prototype.bind = function(e, t) {
|
|
403
399
|
return t;
|
|
404
400
|
}, r.prototype.enable = function() {
|
|
@@ -407,7 +403,7 @@ var ie = (
|
|
|
407
403
|
return this;
|
|
408
404
|
}, r;
|
|
409
405
|
}()
|
|
410
|
-
),
|
|
406
|
+
), ie = function(r, e) {
|
|
411
407
|
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
412
408
|
if (!t) return r;
|
|
413
409
|
var n = t.call(r), o, a = [], i;
|
|
@@ -423,11 +419,11 @@ var ie = (
|
|
|
423
419
|
}
|
|
424
420
|
}
|
|
425
421
|
return a;
|
|
426
|
-
},
|
|
422
|
+
}, se = function(r, e, t) {
|
|
427
423
|
if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
|
|
428
424
|
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
429
425
|
return r.concat(a || Array.prototype.slice.call(e));
|
|
430
|
-
},
|
|
426
|
+
}, E = "context", ue = new oe(), G = (
|
|
431
427
|
/** @class */
|
|
432
428
|
function() {
|
|
433
429
|
function r() {
|
|
@@ -435,26 +431,26 @@ var ie = (
|
|
|
435
431
|
return r.getInstance = function() {
|
|
436
432
|
return this._instance || (this._instance = new r()), this._instance;
|
|
437
433
|
}, r.prototype.setGlobalContextManager = function(e) {
|
|
438
|
-
return
|
|
434
|
+
return x(E, e, m.instance());
|
|
439
435
|
}, r.prototype.active = function() {
|
|
440
436
|
return this._getContextManager().active();
|
|
441
437
|
}, r.prototype.with = function(e, t, n) {
|
|
442
438
|
for (var o, a = [], i = 3; i < arguments.length; i++)
|
|
443
439
|
a[i - 3] = arguments[i];
|
|
444
|
-
return (o = this._getContextManager()).with.apply(o,
|
|
440
|
+
return (o = this._getContextManager()).with.apply(o, se([e, t, n], ie(a), !1));
|
|
445
441
|
}, r.prototype.bind = function(e, t) {
|
|
446
442
|
return this._getContextManager().bind(e, t);
|
|
447
443
|
}, r.prototype._getContextManager = function() {
|
|
448
|
-
return
|
|
444
|
+
return y(E) || ue;
|
|
449
445
|
}, r.prototype.disable = function() {
|
|
450
|
-
this._getContextManager().disable(),
|
|
446
|
+
this._getContextManager().disable(), P(E, m.instance());
|
|
451
447
|
}, r;
|
|
452
448
|
}()
|
|
453
|
-
),
|
|
449
|
+
), N;
|
|
454
450
|
(function(r) {
|
|
455
451
|
r[r.UNSET = 0] = "UNSET", r[r.OK = 1] = "OK", r[r.ERROR = 2] = "ERROR";
|
|
456
|
-
})(
|
|
457
|
-
var
|
|
452
|
+
})(N || (N = {}));
|
|
453
|
+
var ce = G.getInstance(), le = (
|
|
458
454
|
/** @class */
|
|
459
455
|
function() {
|
|
460
456
|
function r() {
|
|
@@ -466,51 +462,52 @@ var ve = k.getInstance(), ye = (
|
|
|
466
462
|
return [];
|
|
467
463
|
}, r;
|
|
468
464
|
}()
|
|
469
|
-
),
|
|
470
|
-
function
|
|
471
|
-
return r.getValue(
|
|
465
|
+
), R = Z("OpenTelemetry Baggage Key");
|
|
466
|
+
function j(r) {
|
|
467
|
+
return r.getValue(R) || void 0;
|
|
472
468
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
469
|
+
function fe() {
|
|
470
|
+
return j(G.getInstance().active());
|
|
475
471
|
}
|
|
476
|
-
function
|
|
477
|
-
return r.setValue(
|
|
472
|
+
function pe(r, e) {
|
|
473
|
+
return r.setValue(R, e);
|
|
478
474
|
}
|
|
479
|
-
function
|
|
480
|
-
return r.deleteValue(
|
|
475
|
+
function he(r) {
|
|
476
|
+
return r.deleteValue(R);
|
|
481
477
|
}
|
|
482
|
-
var
|
|
478
|
+
var A = "propagation", de = new le(), ge = (
|
|
483
479
|
/** @class */
|
|
484
480
|
function() {
|
|
485
481
|
function r() {
|
|
486
|
-
this.createBaggage =
|
|
482
|
+
this.createBaggage = Q, this.getBaggage = j, this.getActiveBaggage = fe, this.setBaggage = pe, this.deleteBaggage = he;
|
|
487
483
|
}
|
|
488
484
|
return r.getInstance = function() {
|
|
489
485
|
return this._instance || (this._instance = new r()), this._instance;
|
|
490
486
|
}, r.prototype.setGlobalPropagator = function(e) {
|
|
491
|
-
return
|
|
487
|
+
return x(A, e, m.instance());
|
|
492
488
|
}, r.prototype.inject = function(e, t, n) {
|
|
493
|
-
return n === void 0 && (n =
|
|
489
|
+
return n === void 0 && (n = re), this._getGlobalPropagator().inject(e, t, n);
|
|
494
490
|
}, r.prototype.extract = function(e, t, n) {
|
|
495
|
-
return n === void 0 && (n =
|
|
491
|
+
return n === void 0 && (n = te), this._getGlobalPropagator().extract(e, t, n);
|
|
496
492
|
}, r.prototype.fields = function() {
|
|
497
493
|
return this._getGlobalPropagator().fields();
|
|
498
494
|
}, r.prototype.disable = function() {
|
|
499
|
-
|
|
495
|
+
P(A, m.instance());
|
|
500
496
|
}, r.prototype._getGlobalPropagator = function() {
|
|
501
|
-
return
|
|
497
|
+
return y(A) || de;
|
|
502
498
|
}, r;
|
|
503
499
|
}()
|
|
504
|
-
),
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
500
|
+
), ve = ge.getInstance();
|
|
501
|
+
const M = ["bench", "debug", "prod"], ye = (r) => (e) => M.indexOf(e) >= M.indexOf(r);
|
|
502
|
+
class w {
|
|
503
|
+
meta = h.NOOP;
|
|
504
|
+
otelTracer;
|
|
505
|
+
filter;
|
|
506
|
+
constructor(e, t = ye("debug")) {
|
|
510
507
|
this.otelTracer = e, this.filter = t;
|
|
511
508
|
}
|
|
512
509
|
child(e) {
|
|
513
|
-
const t = new
|
|
510
|
+
const t = new w(this.otelTracer, this.filter);
|
|
514
511
|
return t.meta = e, t;
|
|
515
512
|
}
|
|
516
513
|
/**
|
|
@@ -564,11 +561,11 @@ const F = ["bench", "debug", "prod"], Ae = (r) => (e) => F.indexOf(e) >= F.index
|
|
|
564
561
|
if (n == null) {
|
|
565
562
|
if (o) return () => {
|
|
566
563
|
};
|
|
567
|
-
const a = new
|
|
564
|
+
const a = new S(e, this.otelTracer.startSpan(e));
|
|
568
565
|
return a.start(), () => a.end();
|
|
569
566
|
}
|
|
570
|
-
return o ? n(new
|
|
571
|
-
const i = new
|
|
567
|
+
return o ? n(new me(e)) : this.otelTracer.startActiveSpan(e, (a) => {
|
|
568
|
+
const i = new S(e, a);
|
|
572
569
|
return n(i);
|
|
573
570
|
});
|
|
574
571
|
}
|
|
@@ -581,28 +578,27 @@ const F = ["bench", "debug", "prod"], Ae = (r) => (e) => F.indexOf(e) >= F.index
|
|
|
581
578
|
*/
|
|
582
579
|
propagate(e) {
|
|
583
580
|
if (this.meta.noop) return;
|
|
584
|
-
const t =
|
|
585
|
-
|
|
581
|
+
const t = ce.active();
|
|
582
|
+
ve.inject(t, e, {
|
|
586
583
|
set: (n, o, a) => {
|
|
587
584
|
n[o] = a;
|
|
588
585
|
}
|
|
589
586
|
});
|
|
590
587
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
588
|
+
/** Tracer implementation that does nothing */
|
|
589
|
+
static NOOP = new w();
|
|
590
|
+
}
|
|
591
|
+
class S {
|
|
592
|
+
key;
|
|
593
|
+
otel;
|
|
596
594
|
constructor(e, t) {
|
|
597
|
-
u(this, "key");
|
|
598
|
-
u(this, "otel");
|
|
599
595
|
this.key = e, this.otel = t;
|
|
600
596
|
}
|
|
601
597
|
set(e, t) {
|
|
602
598
|
this.otel.setAttribute(e, t);
|
|
603
599
|
}
|
|
604
600
|
recordError(e) {
|
|
605
|
-
e != null && (this.otel.recordException(e), this.otel.setStatus({ code:
|
|
601
|
+
e != null && (this.otel.recordException(e), this.otel.setStatus({ code: N.ERROR }));
|
|
606
602
|
}
|
|
607
603
|
start() {
|
|
608
604
|
performance.mark(`alamos.trace.start.${this.key}`);
|
|
@@ -621,9 +617,9 @@ class V {
|
|
|
621
617
|
}
|
|
622
618
|
}
|
|
623
619
|
}
|
|
624
|
-
class
|
|
620
|
+
class me {
|
|
621
|
+
key;
|
|
625
622
|
constructor(e) {
|
|
626
|
-
u(this, "key");
|
|
627
623
|
this.key = e;
|
|
628
624
|
}
|
|
629
625
|
set() {
|
|
@@ -631,42 +627,41 @@ class Ne {
|
|
|
631
627
|
recordError(e) {
|
|
632
628
|
}
|
|
633
629
|
}
|
|
634
|
-
|
|
630
|
+
class O {
|
|
631
|
+
meta;
|
|
632
|
+
T;
|
|
633
|
+
L;
|
|
635
634
|
constructor({
|
|
636
635
|
key: e = "",
|
|
637
636
|
serviceName: t = "",
|
|
638
|
-
logger: n =
|
|
639
|
-
tracer: o =
|
|
637
|
+
logger: n = _.NOOP,
|
|
638
|
+
tracer: o = w.NOOP,
|
|
640
639
|
noop: a = !1,
|
|
641
640
|
__meta: i
|
|
642
641
|
}) {
|
|
643
|
-
|
|
644
|
-
u(this, "T");
|
|
645
|
-
u(this, "L");
|
|
646
|
-
this.meta = i ?? new b(e, e, t, a), this.T = o.child(this.meta), this.L = n.child(this.meta);
|
|
642
|
+
this.meta = i ?? new h(e, e, t, a), this.T = o.child(this.meta), this.L = n.child(this.meta);
|
|
647
643
|
}
|
|
648
644
|
child(e) {
|
|
649
645
|
const t = this.meta.child(e);
|
|
650
|
-
return new
|
|
646
|
+
return new O({ __meta: t, tracer: this.T, logger: this.L });
|
|
651
647
|
}
|
|
652
|
-
};
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const Te = C.NOOP;
|
|
648
|
+
static NOOP = new O({ noop: !0 });
|
|
649
|
+
}
|
|
650
|
+
const we = O.NOOP;
|
|
656
651
|
export {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
T,
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
652
|
+
G as C,
|
|
653
|
+
m as D,
|
|
654
|
+
O as I,
|
|
655
|
+
I as L,
|
|
656
|
+
we as N,
|
|
657
|
+
w as T,
|
|
658
|
+
S as _,
|
|
659
|
+
_ as a,
|
|
660
|
+
me as b,
|
|
661
|
+
be as c,
|
|
662
|
+
Z as d,
|
|
663
|
+
y as g,
|
|
664
|
+
_e as l,
|
|
665
|
+
x as r,
|
|
666
|
+
P as u
|
|
672
667
|
};
|
|
@@ -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/dist/log.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { record } from '@synnaxlabs/x';
|
|
2
2
|
import { Meta } from './meta';
|
|
3
3
|
export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
4
4
|
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
@@ -7,7 +7,7 @@ export interface LogLevelFilterProps {
|
|
|
7
7
|
path: string;
|
|
8
8
|
level: LogLevel;
|
|
9
9
|
}
|
|
10
|
-
type KV =
|
|
10
|
+
type KV = record.Unknown | (() => record.Unknown);
|
|
11
11
|
/**
|
|
12
12
|
* LogLevelFilter is a function that returns true if the log at the given
|
|
13
13
|
* level should be emitted.
|
package/dist/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,eAAO,MAAM,UAAU,6CAA8C,CAAC;AACtE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,KAAK,EAAE,GAAG,MAAM,CAAC,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC;AAErE,eAAO,MAAM,kBAAkB,GAAI,QAAQ,QAAQ,KAAG,cAGrD,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,eAAO,MAAM,gBAAgB,GAAI,OAAO,sBAAsB,KAAG,cAOhE,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,qBAAa,MAAM;IACjB,IAAI,EAAE,IAAI,CAAa;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;gBAEd,CAAC,GAAE,WAAgB;IAK/B,OAAO,CAAC,MAAM;IAad,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAMzB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAMzD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAMxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAMxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAMzD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAgB;CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/alamos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed instrumentation for Synnax",
|
|
6
6
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/freighter/ts",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@opentelemetry/api": "^1.9.0",
|
|
19
|
-
"@synnaxlabs/x": "0.
|
|
19
|
+
"@synnaxlabs/x": "^0.44.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"eslint": "^9.
|
|
22
|
+
"eslint": "^9.30.1",
|
|
23
23
|
"madge": "^8.0.0",
|
|
24
24
|
"typescript": "^5.8.3",
|
|
25
|
-
"vite": "^
|
|
26
|
-
"vitest": "^3.2.
|
|
27
|
-
"@synnaxlabs/
|
|
28
|
-
"eslint-config-synnaxlabs": "0.43.0",
|
|
29
|
-
"@synnaxlabs/
|
|
25
|
+
"vite": "^7.0.4",
|
|
26
|
+
"vitest": "^3.2.4",
|
|
27
|
+
"@synnaxlabs/vite-plugin": "^0.43.0",
|
|
28
|
+
"eslint-config-synnaxlabs": "^0.43.0",
|
|
29
|
+
"@synnaxlabs/tsconfig": "^0.43.0"
|
|
30
30
|
},
|
|
31
31
|
"main": "dist/index.js",
|
|
32
32
|
"module": "dist/index.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"build": "tsc --noEmit && vite build",
|
|
48
48
|
"watch": "tsc --noEmit && vite build --watch",
|
|
49
49
|
"test": "vitest",
|
|
50
|
-
"lint": "eslint
|
|
51
|
-
"fix": "eslint --
|
|
50
|
+
"lint": "eslint",
|
|
51
|
+
"fix": "eslint --fix",
|
|
52
52
|
"madge": "madge --circular src"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/log.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import { type
|
|
10
|
+
import { type record } from "@synnaxlabs/x";
|
|
11
11
|
|
|
12
12
|
import { Meta } from "@/meta";
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ export interface LogLevelFilterProps {
|
|
|
20
20
|
level: LogLevel;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
type KV =
|
|
23
|
+
type KV = record.Unknown | (() => record.Unknown);
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* LogLevelFilter is a function that returns true if the log at the given
|
|
@@ -105,4 +105,4 @@ export class Logger {
|
|
|
105
105
|
static readonly NOOP = new Logger();
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
const parseKV = (kv: KV):
|
|
108
|
+
const parseKV = (kv: KV): record.Unknown => (typeof kv === "function" ? kv() : kv);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var X=Object.defineProperty;var Y=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>Y(r,typeof e!="symbol"?e+"":e,t);const y=class y{constructor(e,t,n="",o=!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=o}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 B=["debug","info","warn","error"],D=r=>{const e=B.indexOf(r);return({level:t})=>B.indexOf(t)>=e},q=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)))},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:{},h="1.9.0",K=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function H(r){var e=new Set([r]),t=new Set,n=r.match(K);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(c){return c===r};function a(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(K);if(!f)return a(c);var p={major:+f[1],minor:+f[2],patch:+f[3],prerelease:f[4]};return p.prerelease!=null||o.major!==p.major?a(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):a(c):o.minor<=p.minor?i(c):a(c)}}var J=H(h),Q=h.split(".")[0],O=Symbol.for("opentelemetry.js.api."+Q),E=z;function R(r,e,t,n){var o;n===void 0&&(n=!1);var a=E[O]=(o=E[O])!==null&&o!==void 0?o:{version:h};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!==h){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+r+" does not match previously registered API v"+h);return t.error(i.stack||i.message),!1}return a[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+h+"."),!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 T(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+h+".");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),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,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))},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,o){var a=e[n];return typeof a=="function"&&r>=o?a.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),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},ne=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))},ae="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,ne([],re(a),!1))}}var t=this,n=function(o,a){var i,u,c;if(a===void 0&&(a={logLevel:l.INFO}),o===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 a=="number"&&(a={logLevel:a});var p=g("diag"),$=te((u=a.logLevel)!==null&&u!==void 0?u:l.INFO,o);if(p&&!a.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),$.warn("Current logger will overwrite one already registered from "+F)}return R("diag",$,t,!0)};t.setLogger=n,t.disable=function(){T(ae,t)},t.createComponentLogger=function(o){return new ee(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}(),oe=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},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],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=ie(n),u=i.next();!u.done;u=i.next()){var c=u.value;a._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 a},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 k(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,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}(),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)}},he=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},ge=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))},de=function(){function r(){}return r.prototype.active=function(){return le},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,ge([n],he(o),!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),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},ye=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))},C="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(C,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,ye([e,t,n],ve(a),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return g(C)||me},r.prototype.disable=function(){this._getContextManager().disable(),T(C,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}(),j=k("OpenTelemetry Baggage Key");function U(r){return r.getValue(j)||void 0}function we(){return U(M.getInstance().active())}function Oe(r,e){return r.setValue(j,e)}function Ee(r){return r.deleteValue(j)}var I="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(I,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(){T(I,d.instance())},r.prototype._getGlobalPropagator=function(){return g(I)||Ae},r}(),xe=Ne.getInstance();const V=["bench","debug","prod"],Pe=r=>e=>V.indexOf(e)>=V.indexOf(r),b=class b{constructor(e,t=Pe("debug")){s(this,"meta",w.NOOP);s(this,"otelTracer");s(this,"filter");this.otelTracer=e,this.filter=t}child(e){const t=new b(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 S(e,this.otelTracer.startSpan(e));return a.start(),()=>a.end()}return o?n(new W(e)):this.otelTracer.startActiveSpan(e,a=>{const i=new S(e,a);return n(i)})}propagate(e){if(this.meta.noop)return;const t=be.active();xe.inject(t,e,{set:(n,o,a)=>{n[o]=a}})}};s(b,"NOOP",new b);let x=b;class S{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}))}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 W{constructor(e){s(this,"key");this.key=e}set(){}recordError(e){}}const _=class _{constructor({key:e="",serviceName:t="",logger:n=N.NOOP,tracer:o=x.NOOP,noop:a=!1,__meta:i}){s(this,"meta");s(this,"T");s(this,"L");this.meta=i??new w(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 _({__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=B;exports.Logger=N;exports.NOOP=Re;exports.NoopSpan=W;exports.Tracer=x;exports._Span=S;exports.createContextKey=k;exports.getGlobal=g;exports.logLevelKeyFiler=q;exports.logThresholdFilter=D;exports.registerGlobal=R;exports.unregisterGlobal=T;
|