@utk09/ui-observability 0.9.4 → 0.9.5
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/CHANGELOG.md +45 -0
- package/README.md +122 -94
- package/dist/batch-BQFtb3i5.cjs +2 -0
- package/dist/batch-BQFtb3i5.cjs.map +1 -0
- package/dist/{batch-D-4xl7op.js → batch-BUJh-1jZ.js} +7 -5
- package/dist/batch-BUJh-1jZ.js.map +1 -0
- package/dist/bus/bus.d.ts +76 -2
- package/dist/bus/links.d.ts +9 -2
- package/dist/bus/validation.d.ts +7 -0
- package/dist/bus-BW6N-pY8.cjs +2 -0
- package/dist/bus-BW6N-pY8.cjs.map +1 -0
- package/dist/bus-DeOPHWaD.js +647 -0
- package/dist/bus-DeOPHWaD.js.map +1 -0
- package/dist/capture/storm.d.ts +2 -1
- package/dist/capture/types.d.ts +2 -0
- package/dist/{console-Boqa7new.cjs → console-Ce6heqZZ.cjs} +2 -2
- package/dist/console-Ce6heqZZ.cjs.map +1 -0
- package/dist/{console-BT7mcgU6.js → console-DbAZYJuy.js} +4 -4
- package/dist/console-DbAZYJuy.js.map +1 -0
- package/dist/constants-CN7GE1Lt.js +246 -0
- package/dist/constants-CN7GE1Lt.js.map +1 -0
- package/dist/constants-CW-MlHdY.cjs +2 -0
- package/dist/constants-CW-MlHdY.cjs.map +1 -0
- package/dist/constants.d.ts +29 -9
- package/dist/context-storage-BjzeBSxH.cjs +2 -0
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -0
- package/dist/context-storage-DxZf4Gfh.js +52 -0
- package/dist/context-storage-DxZf4Gfh.js.map +1 -0
- package/dist/core/breadcrumbs.d.ts +7 -2
- package/dist/core/context.d.ts +2 -0
- package/dist/core/diagnostics.d.ts +11 -3
- package/dist/core/meter.d.ts +6 -1
- package/dist/core/pipeline.d.ts +29 -2
- package/dist/core/record.d.ts +2 -1
- package/dist/core/runtime.d.ts +91 -3
- package/dist/core/sampling.d.ts +3 -1
- package/dist/core/sender.d.ts +35 -1
- package/dist/deadline-5_PecIl5.js +26 -0
- package/dist/deadline-5_PecIl5.js.map +1 -0
- package/dist/deadline-XSnm95pg.cjs +2 -0
- package/dist/deadline-XSnm95pg.cjs.map +1 -0
- package/dist/emergency-queue-BYUyDHGD.js +69 -0
- package/dist/emergency-queue-BYUyDHGD.js.map +1 -0
- package/dist/emergency-queue-Cs1hrjsC.cjs +2 -0
- package/dist/emergency-queue-Cs1hrjsC.cjs.map +1 -0
- package/dist/{errors-BDI96zKc.js → errors-BhC7HTSt.js} +8 -9
- package/dist/errors-BhC7HTSt.js.map +1 -0
- package/dist/errors-CgY633cG.cjs +3 -0
- package/dist/errors-CgY633cG.cjs.map +1 -0
- package/dist/factory-C5TujXlU.js +280 -0
- package/dist/factory-C5TujXlU.js.map +1 -0
- package/dist/factory-CNj4DH3n.cjs +2 -0
- package/dist/factory-CNj4DH3n.cjs.map +1 -0
- package/dist/fixed-window-CtaFHanJ.js +12 -0
- package/dist/fixed-window-CtaFHanJ.js.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs +2 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -0
- package/dist/identity-8vKkyAWm.js +103 -0
- package/dist/identity-8vKkyAWm.js.map +1 -0
- package/dist/identity-Da9TkuKd.cjs +2 -0
- package/dist/identity-Da9TkuKd.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +45 -7
- package/dist/index.js +908 -529
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-BTfIFRHF.cjs +2 -0
- package/dist/indexeddb-storage-BTfIFRHF.cjs.map +1 -0
- package/dist/{indexeddb-storage-HgkQUTyS.js → indexeddb-storage-CCA1LvtO.js} +33 -18
- package/dist/indexeddb-storage-CCA1LvtO.js.map +1 -0
- package/dist/{interactions-Ck01cEij.js → interactions-BUDLxbv1.js} +16 -12
- package/dist/interactions-BUDLxbv1.js.map +1 -0
- package/dist/interactions-NHbLKrqe.cjs +2 -0
- package/dist/interactions-NHbLKrqe.cjs.map +1 -0
- package/dist/{journey-DRK0A8u_.js → journey-BUJ4WJxP.js} +12 -12
- package/dist/{journey-DRK0A8u_.js.map → journey-BUJ4WJxP.js.map} +1 -1
- package/dist/{journey-Co9OlzrW.cjs → journey-B_tTnvac.cjs} +2 -2
- package/dist/{journey-Co9OlzrW.cjs.map → journey-B_tTnvac.cjs.map} +1 -1
- package/dist/keys-BHhw_0Wh.cjs +2 -0
- package/dist/keys-BHhw_0Wh.cjs.map +1 -0
- package/dist/keys-D5r_GH9q.js +17 -0
- package/dist/keys-D5r_GH9q.js.map +1 -0
- package/dist/{library-request-ChCar5F8.js → library-request-BKOcaKtQ.js} +2 -2
- package/dist/{library-request-ChCar5F8.js.map → library-request-BKOcaKtQ.js.map} +1 -1
- package/dist/{library-request-gMFOCNcn.cjs → library-request-BaZOi4eg.cjs} +2 -2
- package/dist/{library-request-gMFOCNcn.cjs.map → library-request-BaZOi4eg.cjs.map} +1 -1
- package/dist/{long-frames-Bky6nZDF.cjs → long-frames-CF3qiSAX.cjs} +2 -2
- package/dist/long-frames-CF3qiSAX.cjs.map +1 -0
- package/dist/{long-frames-DDumopji.js → long-frames-DI5ypfAF.js} +5 -5
- package/dist/long-frames-DI5ypfAF.js.map +1 -0
- package/dist/models/batch.d.ts +4 -0
- package/dist/models/bus.d.ts +32 -9
- package/dist/models/config.d.ts +347 -9
- package/dist/models/drop.d.ts +1 -1
- package/dist/models/health.d.ts +27 -0
- package/dist/models/storage.d.ts +13 -0
- package/dist/network-CF8UO5PK.cjs +2 -0
- package/dist/network-CF8UO5PK.cjs.map +1 -0
- package/dist/{network-BsBZ6_-Q.js → network-DdzXDI3J.js} +18 -16
- package/dist/network-DdzXDI3J.js.map +1 -0
- package/dist/openfin-BwEN0uj4.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/{platform-4yYjMD-B.js → platform-Bw1btWCT.js} +16 -10
- package/dist/platform-Bw1btWCT.js.map +1 -0
- package/dist/platform-DBSKTvFn.cjs +2 -0
- package/dist/platform-DBSKTvFn.cjs.map +1 -0
- package/dist/{remote-rules-1KqfVBIu.js → remote-rules-DIcC5vVC.js} +3 -3
- package/dist/{remote-rules-1KqfVBIu.js.map → remote-rules-DIcC5vVC.js.map} +1 -1
- package/dist/{remote-rules-BHgEGlYi.cjs → remote-rules-DpFmOef2.cjs} +2 -2
- package/dist/{remote-rules-BHgEGlYi.cjs.map → remote-rules-DpFmOef2.cjs.map} +1 -1
- package/dist/sampling-BVjspJWu.cjs +2 -0
- package/dist/sampling-BVjspJWu.cjs.map +1 -0
- package/dist/{sampling-nYIWP_vP.js → sampling-Cm3WhI0a.js} +26 -36
- package/dist/sampling-Cm3WhI0a.js.map +1 -0
- package/dist/{sanitize-BiUKCUG6.js → sanitize-C-ahCFsG.js} +2 -2
- package/dist/{sanitize-BiUKCUG6.js.map → sanitize-C-ahCFsG.js.map} +1 -1
- package/dist/{sanitize-BxuPSXOk.cjs → sanitize-DHucKGdi.cjs} +2 -2
- package/dist/{sanitize-BxuPSXOk.cjs.map → sanitize-DHucKGdi.cjs.map} +1 -1
- package/dist/sender-D3fRCR8d.cjs +3 -0
- package/dist/sender-D3fRCR8d.cjs.map +1 -0
- package/dist/sender-DUUmSglb.js +1163 -0
- package/dist/sender-DUUmSglb.js.map +1 -0
- package/dist/storage/context-storage.d.ts +89 -0
- package/dist/storage/emergency-queue.d.ts +9 -1
- package/dist/storage/factory.d.ts +7 -1
- package/dist/storage/idb-driver.d.ts +13 -0
- package/dist/storage/indexeddb-storage.d.ts +13 -0
- package/dist/storage/local-storage.d.ts +21 -1
- package/dist/storage/memory-storage.d.ts +13 -0
- package/dist/storage-BA9RqRO-.cjs +2 -0
- package/dist/storage-BA9RqRO-.cjs.map +1 -0
- package/dist/storage-w7Tslvlq.js +17 -0
- package/dist/storage-w7Tslvlq.js.map +1 -0
- package/dist/storm-CNZjsw4T.cjs +2 -0
- package/dist/storm-CNZjsw4T.cjs.map +1 -0
- package/dist/storm-Daq2jGHU.js +10 -0
- package/dist/storm-Daq2jGHU.js.map +1 -0
- package/dist/transport/retry-engine.d.ts +7 -2
- package/dist/transport/status-transport.d.ts +17 -0
- package/dist/types-BR9t_w28.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/utils/fixed-window.d.ts +9 -0
- package/dist/utils/identity.d.ts +9 -2
- package/dist/utils/lock.d.ts +8 -0
- package/dist/utils/openfin.d.ts +1 -1
- package/dist/utils/platform.d.ts +3 -1
- package/dist/web-socket-BacvKOvD.cjs +2 -0
- package/dist/web-socket-BacvKOvD.cjs.map +1 -0
- package/dist/web-socket-CpsD8WAa.js +105 -0
- package/dist/web-socket-CpsD8WAa.js.map +1 -0
- package/package.json +1 -1
- package/dist/batch-C4oF6XZT.cjs +0 -2
- package/dist/batch-C4oF6XZT.cjs.map +0 -1
- package/dist/batch-D-4xl7op.js.map +0 -1
- package/dist/bus-Cyvq-Ngx.js +0 -478
- package/dist/bus-Cyvq-Ngx.js.map +0 -1
- package/dist/bus-rOhVuRee.cjs +0 -2
- package/dist/bus-rOhVuRee.cjs.map +0 -1
- package/dist/console-BT7mcgU6.js.map +0 -1
- package/dist/console-Boqa7new.cjs.map +0 -1
- package/dist/constants-BgRS6MB0.cjs +0 -2
- package/dist/constants-BgRS6MB0.cjs.map +0 -1
- package/dist/constants-L_d5YvvQ.js +0 -160
- package/dist/constants-L_d5YvvQ.js.map +0 -1
- package/dist/errors-BDI96zKc.js.map +0 -1
- package/dist/errors-_xEsCVXn.cjs +0 -3
- package/dist/errors-_xEsCVXn.cjs.map +0 -1
- package/dist/fixed-window-BR0bu32Y.cjs +0 -2
- package/dist/fixed-window-BR0bu32Y.cjs.map +0 -1
- package/dist/fixed-window-Re7jIRJH.js +0 -9
- package/dist/fixed-window-Re7jIRJH.js.map +0 -1
- package/dist/identity-Bwku7zzN.cjs +0 -2
- package/dist/identity-Bwku7zzN.cjs.map +0 -1
- package/dist/identity-Dtv917nz.js +0 -98
- package/dist/identity-Dtv917nz.js.map +0 -1
- package/dist/indexeddb-storage-Cvavrf-y.cjs +0 -2
- package/dist/indexeddb-storage-Cvavrf-y.cjs.map +0 -1
- package/dist/indexeddb-storage-HgkQUTyS.js.map +0 -1
- package/dist/interactions-Bhe1ft8P.cjs +0 -2
- package/dist/interactions-Bhe1ft8P.cjs.map +0 -1
- package/dist/interactions-Ck01cEij.js.map +0 -1
- package/dist/log-record-cwFiLyPY.js +0 -17
- package/dist/log-record-cwFiLyPY.js.map +0 -1
- package/dist/log-record-jX9eWUP8.cjs +0 -2
- package/dist/log-record-jX9eWUP8.cjs.map +0 -1
- package/dist/long-frames-Bky6nZDF.cjs.map +0 -1
- package/dist/long-frames-DDumopji.js.map +0 -1
- package/dist/network-BsBZ6_-Q.js.map +0 -1
- package/dist/network-_4csBGBM.cjs +0 -2
- package/dist/network-_4csBGBM.cjs.map +0 -1
- package/dist/platform-4yYjMD-B.js.map +0 -1
- package/dist/platform-o7r1ocOu.cjs +0 -2
- package/dist/platform-o7r1ocOu.cjs.map +0 -1
- package/dist/sampling-C4my-ma0.cjs +0 -2
- package/dist/sampling-C4my-ma0.cjs.map +0 -1
- package/dist/sampling-nYIWP_vP.js.map +0 -1
- package/dist/sender-6vrT9fFL.cjs +0 -3
- package/dist/sender-6vrT9fFL.cjs.map +0 -1
- package/dist/sender-DFQMF39P.js +0 -1351
- package/dist/sender-DFQMF39P.js.map +0 -1
- package/dist/storm-6YYbXzT_.cjs +0 -2
- package/dist/storm-6YYbXzT_.cjs.map +0 -1
- package/dist/storm-CfO0Sam2.js +0 -10
- package/dist/storm-CfO0Sam2.js.map +0 -1
- package/dist/web-socket-Ar4cZxmd.js +0 -102
- package/dist/web-socket-Ar4cZxmd.js.map +0 -1
- package/dist/web-socket-BwJdwSHl.cjs +0 -2
- package/dist/web-socket-BwJdwSHl.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import { a as
|
|
7
|
-
import { r as
|
|
8
|
-
import { i as
|
|
9
|
-
import { r as
|
|
10
|
-
import { n as
|
|
1
|
+
import { $t as e, Bt as t, C as n, Ct as r, En as i, Ft as a, Gt as o, Ht as s, Jt as c, Kt as l, L as u, M as d, N as f, Qt as p, R as m, St as h, Tn as g, Ut as _, V as v, Vt as y, Wt as ee, Xt as te, Yt as ne, Zt as re, _n as ie, a as ae, an as oe, bn as se, c as b, d as x, f as ce, gn as le, gt as ue, h as de, i as fe, j as pe, k as me, l as he, ln as ge, m as _e, mt as S, o as C, on as w, p as ve, pt as ye, qt as be, r as T, s as xe, tn as E, u as Se, vn as D, wn as Ce, wt as we, xn as Te, yn as Ee, z as De, zt as Oe } from "./constants-CN7GE1Lt.js";
|
|
2
|
+
import { n as ke, r as Ae, t as je } from "./error-like-Ywo5uRHo.js";
|
|
3
|
+
import { a as Me, c as Ne, i as Pe, l as Fe, n as Ie, o as Le, s as Re, u as O } from "./sampling-Cm3WhI0a.js";
|
|
4
|
+
import { r as ze } from "./deadline-5_PecIl5.js";
|
|
5
|
+
import { a as Be, i as Ve, n as He, o as k, r as A } from "./sanitize-C-ahCFsG.js";
|
|
6
|
+
import { a as Ue, i as j, n as We, o as Ge, r as Ke, s as qe, t as Je } from "./identity-8vKkyAWm.js";
|
|
7
|
+
import { r as Ye } from "./library-request-BKOcaKtQ.js";
|
|
8
|
+
import { i as Xe, n as Ze, t as Qe } from "./platform-Bw1btWCT.js";
|
|
9
|
+
import { r as $e, t as et } from "./batch-BUJh-1jZ.js";
|
|
10
|
+
import { n as tt, t as nt } from "./journey-BUJ4WJxP.js";
|
|
11
11
|
//#region src/utils/timer.ts
|
|
12
|
-
function
|
|
13
|
-
return Math.round((performance.now() - e) *
|
|
12
|
+
function M(e) {
|
|
13
|
+
return Math.round((performance.now() - e) * v) / v;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function N(e, t, n, r, i) {
|
|
16
16
|
e.logMetric(`${t}.duration`, n, "ms", "histogram", {
|
|
17
17
|
status: r,
|
|
18
18
|
...i
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
let a =
|
|
21
|
+
function rt(e, t, n, r, i) {
|
|
22
|
+
let a = M(n);
|
|
23
23
|
e.error(`${t} failed`, r, {
|
|
24
24
|
"action.duration_ms": a,
|
|
25
25
|
status: "FAILURE",
|
|
26
26
|
...i
|
|
27
|
-
}),
|
|
27
|
+
}), N(e, t, a, "FAILURE", i);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function it(e, t, n, r) {
|
|
30
30
|
let i = performance.now();
|
|
31
31
|
try {
|
|
32
32
|
let a = n();
|
|
33
|
-
return
|
|
33
|
+
return N(e, t, M(i), "SUCCESS", r), a;
|
|
34
34
|
} catch (n) {
|
|
35
|
-
throw
|
|
35
|
+
throw rt(e, t, i, n, r), n;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function
|
|
38
|
+
async function at(e, t, n, r) {
|
|
39
39
|
let i = performance.now();
|
|
40
40
|
try {
|
|
41
41
|
let a = await n();
|
|
42
|
-
return
|
|
42
|
+
return N(e, t, M(i), "SUCCESS", r), a;
|
|
43
43
|
} catch (n) {
|
|
44
|
-
throw
|
|
44
|
+
throw rt(e, t, i, n, r), n;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/core/logger.ts
|
|
49
|
-
var
|
|
50
|
-
function
|
|
49
|
+
var ot = [me, ge];
|
|
50
|
+
function st(e, t) {
|
|
51
51
|
let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
|
|
52
|
-
if (!(e instanceof Error) && !
|
|
52
|
+
if (!(e instanceof Error) && !Ae(e)) return;
|
|
53
53
|
let t = Error(e.message);
|
|
54
54
|
return t.name = e.name, t.stack = e.stack, t;
|
|
55
55
|
});
|
|
@@ -57,38 +57,38 @@ function at(e, t) {
|
|
|
57
57
|
let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
|
|
58
58
|
return Error(r ?? typeof e);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ct(e, t, n) {
|
|
61
61
|
return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function lt(e, t) {
|
|
64
64
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
|
|
65
65
|
if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
|
|
66
|
-
let t = e, n =
|
|
66
|
+
let t = e, n = Ae(e), r = {}, i = 0;
|
|
67
67
|
for (let e of Object.keys(t)) {
|
|
68
68
|
let a = t[e];
|
|
69
|
-
(!n || !
|
|
69
|
+
(!n || !je.has(e)) && ke(a) && (r[e] = a, i++);
|
|
70
70
|
}
|
|
71
71
|
return i === 0 ? void 0 : r;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
if (!
|
|
74
|
+
function ut(e) {
|
|
75
|
+
if (!O(e) || e instanceof Error) return !1;
|
|
76
76
|
let t = Object.getPrototypeOf(e);
|
|
77
77
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return
|
|
79
|
+
function dt(e) {
|
|
80
|
+
return ot.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function P(e, t) {
|
|
83
83
|
return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
|
|
84
84
|
}
|
|
85
|
-
var
|
|
85
|
+
var F = class e {
|
|
86
86
|
bind;
|
|
87
87
|
namespace;
|
|
88
88
|
options;
|
|
89
89
|
levelType;
|
|
90
90
|
constructor(e, t, n = {}) {
|
|
91
|
-
this.bind = e, this.namespace = t, this.options = n, this.levelType =
|
|
91
|
+
this.bind = e, this.namespace = t, this.options = n, this.levelType = dt(t);
|
|
92
92
|
}
|
|
93
93
|
child(t, n = {}) {
|
|
94
94
|
return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
|
|
@@ -120,124 +120,156 @@ var L = class e {
|
|
|
120
120
|
logEvent = (e, t) => {
|
|
121
121
|
this.write("INFO", "event", e, t);
|
|
122
122
|
};
|
|
123
|
-
logMetric = (e, t, n =
|
|
123
|
+
logMetric = (e, t, n = m, i = "gauge", a) => {
|
|
124
124
|
if (!Number.isFinite(t)) {
|
|
125
125
|
this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
let
|
|
129
|
-
...
|
|
128
|
+
let o = P(a, this.bind().diagnostics), s = {
|
|
129
|
+
...o,
|
|
130
130
|
"metric.name": e,
|
|
131
131
|
"metric.value": t,
|
|
132
132
|
"metric.unit": n,
|
|
133
|
-
"metric.type":
|
|
134
|
-
[
|
|
133
|
+
"metric.type": i,
|
|
134
|
+
[r.attributeKeys]: Object.keys(o)
|
|
135
135
|
};
|
|
136
|
-
this.write("INFO", "metric", e,
|
|
136
|
+
this.write("INFO", "metric", e, s, !0);
|
|
137
137
|
};
|
|
138
|
-
timeSync = (e, t, n) =>
|
|
139
|
-
timeAsync = (e, t, n) =>
|
|
138
|
+
timeSync = (e, t, n) => it(this, e, t, n);
|
|
139
|
+
timeAsync = (e, t, n) => at(this, e, t, n);
|
|
140
140
|
write(e, t, n, r, i = !1) {
|
|
141
141
|
let a = this.bind();
|
|
142
142
|
if (a.isDestroyed()) return;
|
|
143
|
+
if (a.isRotating()) {
|
|
144
|
+
a.diagnostics.count("record.dropped_during_rotation");
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
143
147
|
if (!a.builder.isEnabled(e, this.namespace, t)) {
|
|
144
148
|
this.mirrors(a, e) && this.print(a, e, n, r, void 0, null);
|
|
145
149
|
return;
|
|
146
150
|
}
|
|
147
|
-
let
|
|
151
|
+
let o = {
|
|
148
152
|
level: e,
|
|
149
153
|
type: t,
|
|
150
154
|
body: n,
|
|
151
155
|
namespace: this.namespace,
|
|
152
156
|
scoped: this.options.scopedContext,
|
|
153
|
-
payload: i ? r :
|
|
154
|
-
}
|
|
155
|
-
|
|
157
|
+
payload: i ? r : P(r, a.diagnostics)
|
|
158
|
+
}, { record: s, dropped: c } = a.builder.build(o), l = !!a.config.redact || a.config.processors.length > 0, u = t !== "metric" && a.config.capturePolicy.breadcrumbs > 0, d = c === "sampling" && l && u ? a.builder.build(o, !0) : void 0, f = s ?? d?.record ?? null, p = f ? f.body : c === "sampling" && !l ? n : void 0;
|
|
159
|
+
u && p !== void 0 && a.breadcrumbs.push({
|
|
156
160
|
t: Date.now(),
|
|
157
161
|
category: t === "action" ? "action" : t === "event" ? "event" : "log",
|
|
158
|
-
message:
|
|
159
|
-
}), this.print(a, e, n, r, void 0,
|
|
162
|
+
message: p
|
|
163
|
+
}), this.print(a, e, n, r, void 0, f, d?.dropped ?? c), a.emit(s);
|
|
160
164
|
}
|
|
161
165
|
writeError(e, t, n, r) {
|
|
162
166
|
let i = this.bind();
|
|
163
167
|
if (i.isDestroyed()) return;
|
|
168
|
+
if (i.isRotating()) {
|
|
169
|
+
i.diagnostics.count("record.dropped_during_rotation");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
164
172
|
let a = i.builder.isEnabled(e, this.namespace);
|
|
165
173
|
if (!a && !this.mirrors(i, e)) return;
|
|
166
|
-
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () =>
|
|
174
|
+
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => ut(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : st(c, i.diagnostics), u = l === void 0 ? void 0 : ct(c, l, i.diagnostics);
|
|
167
175
|
if (!a) {
|
|
168
176
|
this.print(i, e, t, s, u, null);
|
|
169
177
|
return;
|
|
170
178
|
}
|
|
171
|
-
let d = l ?
|
|
179
|
+
let d = l ? lt(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
|
|
172
180
|
level: e,
|
|
173
181
|
type: this.levelType,
|
|
174
182
|
body: t,
|
|
175
183
|
namespace: this.namespace,
|
|
176
184
|
scoped: this.options.scopedContext,
|
|
177
185
|
payload: {
|
|
178
|
-
...
|
|
186
|
+
...P(s, i.diagnostics),
|
|
179
187
|
...l ? {
|
|
180
188
|
"error.type": l.name,
|
|
181
189
|
"error.message": l.message,
|
|
182
190
|
"error.stack_trace": l.stack
|
|
183
191
|
} : {},
|
|
184
|
-
...d === void 0 ? {} : { [
|
|
185
|
-
[
|
|
192
|
+
...d === void 0 ? {} : { [xe]: d },
|
|
193
|
+
[C]: i.breadcrumbs.snapshot()
|
|
186
194
|
}
|
|
187
195
|
});
|
|
188
196
|
this.print(i, e, t, s, u, f, p), i.emit(f);
|
|
189
197
|
}
|
|
190
198
|
print(e, t, n, r, i, a, o) {
|
|
191
|
-
e.config.redact
|
|
199
|
+
if (!e.config.redact && e.config.processors.length === 0) {
|
|
200
|
+
e.console.write(this.namespace, t, n, r, i);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (a) {
|
|
204
|
+
e.console.write(this.namespace, t, a.body, a.attributes);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (o === "processor" || o === "redact" || o === "malformed" || !e.config.enabled || !e.console.accepts(t)) return;
|
|
208
|
+
let s = e.builder.build({
|
|
209
|
+
level: t,
|
|
210
|
+
type: this.levelType,
|
|
211
|
+
body: n,
|
|
212
|
+
namespace: this.namespace,
|
|
213
|
+
scoped: this.options.scopedContext,
|
|
214
|
+
payload: {
|
|
215
|
+
...P(r, e.diagnostics),
|
|
216
|
+
...i ? {
|
|
217
|
+
"error.type": i.name,
|
|
218
|
+
"error.message": i.message,
|
|
219
|
+
"error.stack_trace": i.stack
|
|
220
|
+
} : {}
|
|
221
|
+
}
|
|
222
|
+
}, !0).record;
|
|
223
|
+
s && e.console.write(this.namespace, t, s.body, s.attributes);
|
|
192
224
|
}
|
|
193
225
|
mirrors(e, t) {
|
|
194
226
|
return e.config.enabled && e.console.accepts(t);
|
|
195
227
|
}
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
w,
|
|
228
|
+
}, ft = "overflow", pt = /* @__PURE__ */ new Set([
|
|
229
|
+
ce,
|
|
230
|
+
x,
|
|
200
231
|
T,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
he
|
|
232
|
+
_e,
|
|
233
|
+
b,
|
|
234
|
+
he,
|
|
235
|
+
Se
|
|
204
236
|
]);
|
|
205
|
-
function
|
|
237
|
+
function mt(e = {}) {
|
|
206
238
|
let t = {};
|
|
207
239
|
for (let n of Object.keys(e).sort()) {
|
|
208
|
-
if (n.startsWith("metric.") ||
|
|
240
|
+
if (n.startsWith("metric.") || pt.has(n)) continue;
|
|
209
241
|
let r = e[n];
|
|
210
242
|
(typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
|
|
211
243
|
}
|
|
212
244
|
return t;
|
|
213
245
|
}
|
|
214
|
-
function
|
|
246
|
+
function ht(e, t) {
|
|
215
247
|
if (!Array.isArray(e)) return null;
|
|
216
|
-
let
|
|
217
|
-
return Array.from({ length:
|
|
248
|
+
let n = t === 0 ? e.length : Math.min(e.length, t + 1);
|
|
249
|
+
return Array.from({ length: n }, (t, n) => e[n]);
|
|
218
250
|
}
|
|
219
|
-
function
|
|
220
|
-
return Array.isArray(e) && e.length <=
|
|
251
|
+
function gt(e, t) {
|
|
252
|
+
return Array.isArray(e) && (t === 0 || e.length <= t) && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
|
|
221
253
|
}
|
|
222
|
-
function
|
|
223
|
-
let
|
|
254
|
+
function _t(e, t, n) {
|
|
255
|
+
let i = {
|
|
224
256
|
"metric.name": e.name,
|
|
225
257
|
"metric.unit": e.unit,
|
|
226
258
|
"metric.type": e.kind,
|
|
227
|
-
[
|
|
228
|
-
[
|
|
259
|
+
[r.start]: n,
|
|
260
|
+
[r.attributeKeys]: Object.keys(t.attributes)
|
|
229
261
|
};
|
|
230
|
-
return e.kind === "counter" ? (
|
|
231
|
-
...
|
|
232
|
-
[
|
|
233
|
-
[
|
|
234
|
-
[
|
|
235
|
-
[
|
|
236
|
-
[
|
|
237
|
-
[
|
|
262
|
+
return e.kind === "counter" ? (i["metric.value"] = t.sum, i) : {
|
|
263
|
+
...i,
|
|
264
|
+
[r.count]: t.count,
|
|
265
|
+
[r.sum]: t.sum,
|
|
266
|
+
[r.min]: t.min,
|
|
267
|
+
[r.max]: t.max,
|
|
268
|
+
[r.bounds]: e.boundaries,
|
|
269
|
+
[r.buckets]: t.buckets
|
|
238
270
|
};
|
|
239
271
|
}
|
|
240
|
-
function
|
|
272
|
+
function vt(e, t, n) {
|
|
241
273
|
let r = {
|
|
242
274
|
name: e,
|
|
243
275
|
kind: "counter",
|
|
@@ -248,48 +280,54 @@ function gt(e, t, n) {
|
|
|
248
280
|
n(r, e, t);
|
|
249
281
|
} };
|
|
250
282
|
}
|
|
251
|
-
function
|
|
283
|
+
function yt(e, t, n) {
|
|
252
284
|
let r = {
|
|
253
285
|
name: e,
|
|
254
286
|
kind: "histogram",
|
|
255
287
|
unit: t.unit ?? "count",
|
|
256
|
-
boundaries: t.boundaries ??
|
|
288
|
+
boundaries: t.boundaries ?? h
|
|
257
289
|
};
|
|
258
290
|
return { record: (e, t) => {
|
|
259
291
|
n(r, e, t);
|
|
260
292
|
} };
|
|
261
293
|
}
|
|
262
|
-
var
|
|
294
|
+
var bt = class {
|
|
263
295
|
intervalMs;
|
|
264
296
|
emit;
|
|
265
297
|
diagnostics;
|
|
298
|
+
policy;
|
|
266
299
|
instruments = /* @__PURE__ */ new Map();
|
|
267
300
|
timer = null;
|
|
268
301
|
startedAt = 0;
|
|
269
|
-
constructor(e, t, n
|
|
270
|
-
|
|
302
|
+
constructor(e, t, n, r = {
|
|
303
|
+
maxSeries: 100,
|
|
304
|
+
maxInstruments: 1e3,
|
|
305
|
+
maxHistogramBoundaries: 50
|
|
306
|
+
}) {
|
|
307
|
+
this.intervalMs = e, this.emit = t, this.diagnostics = n, this.policy = r;
|
|
271
308
|
}
|
|
272
309
|
record(e, t, n) {
|
|
273
310
|
!Number.isFinite(t) || e.kind === "counter" && t < 0 ? this.diagnostics.report("record.dropped_malformed", `The value of the metric ${e.name} is not valid. The library dropped it.`, { "metric.name": e.name }) : this.diagnostics.guard("record.sanitize_failed", `The library could not read the attributes of the metric ${e.name}.`, () => {
|
|
274
311
|
let r = this.instrumentOf(e);
|
|
275
|
-
r && (this.add(r, t,
|
|
312
|
+
r && (this.add(r, t, mt(n)), this.arm());
|
|
276
313
|
});
|
|
277
314
|
}
|
|
278
315
|
collect() {
|
|
279
316
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
280
317
|
let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
|
|
281
318
|
this.instruments.clear();
|
|
282
|
-
for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes,
|
|
319
|
+
for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, _t(n, t, e));
|
|
283
320
|
}
|
|
284
321
|
instrumentOf(e) {
|
|
285
322
|
let t = this.instruments.get(e.name);
|
|
286
323
|
if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a counter and a histogram. The library dropped the value.`, { "metric.name": e.name }), null);
|
|
287
|
-
|
|
288
|
-
|
|
324
|
+
if (this.policy.maxInstruments && this.instruments.size >= this.policy.maxInstruments) return this.diagnostics.count("record.dropped_by_ceiling"), null;
|
|
325
|
+
let n = ht(e.boundaries, this.policy.maxHistogramBoundaries), r = gt(n, this.policy.maxHistogramBoundaries);
|
|
326
|
+
e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);
|
|
289
327
|
let i = {
|
|
290
328
|
def: {
|
|
291
329
|
...e,
|
|
292
|
-
boundaries: r ? n : [...
|
|
330
|
+
boundaries: r ? n : [...h]
|
|
293
331
|
},
|
|
294
332
|
series: /* @__PURE__ */ new Map()
|
|
295
333
|
};
|
|
@@ -297,7 +335,7 @@ var vt = class {
|
|
|
297
335
|
}
|
|
298
336
|
add(e, t, n) {
|
|
299
337
|
let r = JSON.stringify(n), i = e.series.get(r), a = n;
|
|
300
|
-
if (!i && e.series.size >=
|
|
338
|
+
if (!i && this.policy.maxSeries > 0 && e.series.size >= this.policy.maxSeries && (r = ft, i = e.series.get(r), a = { [ve]: !0 }), !i) {
|
|
301
339
|
let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
|
|
302
340
|
i = {
|
|
303
341
|
attributes: a,
|
|
@@ -316,82 +354,82 @@ var vt = class {
|
|
|
316
354
|
arm() {
|
|
317
355
|
this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
|
|
318
356
|
this.collect();
|
|
319
|
-
}, this.intervalMs()),
|
|
357
|
+
}, this.intervalMs()), ze(this.timer));
|
|
320
358
|
}
|
|
321
|
-
},
|
|
359
|
+
}, xt = {
|
|
322
360
|
TRACE: "debug",
|
|
323
361
|
DEBUG: "debug",
|
|
324
362
|
INFO: "info",
|
|
325
363
|
WARN: "warn",
|
|
326
364
|
ERROR: "error",
|
|
327
365
|
FATAL: "error"
|
|
328
|
-
},
|
|
366
|
+
}, St = class {
|
|
329
367
|
settings;
|
|
330
368
|
diagnostics;
|
|
331
369
|
limits;
|
|
332
|
-
constructor(e, t, n =
|
|
370
|
+
constructor(e, t, n = a) {
|
|
333
371
|
this.settings = e, this.diagnostics = t, this.limits = n;
|
|
334
372
|
}
|
|
335
373
|
update(e) {
|
|
336
374
|
this.settings = e;
|
|
337
375
|
}
|
|
338
376
|
accepts(e) {
|
|
339
|
-
return this.settings.level === null || !Object.hasOwn(
|
|
377
|
+
return this.settings.level === null || !Object.hasOwn(S, this.settings.level) ? !1 : S[e] >= S[this.settings.level];
|
|
340
378
|
}
|
|
341
379
|
write(e, t, n, r, i) {
|
|
342
|
-
if (!this.accepts(t) || typeof console > "u" ||
|
|
343
|
-
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s =
|
|
380
|
+
if (!this.accepts(t) || typeof console > "u" || Be()) return;
|
|
381
|
+
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = xt[t];
|
|
344
382
|
this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
|
|
345
383
|
let c = [];
|
|
346
|
-
i !== void 0 && c.push(i), r !== void 0 && c.push(
|
|
384
|
+
i !== void 0 && c.push(i), r !== void 0 && c.push(He(r, this.limits, this.diagnostics)), k(() => {
|
|
347
385
|
console[s](a, o.namespace, e, o[t], "", n, ...c);
|
|
348
386
|
});
|
|
349
387
|
});
|
|
350
388
|
}
|
|
351
|
-
},
|
|
389
|
+
}, Ct = class {
|
|
352
390
|
value = 0;
|
|
353
391
|
next() {
|
|
354
392
|
return ++this.value;
|
|
355
393
|
}
|
|
356
|
-
},
|
|
357
|
-
function
|
|
358
|
-
return
|
|
394
|
+
}, wt = /^[0-9a-f]{32}$/, Tt = /^[0-9a-f]{16}$/, Et = /[1-9a-f]/;
|
|
395
|
+
function Dt(e) {
|
|
396
|
+
return wt.test(e.traceId) && Et.test(e.traceId) && Tt.test(e.spanId) && Et.test(e.spanId);
|
|
359
397
|
}
|
|
360
|
-
function
|
|
361
|
-
return
|
|
398
|
+
function Ot() {
|
|
399
|
+
return Ge(16);
|
|
362
400
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
401
|
+
function kt() {
|
|
402
|
+
return Ge(8);
|
|
365
403
|
}
|
|
366
|
-
function
|
|
404
|
+
function At(e) {
|
|
367
405
|
return {
|
|
368
|
-
traceId:
|
|
369
|
-
spanId:
|
|
406
|
+
traceId: Ot(),
|
|
407
|
+
spanId: kt(),
|
|
370
408
|
traceFlags: 1,
|
|
371
409
|
startedAt: Date.now(),
|
|
372
410
|
reason: e,
|
|
373
411
|
ended: !1
|
|
374
412
|
};
|
|
375
413
|
}
|
|
376
|
-
function
|
|
414
|
+
function jt(e, t, n) {
|
|
377
415
|
return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
|
|
378
416
|
}
|
|
379
|
-
function
|
|
417
|
+
function Mt(e) {
|
|
380
418
|
return {
|
|
381
419
|
traceId: e.traceId,
|
|
382
420
|
spanId: e.spanId,
|
|
383
421
|
traceFlags: e.traceFlags
|
|
384
422
|
};
|
|
385
423
|
}
|
|
386
|
-
var
|
|
424
|
+
var Nt = class {
|
|
387
425
|
diagnostics;
|
|
388
426
|
maxAgeMs;
|
|
389
427
|
load;
|
|
390
428
|
spans;
|
|
391
|
-
ambient =
|
|
429
|
+
ambient = At("start");
|
|
392
430
|
otel;
|
|
393
|
-
constructor(e, t = n, r
|
|
394
|
-
this.diagnostics = e, this.maxAgeMs = t, this.load =
|
|
431
|
+
constructor(e, t = se, n, r) {
|
|
432
|
+
this.diagnostics = e, this.maxAgeMs = t, this.load = n, this.spans = r;
|
|
395
433
|
}
|
|
396
434
|
async loadOtel() {
|
|
397
435
|
if (this.load) try {
|
|
@@ -404,7 +442,7 @@ var jt = class {
|
|
|
404
442
|
return this.activeSpanContext() ?? this.ambientContext();
|
|
405
443
|
}
|
|
406
444
|
ambientContext() {
|
|
407
|
-
return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"),
|
|
445
|
+
return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Mt(this.ambient);
|
|
408
446
|
}
|
|
409
447
|
activeSpanContext() {
|
|
410
448
|
let e = this.otel;
|
|
@@ -412,7 +450,7 @@ var jt = class {
|
|
|
412
450
|
let t = e.trace.getActiveSpan();
|
|
413
451
|
if (t === void 0) return;
|
|
414
452
|
let n = t.spanContext();
|
|
415
|
-
if (
|
|
453
|
+
if (Dt(n)) return {
|
|
416
454
|
traceId: n.traceId,
|
|
417
455
|
spanId: n.spanId,
|
|
418
456
|
traceFlags: n.traceFlags
|
|
@@ -421,8 +459,8 @@ var jt = class {
|
|
|
421
459
|
}
|
|
422
460
|
rotate(e) {
|
|
423
461
|
let t = this.ambient;
|
|
424
|
-
this.ambient =
|
|
425
|
-
let n =
|
|
462
|
+
this.ambient = At(e);
|
|
463
|
+
let n = Mt(this.ambient);
|
|
426
464
|
return this.finish(t), n;
|
|
427
465
|
}
|
|
428
466
|
end() {
|
|
@@ -449,9 +487,9 @@ var jt = class {
|
|
|
449
487
|
n.propagation.inject(n.context.active(), t);
|
|
450
488
|
}), t.traceparent) return { headers: t };
|
|
451
489
|
let r = this.activeSpanContext(), i = r ?? this.ambientContext(), a = r ? void 0 : this.spans;
|
|
452
|
-
if (!a?.enabled()) return t[
|
|
453
|
-
let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ?
|
|
454
|
-
return t[
|
|
490
|
+
if (!a?.enabled()) return t[Ee] = jt(i.traceId, i.spanId, i.traceFlags), { headers: t };
|
|
491
|
+
let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? kt() : i.spanId;
|
|
492
|
+
return t[Ee] = jt(i.traceId, c, s), !e || !o ? { headers: t } : {
|
|
455
493
|
headers: t,
|
|
456
494
|
span: {
|
|
457
495
|
traceId: i.traceId,
|
|
@@ -460,16 +498,20 @@ var jt = class {
|
|
|
460
498
|
}
|
|
461
499
|
};
|
|
462
500
|
}
|
|
463
|
-
},
|
|
501
|
+
}, Pt = class {
|
|
464
502
|
buffer;
|
|
465
503
|
pointer = 0;
|
|
466
504
|
filled = !1;
|
|
467
505
|
capacity;
|
|
468
506
|
constructor(e) {
|
|
469
|
-
this.capacity = Math.max(e, 1), this.buffer = Array(this.capacity);
|
|
507
|
+
this.capacity = e === 0 ? 0 : Math.max(e, 1), this.buffer = Array(this.capacity);
|
|
508
|
+
}
|
|
509
|
+
resize(e) {
|
|
510
|
+
let t = this.snapshot().slice(-e);
|
|
511
|
+
if (this.capacity = e, this.buffer = Array(e), this.pointer = 0, this.filled = !1, e) for (let e of t) this.push(e);
|
|
470
512
|
}
|
|
471
513
|
push(e) {
|
|
472
|
-
this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0);
|
|
514
|
+
this.capacity !== 0 && (this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0));
|
|
473
515
|
}
|
|
474
516
|
clear() {
|
|
475
517
|
this.buffer.fill(void 0), this.pointer = 0, this.filled = !1;
|
|
@@ -477,45 +519,45 @@ var jt = class {
|
|
|
477
519
|
snapshot() {
|
|
478
520
|
return (this.filled ? [...this.buffer.slice(this.pointer), ...this.buffer.slice(0, this.pointer)] : this.buffer.slice(0, this.pointer)).filter((e) => e !== void 0);
|
|
479
521
|
}
|
|
480
|
-
},
|
|
522
|
+
}, Ft = Object.keys(S), It = ["gzip", "none"], Lt = [
|
|
481
523
|
"omit",
|
|
482
524
|
"same-origin",
|
|
483
525
|
"include"
|
|
484
|
-
],
|
|
526
|
+
], Rt = [
|
|
485
527
|
"auto",
|
|
486
528
|
"indexeddb",
|
|
487
529
|
"localstorage",
|
|
488
530
|
"memory",
|
|
489
531
|
"none"
|
|
490
|
-
],
|
|
532
|
+
], zt = ["storage", "memory"], Bt = [
|
|
491
533
|
"auto",
|
|
492
534
|
"sender",
|
|
493
535
|
"forwarder",
|
|
494
536
|
"off"
|
|
495
|
-
],
|
|
537
|
+
], Vt = [
|
|
496
538
|
"auto",
|
|
497
539
|
"provider",
|
|
498
540
|
"client"
|
|
499
|
-
],
|
|
541
|
+
], Ht = [
|
|
500
542
|
"auto",
|
|
501
543
|
"context",
|
|
502
544
|
"tab",
|
|
503
545
|
"origin"
|
|
504
|
-
],
|
|
546
|
+
], Ut = [
|
|
505
547
|
"error",
|
|
506
548
|
"warn",
|
|
507
549
|
"info",
|
|
508
550
|
"log"
|
|
509
|
-
],
|
|
551
|
+
], Wt = ["limited", "until-delivered"], Gt = {
|
|
510
552
|
logFlushIntervalMs: [100, 6e4],
|
|
511
553
|
logBatchSize: [1, 1e3],
|
|
512
554
|
metricFlushIntervalMs: [100, 6e4],
|
|
513
555
|
metricBatchSize: [1, 1e3]
|
|
514
|
-
},
|
|
556
|
+
}, Kt = {
|
|
515
557
|
maxBatches: [1, 5e3],
|
|
516
558
|
maxAgeMs: [6e4, 6048e5],
|
|
517
559
|
maxAttempts: [1, 20]
|
|
518
|
-
},
|
|
560
|
+
}, qt = {
|
|
519
561
|
maxBodyChars: [256, 65536],
|
|
520
562
|
maxAttributeChars: [256, 65536],
|
|
521
563
|
maxAttributeCount: [1, 1024],
|
|
@@ -523,30 +565,73 @@ var jt = class {
|
|
|
523
565
|
maxDepth: [1, 16],
|
|
524
566
|
maxArrayLength: [1, 1e4],
|
|
525
567
|
maxNodes: [100, 1e5],
|
|
526
|
-
maxRecordBytes: [1024,
|
|
527
|
-
},
|
|
568
|
+
maxRecordBytes: [1024, n]
|
|
569
|
+
}, Jt = [6e4, 864e5], I = [0, 2147483647], L = [0, 2 ** 53 - 1], Yt = [1, 2 ** 53 - 1], Xt = {
|
|
570
|
+
capturePolicy: { ranges: {
|
|
571
|
+
breadcrumbs: [0, 1e6],
|
|
572
|
+
errorDedupeMs: I,
|
|
573
|
+
maxErrorSignatures: L,
|
|
574
|
+
errorsPerWindow: L,
|
|
575
|
+
consolePerWindow: L,
|
|
576
|
+
longFramesPerWindow: L,
|
|
577
|
+
webSocketPerWindow: L,
|
|
578
|
+
windowMs: I,
|
|
579
|
+
errorCeiling: L
|
|
580
|
+
} },
|
|
581
|
+
metadata: { ranges: {} },
|
|
582
|
+
persistence: { ranges: {} },
|
|
583
|
+
diagnostics: { ranges: { throttleMs: I } },
|
|
584
|
+
correlation: { ranges: {
|
|
585
|
+
sessionIdleMs: I,
|
|
586
|
+
sessionTouchMs: I,
|
|
587
|
+
traceMaxAgeMs: I
|
|
588
|
+
} },
|
|
589
|
+
metrics: { ranges: {
|
|
590
|
+
maxSeries: L,
|
|
591
|
+
maxInstruments: L,
|
|
592
|
+
maxHistogramBoundaries: L
|
|
593
|
+
} },
|
|
594
|
+
buffering: {
|
|
595
|
+
ranges: {
|
|
596
|
+
maxPendingRecords: L,
|
|
597
|
+
maxPendingBytes: L
|
|
598
|
+
},
|
|
599
|
+
choices: { overflow: [
|
|
600
|
+
"drop-oldest",
|
|
601
|
+
"drop-newest",
|
|
602
|
+
"persist"
|
|
603
|
+
] }
|
|
604
|
+
},
|
|
605
|
+
delivery: { ranges: {
|
|
606
|
+
requestTimeoutMs: [1, I[1]],
|
|
607
|
+
maxConcurrentRequests: Yt,
|
|
608
|
+
retryBaseDelayMs: I,
|
|
609
|
+
retryMaxDelayMs: I,
|
|
610
|
+
retryIdleDelayMs: I,
|
|
611
|
+
batchesPerDrain: Yt
|
|
612
|
+
} }
|
|
613
|
+
}, Zt = [
|
|
528
614
|
"errors",
|
|
529
615
|
"rejections",
|
|
530
616
|
"resourceErrors",
|
|
531
617
|
"fetch",
|
|
532
618
|
"xhr",
|
|
533
619
|
"httpMetrics",
|
|
534
|
-
"interactions",
|
|
535
620
|
"navigation",
|
|
536
621
|
"webVitals",
|
|
537
622
|
"longFrames",
|
|
538
623
|
"fullUrls",
|
|
539
624
|
"webSocket"
|
|
540
|
-
],
|
|
625
|
+
], Qt = "null", R = `a level name: ${z(Ft)}`, $t = `true, false or a list of ${z(Ut)}`, en = "a list of strings and RegExp patterns", tn = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", nn = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", rn = "a list of strings";
|
|
541
626
|
function z(e) {
|
|
542
627
|
let t = e.map((e) => `"${e}"`);
|
|
543
628
|
return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
544
629
|
}
|
|
545
|
-
function
|
|
630
|
+
function an(e) {
|
|
546
631
|
return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
|
|
547
632
|
}
|
|
548
633
|
function B(e, t, n, r, i) {
|
|
549
|
-
e.report("config.invalid", `${t} must be ${n}. The value is ${
|
|
634
|
+
e.report("config.invalid", `${t} must be ${n}. The value is ${an(r)}. The library keeps ${i}.`);
|
|
550
635
|
}
|
|
551
636
|
function V(e, t, n, r, i) {
|
|
552
637
|
if (t === void 0) return r;
|
|
@@ -556,31 +641,34 @@ function V(e, t, n, r, i) {
|
|
|
556
641
|
function H(e, t, n, r) {
|
|
557
642
|
return t === void 0 ? n : typeof t == "boolean" ? t : (B(r, e, "true or false", t, String(n)), n);
|
|
558
643
|
}
|
|
559
|
-
function
|
|
644
|
+
function on(e, t, n, r) {
|
|
560
645
|
return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (B(r, e, "a finite number of 0 or more", t, String(n)), n);
|
|
561
646
|
}
|
|
562
|
-
function
|
|
647
|
+
function U(e, t, n, r, i) {
|
|
563
648
|
if (t === void 0) return r;
|
|
564
649
|
let [a, o] = n;
|
|
565
650
|
return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (B(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
|
|
566
651
|
}
|
|
567
|
-
function
|
|
652
|
+
function sn(e, t, n) {
|
|
653
|
+
return e === void 0 ? t : e === null ? null : typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : (B(n, "loggerCache.maxEntries", "a nonnegative safe integer or null", e, String(t)), t);
|
|
654
|
+
}
|
|
655
|
+
function cn(e, t, n, r, i) {
|
|
568
656
|
let a = t ?? {}, o = Object.keys(r);
|
|
569
|
-
return Object.fromEntries(o.map((t) => [t,
|
|
657
|
+
return Object.fromEntries(o.map((t) => [t, U(`${e}.${t}`, a[t], r[t], n[t], i)]));
|
|
570
658
|
}
|
|
571
659
|
function W(e) {
|
|
572
660
|
if (typeof e != "string") return;
|
|
573
661
|
let t = e.toUpperCase();
|
|
574
|
-
return
|
|
662
|
+
return Ft.find((e) => e === t);
|
|
575
663
|
}
|
|
576
|
-
function
|
|
664
|
+
function ln(e, t, n, r) {
|
|
577
665
|
if (t === void 0) return n;
|
|
578
666
|
let i = W(t);
|
|
579
667
|
return i === void 0 ? (B(r, e, R, t, `"${n}"`), n) : i;
|
|
580
668
|
}
|
|
581
|
-
function
|
|
669
|
+
function un(e, t, n) {
|
|
582
670
|
if (e === void 0) return t;
|
|
583
|
-
if (!
|
|
671
|
+
if (!O(e)) return B(n, "minLevels", "an object of level names", e, "the value in force"), t;
|
|
584
672
|
let r = [];
|
|
585
673
|
for (let [t, i] of Object.entries(e)) {
|
|
586
674
|
let e = W(i);
|
|
@@ -594,85 +682,85 @@ function G(e, t, n, r, i, a) {
|
|
|
594
682
|
let o = [], s = t;
|
|
595
683
|
for (let t of s) {
|
|
596
684
|
let n = i(t);
|
|
597
|
-
n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${
|
|
685
|
+
n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${an(t)}. ${e} must be ${r}.`) : o.push(n);
|
|
598
686
|
}
|
|
599
687
|
return o;
|
|
600
688
|
}
|
|
601
|
-
function
|
|
689
|
+
function dn(e) {
|
|
602
690
|
return typeof e == "function" ? e : void 0;
|
|
603
691
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
692
|
+
function fn(e) {
|
|
693
|
+
return O(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
|
|
606
694
|
}
|
|
607
|
-
function
|
|
695
|
+
function pn(e) {
|
|
608
696
|
return typeof e == "string" ? e : void 0;
|
|
609
697
|
}
|
|
610
|
-
function
|
|
698
|
+
function mn(e) {
|
|
611
699
|
return typeof e == "string" || e instanceof RegExp ? e : void 0;
|
|
612
700
|
}
|
|
613
|
-
function
|
|
614
|
-
return
|
|
701
|
+
function hn(e) {
|
|
702
|
+
return Ut.find((t) => t === e);
|
|
615
703
|
}
|
|
616
|
-
function
|
|
704
|
+
function gn(e) {
|
|
617
705
|
if (typeof e == "string") try {
|
|
618
706
|
let { origin: t } = new URL(e);
|
|
619
|
-
return t ===
|
|
707
|
+
return t === Qt ? void 0 : t;
|
|
620
708
|
} catch {
|
|
621
709
|
return;
|
|
622
710
|
}
|
|
623
711
|
}
|
|
624
|
-
function
|
|
625
|
-
return e instanceof RegExp ? e :
|
|
712
|
+
function _n(e) {
|
|
713
|
+
return e instanceof RegExp ? e : gn(e);
|
|
626
714
|
}
|
|
627
|
-
function
|
|
628
|
-
return
|
|
715
|
+
function vn(e) {
|
|
716
|
+
return O(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
|
|
629
717
|
}
|
|
630
|
-
function
|
|
631
|
-
if (e !== void 0) return typeof e == "function" ||
|
|
718
|
+
function yn(e, t, n) {
|
|
719
|
+
if (e !== void 0) return typeof e == "function" || vn(e) ? e : (B(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
|
|
632
720
|
}
|
|
633
|
-
function
|
|
721
|
+
function bn(e) {
|
|
634
722
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
635
723
|
}
|
|
636
|
-
function
|
|
637
|
-
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" ||
|
|
724
|
+
function xn(e, t, n) {
|
|
725
|
+
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || bn(e) ? e : (n.report("config.invalid", `serializer must be "${E}", "ecs" or an implementation. The library uses "${E}".`), E);
|
|
638
726
|
}
|
|
639
|
-
var
|
|
640
|
-
function
|
|
727
|
+
var Sn = new Set(Object.keys(f));
|
|
728
|
+
function Cn(e, t) {
|
|
641
729
|
let n = {}, r = Object.entries(e ?? {});
|
|
642
|
-
for (let [e, i] of r)
|
|
730
|
+
for (let [e, i] of r) Sn.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
|
|
643
731
|
return n;
|
|
644
732
|
}
|
|
645
|
-
function
|
|
733
|
+
function wn(e, t, n) {
|
|
646
734
|
if (e === void 0) return t ?? "DEBUG";
|
|
647
735
|
let r = W(e);
|
|
648
736
|
return r === void 0 ? (B(n, "console.level", R, e, "the console level in force"), t) : r;
|
|
649
737
|
}
|
|
650
|
-
function
|
|
651
|
-
if (
|
|
652
|
-
if (
|
|
738
|
+
function Tn(e, t, n) {
|
|
739
|
+
if (e === void 0) return t;
|
|
740
|
+
if (e === !1) return {
|
|
653
741
|
level: null,
|
|
654
|
-
styles:
|
|
742
|
+
styles: t.styles
|
|
655
743
|
};
|
|
656
|
-
if (
|
|
657
|
-
level:
|
|
658
|
-
styles:
|
|
744
|
+
if (e === !0) return {
|
|
745
|
+
level: d,
|
|
746
|
+
styles: t.styles
|
|
659
747
|
};
|
|
660
|
-
if (typeof
|
|
661
|
-
let
|
|
662
|
-
return
|
|
663
|
-
level:
|
|
664
|
-
styles:
|
|
748
|
+
if (typeof e == "string") {
|
|
749
|
+
let r = W(e);
|
|
750
|
+
return r === void 0 ? (B(n, "console", R, e, "the console level in force"), t) : {
|
|
751
|
+
level: r,
|
|
752
|
+
styles: t.styles
|
|
665
753
|
};
|
|
666
754
|
}
|
|
667
|
-
return typeof
|
|
668
|
-
level:
|
|
755
|
+
return typeof e != "object" || !e ? (n.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), t) : {
|
|
756
|
+
level: wn(e.level, t.level, n),
|
|
669
757
|
styles: {
|
|
670
|
-
...
|
|
671
|
-
...
|
|
758
|
+
...t.styles,
|
|
759
|
+
...Cn(e.styles, n)
|
|
672
760
|
}
|
|
673
761
|
};
|
|
674
762
|
}
|
|
675
|
-
function
|
|
763
|
+
function En(e, t, n) {
|
|
676
764
|
let r = e ?? {};
|
|
677
765
|
return {
|
|
678
766
|
...t,
|
|
@@ -681,53 +769,80 @@ function xn(e, t, n) {
|
|
|
681
769
|
...t.rates,
|
|
682
770
|
...r.rates
|
|
683
771
|
},
|
|
684
|
-
alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes,
|
|
772
|
+
alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, rn, pn, n),
|
|
685
773
|
remote: H("sampling.remote", r.remote, t.remote, n)
|
|
686
774
|
};
|
|
687
775
|
}
|
|
688
|
-
function
|
|
776
|
+
function Dn(e, t, n) {
|
|
689
777
|
let r = e ?? {};
|
|
690
778
|
return {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
779
|
+
maxTrackedSources: U("bus.maxTrackedSources", r.maxTrackedSources, [0, 2 ** 53 - 1], t.maxTrackedSources, n),
|
|
780
|
+
sourcePolicy: V("bus.sourcePolicy", r.sourcePolicy, ["registered", "trusted-origin"], t.sourcePolicy, n),
|
|
781
|
+
validation: V("bus.validation", r.validation, ["strict", "envelope"], t.validation, n),
|
|
782
|
+
maxMessageBytes: U("bus.maxMessageBytes", r.maxMessageBytes, [0, 2 ** 53 - 1], t.maxMessageBytes, n),
|
|
783
|
+
maxRecordsPerMessage: U("bus.maxRecordsPerMessage", r.maxRecordsPerMessage, [0, 2 ** 53 - 1], t.maxRecordsPerMessage, n),
|
|
784
|
+
maxMessagesPerSecond: U("bus.maxMessagesPerSecond", r.maxMessagesPerSecond, [0, 2 ** 53 - 1], t.maxMessagesPerSecond, n),
|
|
785
|
+
mode: V("bus.mode", r.mode, Bt, t.mode, n),
|
|
786
|
+
trustedOrigins: G("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, nn, gn, n),
|
|
787
|
+
openFinRole: V("bus.openFinRole", r.openFinRole, Vt, t.openFinRole, n)
|
|
694
788
|
};
|
|
695
789
|
}
|
|
696
|
-
function
|
|
790
|
+
function On(e, t, n) {
|
|
697
791
|
let r = e ?? {};
|
|
698
792
|
return {
|
|
699
|
-
scope: V("journey.scope", r.scope,
|
|
700
|
-
maxAgeMs:
|
|
793
|
+
scope: V("journey.scope", r.scope, Ht, t.scope, n),
|
|
794
|
+
maxAgeMs: U("journey.maxAgeMs", r.maxAgeMs, Jt, t.maxAgeMs, n)
|
|
701
795
|
};
|
|
702
796
|
}
|
|
703
|
-
function
|
|
797
|
+
function kn(e, t, n) {
|
|
704
798
|
let r = e ?? {};
|
|
705
799
|
return {
|
|
706
|
-
mode: V("retention.mode", r.mode,
|
|
707
|
-
...
|
|
800
|
+
mode: V("retention.mode", r.mode, Wt, t.mode, n),
|
|
801
|
+
...cn("retention", r, t, Kt, n)
|
|
708
802
|
};
|
|
709
803
|
}
|
|
710
|
-
function
|
|
711
|
-
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [],
|
|
804
|
+
function An(e, t, n) {
|
|
805
|
+
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [], $t, hn, n) : (B(n, "capture.console", $t, e, "the value in force"), t);
|
|
712
806
|
}
|
|
713
|
-
function
|
|
807
|
+
function jn(e, t, n) {
|
|
714
808
|
let r = e ?? {}, i = {
|
|
715
809
|
...t,
|
|
716
810
|
...r,
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
811
|
+
interactions: Mn(r.interactions, t.interactions, n),
|
|
812
|
+
console: An(r.console, t.console, n),
|
|
813
|
+
longFrameThresholdMs: on("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
|
|
814
|
+
ignoreUrls: G("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, en, mn, n),
|
|
815
|
+
propagateTraceHeaderTo: G("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, tn, _n, n),
|
|
816
|
+
plugins: G("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", fn, n)
|
|
722
817
|
};
|
|
723
|
-
for (let e of
|
|
818
|
+
for (let e of Zt) i[e] = H(`capture.${e}`, r[e], t[e], n);
|
|
724
819
|
return i;
|
|
725
820
|
}
|
|
726
|
-
|
|
821
|
+
function Mn(e, t, n) {
|
|
822
|
+
if (e === void 0) return t;
|
|
823
|
+
if (typeof e == "boolean") return e;
|
|
824
|
+
if (!O(e)) return n.report("config.invalid", "capture.interactions must be a boolean or an options object."), t;
|
|
825
|
+
let r = typeof t == "object" ? t : {}, i = e.ignoreSelector, a = i === void 0 ? r.ignoreSelector : i;
|
|
826
|
+
if (a != null) try {
|
|
827
|
+
if (typeof a != "string") throw Error("Invalid selector");
|
|
828
|
+
typeof document < "u" && document.createElement("div").matches(a);
|
|
829
|
+
} catch {
|
|
830
|
+
n.report("config.invalid", "capture.interactions.ignoreSelector must be a valid CSS selector or null."), a = r.ignoreSelector;
|
|
831
|
+
}
|
|
832
|
+
let o = r.actionAttribute ?? "data-observability-action";
|
|
833
|
+
return e.actionAttribute !== void 0 && (typeof e.actionAttribute == "string" && /^[a-z][\w-]*$/i.test(e.actionAttribute) ? o = e.actionAttribute : B(n, "capture.interactions.actionAttribute", "an attribute name of letters, digits, hyphens and underscores", e.actionAttribute, `"${o}"`)), {
|
|
834
|
+
actionAttribute: o,
|
|
835
|
+
text: H("capture.interactions.text", e.text, r.text ?? !1, n),
|
|
836
|
+
selector: H("capture.interactions.selector", e.selector, r.selector ?? !1, n),
|
|
837
|
+
ignoreSelector: typeof a == "string" || a === null ? a : void 0,
|
|
838
|
+
maxTextChars: U("capture.interactions.maxTextChars", e.maxTextChars, [0, 2 ** 53 - 1], r.maxTextChars ?? 50, n)
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
var Nn = {
|
|
727
842
|
metricsEndpoint: "The library sends metric records as log records.",
|
|
728
843
|
tracesEndpoint: "The library sends no span."
|
|
729
844
|
};
|
|
730
|
-
function
|
|
845
|
+
function Pn(e, t, n, r, i) {
|
|
731
846
|
let a = n;
|
|
732
847
|
if (typeof t == "string" && t !== "") try {
|
|
733
848
|
new URL(t), a = t;
|
|
@@ -735,72 +850,87 @@ function On(e, t, n, r, i) {
|
|
|
735
850
|
i.report("config.invalid", `${e} is not a valid absolute URL: ${t}. The library keeps the value in force.`, void 0, n);
|
|
736
851
|
}
|
|
737
852
|
else t === "" ? a = "" : t !== void 0 && B(i, e, "a URL string", t, "the value in force");
|
|
738
|
-
return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${
|
|
853
|
+
return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${E}". ${Nn[e]}`), "") : a;
|
|
739
854
|
}
|
|
740
|
-
function
|
|
741
|
-
let
|
|
855
|
+
function Fn(e, t, n, r, i) {
|
|
856
|
+
let a = { ...n };
|
|
857
|
+
for (let o of Object.keys(n)) {
|
|
858
|
+
let s = t?.[o], c = n[o], l = r.ranges[o], u = r.choices?.[o], d = c;
|
|
859
|
+
typeof c == "number" && l ? d = U(`${e}.${o}`, s, l, c, i) : typeof c == "boolean" ? d = H(`${e}.${o}`, s, c, i) : u ? d = V(`${e}.${o}`, s, u, String(c), i) : s === void 0 || typeof s == "string" ? d = s ?? c : B(i, `${e}.${o}`, "a string", s, String(c)), Object.assign(a, { [o]: d });
|
|
860
|
+
}
|
|
861
|
+
return a;
|
|
862
|
+
}
|
|
863
|
+
function K(e, t, n) {
|
|
864
|
+
let r = n ?? u, a = Object.fromEntries(Object.keys(Xt).map((n) => [n, Fn(n, e[n], r[n], Xt[n], t)])), o = {
|
|
742
865
|
...r,
|
|
743
866
|
...e,
|
|
867
|
+
...a,
|
|
868
|
+
lockConfiguration: H("lockConfiguration", e.lockConfiguration, r.lockConfiguration, t),
|
|
869
|
+
loggerCache: { maxEntries: sn(e.loggerCache?.maxEntries, r.loggerCache.maxEntries, t) },
|
|
870
|
+
securityContext: {
|
|
871
|
+
id: typeof e.securityContext?.id == "string" && e.securityContext.id || r.securityContext.id,
|
|
872
|
+
isolation: H("securityContext.isolation", e.securityContext?.isolation, r.securityContext.isolation, t)
|
|
873
|
+
},
|
|
744
874
|
endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
|
|
745
875
|
enabled: H("enabled", e.enabled, r.enabled, t),
|
|
746
|
-
minLevel:
|
|
747
|
-
minLevels:
|
|
748
|
-
processors: G("processors", e.processors, r.processors, "a list of functions",
|
|
749
|
-
compression: V("compression", e.compression,
|
|
750
|
-
credentials: V("credentials", e.credentials,
|
|
751
|
-
headers: "headers" in e ?
|
|
752
|
-
storage: V("storage", e.storage,
|
|
753
|
-
identity: V("identity", e.identity,
|
|
754
|
-
serializer:
|
|
755
|
-
console:
|
|
756
|
-
sampling:
|
|
757
|
-
bus:
|
|
758
|
-
batching:
|
|
759
|
-
retention:
|
|
760
|
-
limits:
|
|
761
|
-
journey:
|
|
762
|
-
capture:
|
|
876
|
+
minLevel: ln("minLevel", e.minLevel, r.minLevel, t),
|
|
877
|
+
minLevels: un(e.minLevels, r.minLevels, t),
|
|
878
|
+
processors: G("processors", e.processors, r.processors, "a list of functions", dn, t),
|
|
879
|
+
compression: V("compression", e.compression, It, r.compression, t),
|
|
880
|
+
credentials: V("credentials", e.credentials, Lt, r.credentials, t),
|
|
881
|
+
headers: "headers" in e ? yn(e.headers, r.headers, t) : r.headers,
|
|
882
|
+
storage: V("storage", e.storage, Rt, r.storage, t),
|
|
883
|
+
identity: V("identity", e.identity, zt, r.identity, t),
|
|
884
|
+
serializer: xn(e.serializer, n?.serializer, t),
|
|
885
|
+
console: Tn(e.console, r.console, t),
|
|
886
|
+
sampling: En(e.sampling, r.sampling, t),
|
|
887
|
+
bus: Dn(e.bus, r.bus, t),
|
|
888
|
+
batching: cn("batching", e.batching, r.batching, Gt, t),
|
|
889
|
+
retention: kn(e.retention, r.retention, t),
|
|
890
|
+
limits: cn("limits", e.limits, r.limits, qt, t),
|
|
891
|
+
journey: On(e.journey, r.journey, t),
|
|
892
|
+
capture: jn(e.capture, r.capture, t)
|
|
763
893
|
};
|
|
764
|
-
for (let n of ["metricsEndpoint", "tracesEndpoint"])
|
|
765
|
-
if (
|
|
766
|
-
else if (
|
|
767
|
-
new URL(
|
|
894
|
+
for (let n of ["metricsEndpoint", "tracesEndpoint"]) o[n] = Pn(n, e[n], r[n], o.serializer, t);
|
|
895
|
+
if (o.transport !== void 0 && typeof o.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), o.transport = r.transport), o.onDrop !== void 0 && typeof o.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), o.onDrop = r.onDrop), o.contextProvider !== void 0 && typeof o.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), o.contextProvider = r.contextProvider), o.transportOnExit !== void 0 && typeof o.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), o.transportOnExit = r.transportOnExit), o.endpoint === "") o.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
|
|
896
|
+
else if (o.endpoint !== null) try {
|
|
897
|
+
new URL(o.endpoint);
|
|
768
898
|
} catch (e) {
|
|
769
|
-
t.report("config.invalid", `endpoint is not a valid absolute URL: ${
|
|
770
|
-
}
|
|
771
|
-
for (let e of ["metricsEndpoint", "tracesEndpoint"])
|
|
772
|
-
|
|
773
|
-
let
|
|
774
|
-
(typeof
|
|
775
|
-
let
|
|
776
|
-
(typeof
|
|
777
|
-
let
|
|
778
|
-
for (let [e, n] of
|
|
779
|
-
|
|
899
|
+
t.report("config.invalid", `endpoint is not a valid absolute URL: ${o.endpoint}.`, void 0, e);
|
|
900
|
+
}
|
|
901
|
+
for (let e of ["metricsEndpoint", "tracesEndpoint"]) o[e] !== "" && o.endpoint === null && !o.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
|
|
902
|
+
o.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${i}'.`), i);
|
|
903
|
+
let s = o.sampling.defaultRate;
|
|
904
|
+
(typeof s != "number" || s < 0 || s > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(s)}. The library uses 1.`), o.sampling.defaultRate = 1);
|
|
905
|
+
let c = o.sampling.remoteMaxRate;
|
|
906
|
+
(typeof c != "number" || !(c >= 0 && c <= 1)) && (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(c)}. The library uses 1.`), o.sampling.remoteMaxRate = 1);
|
|
907
|
+
let l = Object.entries(o.sampling.rates);
|
|
908
|
+
for (let [e, n] of l) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), o.sampling.rates[e] = 1);
|
|
909
|
+
o.capture.ignoreUrls = o.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
|
|
780
910
|
for (let e of [
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
]) e && !
|
|
785
|
-
return
|
|
786
|
-
}
|
|
787
|
-
function
|
|
788
|
-
let n = /* @__PURE__ */ new Set([...Object.keys(
|
|
911
|
+
o.endpoint,
|
|
912
|
+
o.metricsEndpoint,
|
|
913
|
+
o.tracesEndpoint
|
|
914
|
+
]) e && !o.capture.ignoreUrls.includes(e) && (o.capture.ignoreUrls = [...o.capture.ignoreUrls, e]);
|
|
915
|
+
return o.delivery.retryMaxDelayMs < o.delivery.retryBaseDelayMs && (t.report("config.invalid", "delivery.retryMaxDelayMs must be at least retryBaseDelayMs."), o.delivery.retryBaseDelayMs = r.delivery.retryBaseDelayMs, o.delivery.retryMaxDelayMs = r.delivery.retryMaxDelayMs), o.capture.urlTransform !== void 0 && typeof o.capture.urlTransform != "function" && (t.report("config.invalid", "capture.urlTransform must be a function."), o.capture.urlTransform = r.capture.urlTransform), In(e, t), o;
|
|
916
|
+
}
|
|
917
|
+
function In(e, t) {
|
|
918
|
+
let n = /* @__PURE__ */ new Set([...Object.keys(u), ...Ce]);
|
|
789
919
|
for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `The library ignores the unknown config key "${r}". Check the spelling.`);
|
|
790
|
-
for (let n of
|
|
920
|
+
for (let n of pe) {
|
|
791
921
|
let r = e[n];
|
|
792
922
|
if (typeof r != "object" || !r) continue;
|
|
793
|
-
let i = /* @__PURE__ */ new Set([...Object.keys(
|
|
923
|
+
let i = /* @__PURE__ */ new Set([...Object.keys(u[n]), ...g[n]]);
|
|
794
924
|
for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `The library ignores the unknown config key "${n}.${e}". Check the spelling.`);
|
|
795
925
|
}
|
|
796
926
|
}
|
|
797
|
-
function
|
|
798
|
-
for (let n of Object.keys(t))
|
|
799
|
-
for (let n of
|
|
927
|
+
function Ln(e, t) {
|
|
928
|
+
for (let n of Object.keys(t)) pe.includes(n) || Object.assign(e, { [n]: t[n] });
|
|
929
|
+
for (let n of pe) Object.assign(e[n], t[n]);
|
|
800
930
|
}
|
|
801
931
|
//#endregion
|
|
802
932
|
//#region src/core/context.ts
|
|
803
|
-
var
|
|
933
|
+
var Rn = class {
|
|
804
934
|
map = /* @__PURE__ */ new Map();
|
|
805
935
|
set(e, t) {
|
|
806
936
|
this.map.set(e, t);
|
|
@@ -811,16 +941,23 @@ var Mn = class {
|
|
|
811
941
|
remove(e) {
|
|
812
942
|
this.map.delete(e);
|
|
813
943
|
}
|
|
944
|
+
clear() {
|
|
945
|
+
this.map.clear();
|
|
946
|
+
}
|
|
814
947
|
getAll() {
|
|
815
948
|
return Object.fromEntries(this.map);
|
|
816
949
|
}
|
|
817
|
-
},
|
|
950
|
+
}, zn = class {
|
|
818
951
|
handler;
|
|
819
952
|
throttleMs;
|
|
953
|
+
consoleFallback;
|
|
820
954
|
counters = /* @__PURE__ */ new Map();
|
|
821
955
|
lastEmitted = /* @__PURE__ */ new Map();
|
|
822
|
-
constructor(e, t =
|
|
823
|
-
this.handler = e, this.throttleMs = t;
|
|
956
|
+
constructor(e, t = De, n = !1) {
|
|
957
|
+
this.handler = e, this.throttleMs = t, this.consoleFallback = n;
|
|
958
|
+
}
|
|
959
|
+
setPolicy(e, t) {
|
|
960
|
+
this.throttleMs = e, this.consoleFallback = t;
|
|
824
961
|
}
|
|
825
962
|
setHandler(e) {
|
|
826
963
|
this.handler = e;
|
|
@@ -842,12 +979,12 @@ var Mn = class {
|
|
|
842
979
|
count: i
|
|
843
980
|
}, { handler: s } = this;
|
|
844
981
|
if (s) try {
|
|
845
|
-
|
|
982
|
+
k(() => {
|
|
846
983
|
s(o);
|
|
847
984
|
});
|
|
848
|
-
} catch
|
|
849
|
-
this.count("handler.threw"), typeof console < "u" &&
|
|
850
|
-
console.warn(`${
|
|
985
|
+
} catch {
|
|
986
|
+
this.count("handler.threw"), this.consoleFallback && typeof console < "u" && k(() => {
|
|
987
|
+
console.warn(`${ue} The onDiagnostic handler threw an error.`);
|
|
851
988
|
});
|
|
852
989
|
}
|
|
853
990
|
}
|
|
@@ -873,10 +1010,10 @@ var Mn = class {
|
|
|
873
1010
|
};
|
|
874
1011
|
//#endregion
|
|
875
1012
|
//#region src/core/drops.ts
|
|
876
|
-
function
|
|
1013
|
+
function Bn(e, t) {
|
|
877
1014
|
e.length < 20 && !e.includes(t) && e.push(t);
|
|
878
1015
|
}
|
|
879
|
-
var
|
|
1016
|
+
var Vn = class {
|
|
880
1017
|
config;
|
|
881
1018
|
diagnostics;
|
|
882
1019
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -895,12 +1032,12 @@ var Pn = class {
|
|
|
895
1032
|
journeyIds: [],
|
|
896
1033
|
actions: []
|
|
897
1034
|
}, this.pending.set(e, r)), r.records += t.length;
|
|
898
|
-
for (let e of n)
|
|
1035
|
+
for (let e of n) Bn(r.batchIds, e);
|
|
899
1036
|
for (let e of t) {
|
|
900
|
-
let t =
|
|
901
|
-
typeof t == "string" &&
|
|
902
|
-
let n =
|
|
903
|
-
typeof n == "string" &&
|
|
1037
|
+
let t = et(e, b);
|
|
1038
|
+
typeof t == "string" && Bn(r.journeyIds, t);
|
|
1039
|
+
let n = $e(e) ? e.body : void 0;
|
|
1040
|
+
typeof n == "string" && Bn(r.actions, n);
|
|
904
1041
|
}
|
|
905
1042
|
this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
|
|
906
1043
|
this.flush();
|
|
@@ -914,8 +1051,8 @@ var Pn = class {
|
|
|
914
1051
|
if (t) {
|
|
915
1052
|
this.reporting = !0;
|
|
916
1053
|
for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
|
|
917
|
-
|
|
918
|
-
|
|
1054
|
+
Ye(() => {
|
|
1055
|
+
k(() => {
|
|
919
1056
|
t(n);
|
|
920
1057
|
});
|
|
921
1058
|
});
|
|
@@ -923,7 +1060,7 @@ var Pn = class {
|
|
|
923
1060
|
this.reporting = !1;
|
|
924
1061
|
}
|
|
925
1062
|
}
|
|
926
|
-
},
|
|
1063
|
+
}, Hn = class {
|
|
927
1064
|
onDrop;
|
|
928
1065
|
held = [];
|
|
929
1066
|
actions = 0;
|
|
@@ -937,10 +1074,10 @@ var Pn = class {
|
|
|
937
1074
|
return this.held.length;
|
|
938
1075
|
}
|
|
939
1076
|
push(e) {
|
|
940
|
-
let t =
|
|
1077
|
+
let t = $e(e);
|
|
941
1078
|
if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
|
|
942
1079
|
else {
|
|
943
|
-
let e = this.held.findIndex((e) =>
|
|
1080
|
+
let e = this.held.findIndex((e) => $e(e) === t), [n] = this.held.splice(e, 1);
|
|
944
1081
|
this.onDrop(n);
|
|
945
1082
|
}
|
|
946
1083
|
this.held.push(e);
|
|
@@ -949,11 +1086,11 @@ var Pn = class {
|
|
|
949
1086
|
let e = this.held;
|
|
950
1087
|
return this.held = [], this.actions = 0, e;
|
|
951
1088
|
}
|
|
952
|
-
},
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
],
|
|
1089
|
+
}, Un = "error.", Wn = [
|
|
1090
|
+
_e,
|
|
1091
|
+
b,
|
|
1092
|
+
he
|
|
1093
|
+
], Gn = {
|
|
957
1094
|
processor: {
|
|
958
1095
|
label: "A processor",
|
|
959
1096
|
code: "record.dropped_by_processor"
|
|
@@ -962,21 +1099,21 @@ var Pn = class {
|
|
|
962
1099
|
label: "The redact hook",
|
|
963
1100
|
code: "record.dropped_by_redact"
|
|
964
1101
|
}
|
|
965
|
-
},
|
|
1102
|
+
}, Kn = [
|
|
966
1103
|
"metric.name",
|
|
967
1104
|
"metric.unit",
|
|
968
1105
|
"metric.type",
|
|
969
1106
|
"metric.value",
|
|
970
|
-
...Object.values(
|
|
971
|
-
...Object.values(
|
|
1107
|
+
...Object.values(r),
|
|
1108
|
+
...Object.values(w)
|
|
972
1109
|
];
|
|
973
|
-
function
|
|
974
|
-
return Object.fromEntries(
|
|
1110
|
+
function qn(e) {
|
|
1111
|
+
return Object.fromEntries(Kn.filter((t) => t in e).map((t) => [t, e[t]]));
|
|
975
1112
|
}
|
|
976
1113
|
function q(e) {
|
|
977
1114
|
return e;
|
|
978
1115
|
}
|
|
979
|
-
var
|
|
1116
|
+
var Jn = class {
|
|
980
1117
|
deps;
|
|
981
1118
|
resourceCache = null;
|
|
982
1119
|
constructor(e) {
|
|
@@ -988,91 +1125,91 @@ var Vn = class {
|
|
|
988
1125
|
isEnabled(e, t, n) {
|
|
989
1126
|
let { config: r } = this.deps;
|
|
990
1127
|
if (!r.enabled) return !1;
|
|
991
|
-
if (n !== void 0 &&
|
|
992
|
-
let i = this.deps.remote.sampling?.minLevelFor(t) ??
|
|
993
|
-
return
|
|
1128
|
+
if (n !== void 0 && ye.includes(n)) return !0;
|
|
1129
|
+
let i = this.deps.remote.sampling?.minLevelFor(t) ?? Ie(t, r);
|
|
1130
|
+
return S[e] >= S[i];
|
|
994
1131
|
}
|
|
995
|
-
build(e) {
|
|
996
|
-
let { config:
|
|
997
|
-
if (!this.isEnabled(e.level, e.namespace, e.type)) return
|
|
1132
|
+
build(e, t = !1) {
|
|
1133
|
+
let { config: n, diagnostics: r, tracing: i, journey: a, sequence: o, limits: s, remote: c } = this.deps;
|
|
1134
|
+
if (!t && !this.isEnabled(e.level, e.namespace, e.type)) return r.count("record.dropped_by_level"), {
|
|
998
1135
|
record: null,
|
|
999
1136
|
dropped: "level"
|
|
1000
1137
|
};
|
|
1001
|
-
let
|
|
1002
|
-
if (!Pe({
|
|
1138
|
+
let l = e.trace ?? i.resolve(), u = a.current(), d = Le({
|
|
1003
1139
|
level: e.level,
|
|
1004
1140
|
type: e.type,
|
|
1005
1141
|
namespace: e.namespace,
|
|
1006
|
-
journeyId:
|
|
1007
|
-
traceId:
|
|
1142
|
+
journeyId: u?.id ?? "",
|
|
1143
|
+
traceId: l.traceId,
|
|
1008
1144
|
aggregated: e.aggregated
|
|
1009
|
-
},
|
|
1145
|
+
}, n, c.sampling?.current() ?? null);
|
|
1146
|
+
if (!t && !d) return r.count("record.dropped_by_sampling"), {
|
|
1010
1147
|
record: null,
|
|
1011
1148
|
dropped: "sampling"
|
|
1012
1149
|
};
|
|
1013
|
-
let
|
|
1150
|
+
let f = o.next(), p = Qe(r), m = n.metadata.pageUrl ? Xe(p, n.capture.fullUrls, n.capture.urlTransform, r) : "", h, g = 0;
|
|
1014
1151
|
try {
|
|
1015
|
-
let t =
|
|
1016
|
-
|
|
1152
|
+
let t = A(this.deps.context.getAll(), s, r), n = A(this.provided(), s, r), i = A(e.scoped ?? {}, s, r), a = A(e.payload ?? {}, s, r);
|
|
1153
|
+
g = t.bytes + n.bytes + i.bytes + a.bytes, h = {
|
|
1017
1154
|
...q(t.value),
|
|
1018
|
-
...q(
|
|
1155
|
+
...q(n.value),
|
|
1019
1156
|
...q(i.value),
|
|
1020
1157
|
...q(a.value)
|
|
1021
1158
|
};
|
|
1022
1159
|
} catch (e) {
|
|
1023
|
-
|
|
1160
|
+
r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [de]: !0 };
|
|
1024
1161
|
}
|
|
1025
|
-
Object.assign(
|
|
1026
|
-
let
|
|
1027
|
-
|
|
1028
|
-
let
|
|
1029
|
-
timeUnixNano:
|
|
1030
|
-
traceId:
|
|
1031
|
-
spanId:
|
|
1032
|
-
traceFlags:
|
|
1033
|
-
severityNumber:
|
|
1162
|
+
Object.assign(h, e.fixed), h[ce] = e.type, h[x] = f, h[T] = e.namespace, h[_e] = m, u && (h[b] = u.id, h[he] = u.name, u.parentId !== void 0 && (h[Se] = u.parentId));
|
|
1163
|
+
let _ = Ve(e.body, s.maxBodyChars);
|
|
1164
|
+
_ !== e.body && r.count("record.truncated");
|
|
1165
|
+
let v = {
|
|
1166
|
+
timeUnixNano: Fe(),
|
|
1167
|
+
traceId: l.traceId,
|
|
1168
|
+
spanId: l.spanId,
|
|
1169
|
+
traceFlags: l.traceFlags,
|
|
1170
|
+
severityNumber: oe[e.level],
|
|
1034
1171
|
severityText: e.level,
|
|
1035
|
-
body:
|
|
1036
|
-
attributes:
|
|
1172
|
+
body: _,
|
|
1173
|
+
attributes: h,
|
|
1037
1174
|
resource: this.resource()
|
|
1038
|
-
},
|
|
1039
|
-
if (
|
|
1040
|
-
let t = this.applyHooks(
|
|
1175
|
+
}, y = n.processors.map((e) => [e, "processor"]);
|
|
1176
|
+
if (n.redact && y.push([n.redact, "redact"]), y.length > 0) {
|
|
1177
|
+
let t = this.applyHooks(v, y, e.fixed);
|
|
1041
1178
|
if (typeof t == "string") return {
|
|
1042
1179
|
record: null,
|
|
1043
1180
|
dropped: t
|
|
1044
1181
|
};
|
|
1045
|
-
({record:
|
|
1182
|
+
({record: v, bytes: g} = t);
|
|
1046
1183
|
}
|
|
1047
|
-
if (
|
|
1048
|
-
|
|
1049
|
-
bytes:
|
|
1050
|
-
body:
|
|
1184
|
+
if (g > s.maxRecordBytes) {
|
|
1185
|
+
r.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
|
|
1186
|
+
bytes: g,
|
|
1187
|
+
body: v.body
|
|
1051
1188
|
});
|
|
1052
1189
|
let t = {
|
|
1053
|
-
[
|
|
1054
|
-
[
|
|
1055
|
-
[
|
|
1056
|
-
[
|
|
1057
|
-
[
|
|
1190
|
+
[ce]: e.type,
|
|
1191
|
+
[x]: f,
|
|
1192
|
+
[T]: e.namespace,
|
|
1193
|
+
[ae]: !0,
|
|
1194
|
+
[fe]: g
|
|
1058
1195
|
};
|
|
1059
|
-
for (let e of
|
|
1060
|
-
for (let [e, n] of Object.entries(
|
|
1061
|
-
let
|
|
1062
|
-
|
|
1063
|
-
let i =
|
|
1196
|
+
for (let e of Wn) e in v.attributes && (t[e] = v.attributes[e]);
|
|
1197
|
+
for (let [e, n] of Object.entries(v.attributes)) e.startsWith(Un) && (t[e] = n);
|
|
1198
|
+
let n = A(t, s, r).bytes;
|
|
1199
|
+
n > s.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, xe), n = A(t, s, r).bytes);
|
|
1200
|
+
let i = v.attributes[C];
|
|
1064
1201
|
if (i !== void 0) {
|
|
1065
|
-
let e =
|
|
1066
|
-
|
|
1202
|
+
let e = A(i, s, r).bytes;
|
|
1203
|
+
n + e <= s.maxRecordBytes && (t[C] = i);
|
|
1067
1204
|
}
|
|
1068
|
-
Object.assign(t, e.fixed),
|
|
1205
|
+
Object.assign(t, e.fixed), v.attributes = t;
|
|
1069
1206
|
}
|
|
1070
|
-
return { record:
|
|
1207
|
+
return { record: v };
|
|
1071
1208
|
}
|
|
1072
1209
|
redactForwarded(e) {
|
|
1073
1210
|
let { redact: t } = this.deps.config;
|
|
1074
1211
|
if (!t) return e;
|
|
1075
|
-
let n = [[t, "redact"]], r = this.applyHooks(e, n,
|
|
1212
|
+
let n = [[t, "redact"]], r = this.applyHooks(e, n, qn(e.attributes));
|
|
1076
1213
|
return typeof r == "string" ? null : r.record;
|
|
1077
1214
|
}
|
|
1078
1215
|
applyHooks(e, t, n) {
|
|
@@ -1082,7 +1219,7 @@ var Vn = class {
|
|
|
1082
1219
|
if (typeof t == "string") return t;
|
|
1083
1220
|
r = t;
|
|
1084
1221
|
}
|
|
1085
|
-
let { diagnostics: i, limits: a } = this.deps, o =
|
|
1222
|
+
let { diagnostics: i, limits: a } = this.deps, o = A(r.attributes, a, i), s = q(o.value);
|
|
1086
1223
|
return Object.assign(s, n), {
|
|
1087
1224
|
record: {
|
|
1088
1225
|
...r,
|
|
@@ -1092,7 +1229,7 @@ var Vn = class {
|
|
|
1092
1229
|
};
|
|
1093
1230
|
}
|
|
1094
1231
|
runHook(e, t, n) {
|
|
1095
|
-
let { diagnostics: r } = this.deps, { label: i, code: a } =
|
|
1232
|
+
let { diagnostics: r } = this.deps, { label: i, code: a } = Gn[t], o;
|
|
1096
1233
|
try {
|
|
1097
1234
|
o = e(n);
|
|
1098
1235
|
} catch (e) {
|
|
@@ -1100,9 +1237,9 @@ var Vn = class {
|
|
|
1100
1237
|
}
|
|
1101
1238
|
if (o === null) return r.count(a), t;
|
|
1102
1239
|
let s = o ?? n;
|
|
1103
|
-
return
|
|
1240
|
+
return Ne(s) ? Re(s.severityText) ? {
|
|
1104
1241
|
...s,
|
|
1105
|
-
severityNumber:
|
|
1242
|
+
severityNumber: oe[s.severityText]
|
|
1106
1243
|
} : (r.report("record.dropped_malformed", `${i} set a severityText that is not a log level. The library dropped the record.`), "malformed") : s === n ? (r.report("record.dropped_malformed", `${i} changed the record to a shape that is not a record. The library dropped it.`), "malformed") : (r.report(a, `${i} returned a value that is not a record. The library dropped the record.`), t);
|
|
1107
1244
|
}
|
|
1108
1245
|
provided() {
|
|
@@ -1110,7 +1247,7 @@ var Vn = class {
|
|
|
1110
1247
|
if (!e) return {};
|
|
1111
1248
|
let { diagnostics: t } = this.deps, n = t.guard("handler.threw", "The contextProvider threw an error. The record has no attributes from it.", () => {
|
|
1112
1249
|
let t = e();
|
|
1113
|
-
return t === void 0 ? {} :
|
|
1250
|
+
return t === void 0 ? {} : O(t) && typeof t.then != "function" ? t : null;
|
|
1114
1251
|
});
|
|
1115
1252
|
return n === null && t.report("config.invalid", "contextProvider must return an object of attributes. The library ignores the value."), n ?? {};
|
|
1116
1253
|
}
|
|
@@ -1118,34 +1255,34 @@ var Vn = class {
|
|
|
1118
1255
|
if (this.resourceCache) return this.resourceCache;
|
|
1119
1256
|
let { config: e, identity: n, platform: r } = this.deps;
|
|
1120
1257
|
return this.resourceCache = {
|
|
1121
|
-
[
|
|
1122
|
-
[
|
|
1123
|
-
[
|
|
1124
|
-
[
|
|
1125
|
-
[
|
|
1126
|
-
[
|
|
1127
|
-
[
|
|
1128
|
-
[
|
|
1129
|
-
[
|
|
1258
|
+
[o]: e.serviceName,
|
|
1259
|
+
[l]: e.serviceVersion,
|
|
1260
|
+
[y]: e.environment,
|
|
1261
|
+
[te]: ie,
|
|
1262
|
+
[re]: D,
|
|
1263
|
+
[ne]: le,
|
|
1264
|
+
[s]: r.platform,
|
|
1265
|
+
[be]: n.sessionId,
|
|
1266
|
+
[c]: n.tabId,
|
|
1130
1267
|
[t]: n.contextId,
|
|
1131
|
-
[
|
|
1132
|
-
|
|
1133
|
-
|
|
1268
|
+
...e.metadata.userAgent ? { [Oe]: r.userAgent } : {},
|
|
1269
|
+
...!e.metadata.openfin || r.openfinUuid === void 0 ? {} : { [ee]: r.openfinUuid },
|
|
1270
|
+
...!e.metadata.openfin || r.openfinName === void 0 ? {} : { [_]: r.openfinName }
|
|
1134
1271
|
}, this.resourceCache;
|
|
1135
1272
|
}
|
|
1136
|
-
},
|
|
1273
|
+
}, Yn = 1e3, Xn = {
|
|
1137
1274
|
start: "ui.start",
|
|
1138
1275
|
interaction: "ui.interaction",
|
|
1139
1276
|
navigation: "ui.navigation",
|
|
1140
1277
|
explicit: "ui.trace",
|
|
1141
1278
|
maxAge: "ui.trace"
|
|
1142
1279
|
};
|
|
1143
|
-
function
|
|
1144
|
-
return `${String(Math.round(e *
|
|
1280
|
+
function Zn(e) {
|
|
1281
|
+
return `${String(Math.round(e * Yn))}000`;
|
|
1145
1282
|
}
|
|
1146
|
-
function
|
|
1283
|
+
function Qn(e) {
|
|
1147
1284
|
return {
|
|
1148
|
-
name:
|
|
1285
|
+
name: Xn[e.reason],
|
|
1149
1286
|
kind: "internal",
|
|
1150
1287
|
traceId: e.traceId,
|
|
1151
1288
|
spanId: e.spanId,
|
|
@@ -1156,40 +1293,49 @@ function Gn(e) {
|
|
|
1156
1293
|
attributes: {}
|
|
1157
1294
|
};
|
|
1158
1295
|
}
|
|
1159
|
-
function
|
|
1296
|
+
function $n(e) {
|
|
1160
1297
|
return {
|
|
1161
|
-
[
|
|
1162
|
-
[
|
|
1163
|
-
[
|
|
1164
|
-
[
|
|
1165
|
-
[
|
|
1298
|
+
[w.kind]: e.kind,
|
|
1299
|
+
[w.parentId]: e.parentSpanId,
|
|
1300
|
+
[w.start]: Zn(e.startMs),
|
|
1301
|
+
[w.end]: Zn(e.endMs),
|
|
1302
|
+
[w.status]: e.error ? "error" : "unset"
|
|
1166
1303
|
};
|
|
1167
1304
|
}
|
|
1168
1305
|
//#endregion
|
|
1169
1306
|
//#region src/core/runtime.ts
|
|
1170
|
-
var
|
|
1171
|
-
errors: async () => (await import("./errors-
|
|
1172
|
-
network: async () => (await import("./network-
|
|
1173
|
-
interactions: async () => (await import("./interactions-
|
|
1307
|
+
var er = {
|
|
1308
|
+
errors: async () => (await import("./errors-BhC7HTSt.js")).ErrorCapture,
|
|
1309
|
+
network: async () => (await import("./network-DdzXDI3J.js")).NetworkCapture,
|
|
1310
|
+
interactions: async () => (await import("./interactions-BUDLxbv1.js")).InteractionCapture,
|
|
1174
1311
|
webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
|
|
1175
|
-
longFrames: async () => (await import("./long-frames-
|
|
1176
|
-
console: async () => (await import("./console-
|
|
1177
|
-
},
|
|
1178
|
-
function
|
|
1179
|
-
let t =
|
|
1180
|
-
return t === void 0 && (t = ++
|
|
1181
|
-
}
|
|
1182
|
-
var
|
|
1183
|
-
|
|
1312
|
+
longFrames: async () => (await import("./long-frames-DI5ypfAF.js")).LongFrameCapture,
|
|
1313
|
+
console: async () => (await import("./console-DbAZYJuy.js")).ConsoleCapture
|
|
1314
|
+
}, tr = /* @__PURE__ */ new WeakMap(), nr = 0;
|
|
1315
|
+
function rr(e) {
|
|
1316
|
+
let t = tr.get(e);
|
|
1317
|
+
return t === void 0 && (t = ++nr, tr.set(e, t)), t;
|
|
1318
|
+
}
|
|
1319
|
+
var ir = Symbol.for(p), ar = Symbol.for(e), or = ["batching", "retention"], sr = {
|
|
1320
|
+
endpoint: null,
|
|
1321
|
+
metricsEndpoint: "",
|
|
1322
|
+
tracesEndpoint: "",
|
|
1323
|
+
headers: void 0,
|
|
1324
|
+
credentials: "omit",
|
|
1325
|
+
transport: void 0,
|
|
1326
|
+
transportOnExit: void 0
|
|
1327
|
+
}, cr = Object.keys(sr);
|
|
1328
|
+
function lr(e) {
|
|
1184
1329
|
return JSON.stringify({
|
|
1185
1330
|
...e,
|
|
1331
|
+
urlTransform: e.urlTransform ? rr(e.urlTransform) : void 0,
|
|
1186
1332
|
webVitalsLoader: e.webVitalsLoader !== void 0,
|
|
1187
1333
|
ignoreUrls: e.ignoreUrls.map(String),
|
|
1188
1334
|
propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String),
|
|
1189
|
-
plugins: e.plugins.map(
|
|
1335
|
+
plugins: e.plugins.map(rr)
|
|
1190
1336
|
});
|
|
1191
1337
|
}
|
|
1192
|
-
function
|
|
1338
|
+
function ur(e) {
|
|
1193
1339
|
return {
|
|
1194
1340
|
...e,
|
|
1195
1341
|
endpoint: null,
|
|
@@ -1203,15 +1349,29 @@ function $n(e) {
|
|
|
1203
1349
|
}
|
|
1204
1350
|
};
|
|
1205
1351
|
}
|
|
1206
|
-
function
|
|
1352
|
+
function dr(e) {
|
|
1207
1353
|
return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport !== void 0;
|
|
1208
1354
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return e.sdkVersion ===
|
|
1355
|
+
function fr(e) {
|
|
1356
|
+
return e.sdkVersion === D;
|
|
1211
1357
|
}
|
|
1212
|
-
var
|
|
1358
|
+
var J = class e {
|
|
1359
|
+
rotating = !1;
|
|
1360
|
+
closingContext = !1;
|
|
1361
|
+
mismatchVersion = null;
|
|
1362
|
+
contextMismatch = !1;
|
|
1363
|
+
rotation;
|
|
1364
|
+
memoryStorage;
|
|
1365
|
+
explicitSecurityContext;
|
|
1366
|
+
ownerAdopted = !1;
|
|
1367
|
+
isRotating() {
|
|
1368
|
+
return this.rotating;
|
|
1369
|
+
}
|
|
1370
|
+
setConfigurationLocked(e) {
|
|
1371
|
+
typeof e == "boolean" && (this.config.lockConfiguration = e);
|
|
1372
|
+
}
|
|
1213
1373
|
static local = null;
|
|
1214
|
-
sdkVersion =
|
|
1374
|
+
sdkVersion = D;
|
|
1215
1375
|
diagnostics;
|
|
1216
1376
|
config;
|
|
1217
1377
|
platform;
|
|
@@ -1219,10 +1379,10 @@ var Z = class e {
|
|
|
1219
1379
|
stores;
|
|
1220
1380
|
identityBuiltAs;
|
|
1221
1381
|
sessionTouch;
|
|
1222
|
-
context = new
|
|
1382
|
+
context = new Rn();
|
|
1223
1383
|
breadcrumbs;
|
|
1224
1384
|
tracing;
|
|
1225
|
-
sequence = new
|
|
1385
|
+
sequence = new Ct();
|
|
1226
1386
|
journey;
|
|
1227
1387
|
builder;
|
|
1228
1388
|
remote = { sampling: null };
|
|
@@ -1235,7 +1395,7 @@ var Z = class e {
|
|
|
1235
1395
|
storageBuiltAs;
|
|
1236
1396
|
sender;
|
|
1237
1397
|
senderLoad;
|
|
1238
|
-
pendingRecords = new
|
|
1398
|
+
pendingRecords = new Hn((e) => {
|
|
1239
1399
|
this.dropHeld(e);
|
|
1240
1400
|
});
|
|
1241
1401
|
captures = [];
|
|
@@ -1245,7 +1405,7 @@ var Z = class e {
|
|
|
1245
1405
|
navigationTiming: !1,
|
|
1246
1406
|
longFrames: !1
|
|
1247
1407
|
};
|
|
1248
|
-
bootBuffer = new
|
|
1408
|
+
bootBuffer = new Hn((e) => {
|
|
1249
1409
|
this.dropHeld(e);
|
|
1250
1410
|
});
|
|
1251
1411
|
forwardBuffer = [];
|
|
@@ -1264,20 +1424,20 @@ var Z = class e {
|
|
|
1264
1424
|
this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
|
|
1265
1425
|
};
|
|
1266
1426
|
constructor(e, t = !1) {
|
|
1267
|
-
this.diagnostics = new
|
|
1268
|
-
let n = (e) =>
|
|
1269
|
-
this.tracing = new
|
|
1427
|
+
this.diagnostics = new zn(e.onDiagnostic), this.platform = Ze(this.diagnostics), this.degraded = t || this.onServer(), this.config = K(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= j(this.diagnostics), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" || this.onServer() ? Ke() : Je, this.identity = qe(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new We(this.diagnostics, this.stores, this.config.correlation.sessionTouchMs, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Pt(this.config.capturePolicy.breadcrumbs);
|
|
1428
|
+
let n = (e) => Pe(e, this.config.sampling.defaultRate);
|
|
1429
|
+
this.tracing = new Nt(this.diagnostics, this.config.correlation.traceMaxAgeMs || Infinity, this.config.otelLoader, {
|
|
1270
1430
|
enabled: () => this.config.tracesEndpoint !== "",
|
|
1271
1431
|
keeps: n,
|
|
1272
1432
|
onEnd: (e) => {
|
|
1273
|
-
n(e.traceId) && this.recordSpan(
|
|
1433
|
+
n(e.traceId) && this.recordSpan(Qn(e));
|
|
1274
1434
|
}
|
|
1275
|
-
}), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new
|
|
1276
|
-
...
|
|
1435
|
+
}), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new St(this.config.console, this.diagnostics, this.limits), this.drops = new Vn(this.config, this.diagnostics), this.journeyOptions = {
|
|
1436
|
+
...nt,
|
|
1277
1437
|
maxAgeMs: this.config.journey.maxAgeMs
|
|
1278
|
-
}, this.journey = new
|
|
1438
|
+
}, this.journey = new tt(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
|
|
1279
1439
|
this.bus?.broadcastJourney(e);
|
|
1280
|
-
}, this.stores), this.builder = new
|
|
1440
|
+
}, this.stores), this.builder = new Jn({
|
|
1281
1441
|
remote: this.remote,
|
|
1282
1442
|
config: this.config,
|
|
1283
1443
|
limits: this.limits,
|
|
@@ -1288,26 +1448,26 @@ var Z = class e {
|
|
|
1288
1448
|
sequence: this.sequence,
|
|
1289
1449
|
identity: this.identity,
|
|
1290
1450
|
platform: this.platform
|
|
1291
|
-
}), this.meter = new
|
|
1451
|
+
}), this.meter = new bt(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
|
|
1292
1452
|
this.emitPoint(e, t, n);
|
|
1293
|
-
}, this.diagnostics);
|
|
1453
|
+
}, this.diagnostics, this.config.metrics);
|
|
1294
1454
|
}
|
|
1295
1455
|
addBreadcrumb(e, t) {
|
|
1296
|
-
this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
|
|
1456
|
+
this.rotating || this.destroyed || this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
|
|
1297
1457
|
let n = {
|
|
1298
1458
|
t: Date.now(),
|
|
1299
1459
|
category: "custom",
|
|
1300
|
-
message:
|
|
1460
|
+
message: Ve(String(e), this.limits.maxBodyChars)
|
|
1301
1461
|
};
|
|
1302
1462
|
if (t !== void 0) {
|
|
1303
|
-
let e =
|
|
1304
|
-
n.data =
|
|
1463
|
+
let e = He(t, this.limits, this.diagnostics);
|
|
1464
|
+
n.data = O(e) ? e : { value: e };
|
|
1305
1465
|
}
|
|
1306
1466
|
this.breadcrumbs.push(n);
|
|
1307
1467
|
});
|
|
1308
1468
|
}
|
|
1309
1469
|
recordMetric(e, t, n) {
|
|
1310
|
-
this.destroyed
|
|
1470
|
+
!this.destroyed && !this.rotating && this.meter.record(e, t, n);
|
|
1311
1471
|
}
|
|
1312
1472
|
recordSpan(e) {
|
|
1313
1473
|
if (this.config.tracesEndpoint === "") return;
|
|
@@ -1315,9 +1475,9 @@ var Z = class e {
|
|
|
1315
1475
|
level: "INFO",
|
|
1316
1476
|
type: "span",
|
|
1317
1477
|
body: e.name,
|
|
1318
|
-
namespace:
|
|
1478
|
+
namespace: Te,
|
|
1319
1479
|
payload: e.attributes,
|
|
1320
|
-
fixed:
|
|
1480
|
+
fixed: $n(e),
|
|
1321
1481
|
trace: {
|
|
1322
1482
|
traceId: e.traceId,
|
|
1323
1483
|
spanId: e.spanId,
|
|
@@ -1327,38 +1487,39 @@ var Z = class e {
|
|
|
1327
1487
|
this.emit(t);
|
|
1328
1488
|
}
|
|
1329
1489
|
emitPoint(e, t, n) {
|
|
1330
|
-
let { record:
|
|
1490
|
+
let { record: r } = this.builder.build({
|
|
1331
1491
|
level: "INFO",
|
|
1332
1492
|
type: "metric",
|
|
1333
1493
|
body: e,
|
|
1334
|
-
namespace:
|
|
1494
|
+
namespace: we,
|
|
1335
1495
|
payload: t,
|
|
1336
1496
|
fixed: n,
|
|
1337
1497
|
aggregated: !0
|
|
1338
1498
|
});
|
|
1339
|
-
this.emit(
|
|
1499
|
+
this.emit(r);
|
|
1340
1500
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1501
|
+
busCanAccept = (e, t) => this.bus?.isRegistered(e, t) ?? !1;
|
|
1502
|
+
busAccept = (e, t, n) => {
|
|
1503
|
+
this.destroyed || this.ensureBus().then((r) => {
|
|
1504
|
+
r && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
|
|
1505
|
+
r.acceptDirect(e, t, n);
|
|
1345
1506
|
});
|
|
1346
1507
|
});
|
|
1347
1508
|
};
|
|
1348
1509
|
static pinned() {
|
|
1349
|
-
return globalThis[
|
|
1510
|
+
return globalThis[ir] ?? null;
|
|
1350
1511
|
}
|
|
1351
1512
|
static current() {
|
|
1352
1513
|
let t = e.local;
|
|
1353
1514
|
if (t) return t.destroyed ? null : t;
|
|
1354
1515
|
let n = e.pinned();
|
|
1355
|
-
return n &&
|
|
1516
|
+
return n && fr(n) ? n : null;
|
|
1356
1517
|
}
|
|
1357
1518
|
static stopped() {
|
|
1358
1519
|
let t = e.local;
|
|
1359
1520
|
if (t?.destroyed) return t;
|
|
1360
|
-
let n = globalThis[
|
|
1361
|
-
return n &&
|
|
1521
|
+
let n = globalThis[ar];
|
|
1522
|
+
return n && fr(n) ? n : null;
|
|
1362
1523
|
}
|
|
1363
1524
|
isDestroyed() {
|
|
1364
1525
|
return this.destroyed;
|
|
@@ -1369,33 +1530,60 @@ var Z = class e {
|
|
|
1369
1530
|
e.local = null;
|
|
1370
1531
|
let i = e.pinned();
|
|
1371
1532
|
if (i) {
|
|
1372
|
-
if (!
|
|
1533
|
+
if (!fr(i)) return e.startDegraded(t, i.sdkVersion);
|
|
1373
1534
|
if (!i.destroyed) return i.reconfigure(t), i;
|
|
1374
1535
|
}
|
|
1375
1536
|
let a = new e(t);
|
|
1376
|
-
return a.tunablesLocked = !n, globalThis[
|
|
1537
|
+
return a.tunablesLocked = !n, globalThis[ir] = a, Reflect.deleteProperty(globalThis, ar), a.init(), a;
|
|
1377
1538
|
}
|
|
1378
1539
|
static startDegraded(t, n) {
|
|
1379
1540
|
let r = new e(t, !0);
|
|
1380
1541
|
e.local = r;
|
|
1381
1542
|
let i = typeof n == "string" ? n : "before 0.9.0";
|
|
1382
|
-
return r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${
|
|
1543
|
+
return r.mismatchVersion = i, r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${D}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
|
|
1383
1544
|
found: i,
|
|
1384
|
-
own:
|
|
1545
|
+
own: D
|
|
1385
1546
|
}), r.init(), r;
|
|
1386
1547
|
}
|
|
1387
1548
|
reconfigure(e) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1549
|
+
if (this.rotating) {
|
|
1550
|
+
this.diagnostics.report("config.locked", "Configuration cannot change during security-context rotation.");
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
if (this.config.lockConfiguration) {
|
|
1554
|
+
let t = K(e, this.diagnostics, this.config);
|
|
1555
|
+
Y(this.config, t) || this.diagnostics.report("config.locked", "Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.");
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
let t = this.keepDestination(this.keepRouting(this.allowed(e)));
|
|
1559
|
+
!this.tunablesLocked && t.securityContext?.id && (this.explicitSecurityContext = !0);
|
|
1560
|
+
for (let e of ["correlation", "persistence"]) (e !== "persistence" || this.tunablesLocked || this.senderLoad !== void 0) && t[e] && !Y({
|
|
1561
|
+
...this.config[e],
|
|
1562
|
+
...t[e]
|
|
1563
|
+
}, this.config[e]) && (this.diagnostics.report("config.invalid", `${e} cannot change after startup.`), Object.assign(t, { [e]: this.config[e] }));
|
|
1564
|
+
let n = lr(this.config.capture), r = K(t, this.diagnostics, this.config);
|
|
1565
|
+
this.keepStartupTunables(r), Ln(this.config, r), this.breadcrumbs.resize(this.config.capturePolicy.breadcrumbs), this.diagnostics.setHandler(this.config.onDiagnostic), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), lr(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
|
|
1390
1566
|
}
|
|
1391
1567
|
onServer() {
|
|
1392
1568
|
return this.platform.platform === "node";
|
|
1393
1569
|
}
|
|
1394
1570
|
allowed(e) {
|
|
1395
|
-
return this.degraded ? (this.onServer() && !this.serverReported &&
|
|
1571
|
+
return this.degraded ? (this.onServer() && !this.serverReported && dr(e) && (this.serverReported = !0, this.diagnostics.report("config.invalid", "The library runs console-only on Node. It sends no record and installs no capture. It ignores endpoint, metricsEndpoint, tracesEndpoint and transport.")), ur(e)) : e;
|
|
1572
|
+
}
|
|
1573
|
+
keepRouting(e) {
|
|
1574
|
+
if (!this.tunablesLocked || this.degraded || !this.config.securityContext.isolation) return e;
|
|
1575
|
+
let t = K(e, new zn(), this.config), n = cr.filter((e) => !Y(t[e], this.config[e]));
|
|
1576
|
+
if (t.securityContext.id !== this.config.securityContext.id && n.push("securityContext.id"), n.length === 0) return e;
|
|
1577
|
+
let r = { ...e };
|
|
1578
|
+
for (let e of cr) n.includes(e) && Reflect.deleteProperty(r, e);
|
|
1579
|
+
if (n.includes("securityContext.id")) {
|
|
1580
|
+
let t = { ...e.securityContext };
|
|
1581
|
+
Reflect.deleteProperty(t, "id"), r.securityContext = t;
|
|
1582
|
+
}
|
|
1583
|
+
return this.diagnostics.report("config.invalid", `Isolation refuses changes to ${n.join(", ")}. Use rotateSecurityContext() for these changes. To permit them, set securityContext.isolation: false in a separate configure() call. The other settings apply.`), r;
|
|
1396
1584
|
}
|
|
1397
1585
|
keepStartupTunables(e) {
|
|
1398
|
-
if (this.senderLoad !== void 0 && this.keepSections(e,
|
|
1586
|
+
if (this.senderLoad !== void 0 && this.keepSections(e, or), !this.tunablesLocked) {
|
|
1399
1587
|
this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
|
|
1400
1588
|
return;
|
|
1401
1589
|
}
|
|
@@ -1404,7 +1592,7 @@ var Z = class e {
|
|
|
1404
1592
|
e.journey.maxAgeMs !== t && (this.diagnostics.report("config.invalid", `journey.maxAgeMs cannot change after startup. It stays ${String(t)}.`, { requested: e.journey.maxAgeMs }), e.journey.maxAgeMs = t);
|
|
1405
1593
|
}
|
|
1406
1594
|
keepSections(e, t) {
|
|
1407
|
-
for (let n of t)
|
|
1595
|
+
for (let n of t) Y(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values in force stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
|
|
1408
1596
|
}
|
|
1409
1597
|
keepBuiltStorage() {
|
|
1410
1598
|
let e = this.storageBuiltAs;
|
|
@@ -1454,9 +1642,27 @@ var Z = class e {
|
|
|
1454
1642
|
}
|
|
1455
1643
|
async buildBus() {
|
|
1456
1644
|
try {
|
|
1457
|
-
let { Bus: e } = await import("./bus-
|
|
1645
|
+
let { Bus: e } = await import("./bus-DeOPHWaD.js");
|
|
1458
1646
|
if (this.destroyed) return null;
|
|
1459
1647
|
let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
1648
|
+
onSecurityContext: (e) => {
|
|
1649
|
+
if (this.explicitSecurityContext && this.config.securityContext.id !== e) return this.contextMismatch = !0, this.diagnostics.report("security.context_mismatch", "The configured security context differs from the upstream owner."), !1;
|
|
1650
|
+
if (this.contextMismatch = !1, this.config.securityContext.id !== e) {
|
|
1651
|
+
if (this.ownerAdopted) {
|
|
1652
|
+
this.drops.add("security_context", [
|
|
1653
|
+
...this.bootBuffer.take(),
|
|
1654
|
+
...this.pendingRecords.take(),
|
|
1655
|
+
...this.forwardBuffer
|
|
1656
|
+
]), this.forwardBuffer = [], this.context.clear(), this.breadcrumbs.clear();
|
|
1657
|
+
let e = this.rotating;
|
|
1658
|
+
this.rotating = !0, this.meter.collect();
|
|
1659
|
+
let t = this.sessionTouch.stored();
|
|
1660
|
+
this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : j(this.diagnostics)), this.rotating = e;
|
|
1661
|
+
}
|
|
1662
|
+
this.config.securityContext.id = e;
|
|
1663
|
+
}
|
|
1664
|
+
return this.ownerAdopted = !0, !0;
|
|
1665
|
+
},
|
|
1460
1666
|
onRecords: (e) => {
|
|
1461
1667
|
this.ingestForwarded(e);
|
|
1462
1668
|
},
|
|
@@ -1489,7 +1695,11 @@ var Z = class e {
|
|
|
1489
1695
|
async buildSender() {
|
|
1490
1696
|
this.storageBuiltAs = this.config.storage;
|
|
1491
1697
|
try {
|
|
1492
|
-
let { Sender: e } = await import("./sender-
|
|
1698
|
+
let { Sender: e } = await import("./sender-DUUmSglb.js"), t = this.destroyed ? null : await e.create({
|
|
1699
|
+
storage: this.memoryStorage,
|
|
1700
|
+
onStorage: (e) => {
|
|
1701
|
+
e.name === "memory" && (this.memoryStorage = e);
|
|
1702
|
+
},
|
|
1493
1703
|
config: this.config,
|
|
1494
1704
|
diagnostics: this.diagnostics,
|
|
1495
1705
|
onGap: this.reportGap,
|
|
@@ -1513,15 +1723,16 @@ var Z = class e {
|
|
|
1513
1723
|
if (this.degraded) return;
|
|
1514
1724
|
let e = ++this.captureGeneration, t = this.config.capture, n = [];
|
|
1515
1725
|
(t.errors || t.rejections || t.resourceErrors) && n.push("errors"), (t.fetch || t.xhr) && n.push("network"), (t.interactions || t.navigation) && n.push("interactions"), t.webVitals && n.push("webVitals"), t.longFrames && n.push("longFrames"), (Array.isArray(t.console) ? t.console.length > 0 : t.console) && n.push("console");
|
|
1516
|
-
let [r,
|
|
1726
|
+
let [r, i] = await Promise.all([Promise.all(n.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
|
|
1517
1727
|
if (e !== this.captureGeneration || this.destroyed) return;
|
|
1518
1728
|
this.uninstallCaptures();
|
|
1519
|
-
let
|
|
1729
|
+
let a = {
|
|
1730
|
+
isActive: () => !this.destroyed && !this.rotating,
|
|
1520
1731
|
config: this.config,
|
|
1521
1732
|
diagnostics: this.diagnostics,
|
|
1522
1733
|
breadcrumbs: this.breadcrumbs,
|
|
1523
1734
|
tracing: this.tracing,
|
|
1524
|
-
logger: new
|
|
1735
|
+
logger: new F(() => this, me),
|
|
1525
1736
|
once: this.captureOnce,
|
|
1526
1737
|
recordMetric: (e, t, n) => {
|
|
1527
1738
|
this.recordMetric(e, t, n);
|
|
@@ -1530,9 +1741,9 @@ var Z = class e {
|
|
|
1530
1741
|
this.recordSpan(e);
|
|
1531
1742
|
}
|
|
1532
1743
|
};
|
|
1533
|
-
for (let e of r) e && this.captures.push(new e(
|
|
1534
|
-
let
|
|
1535
|
-
for (let e of
|
|
1744
|
+
for (let e of r) e && this.captures.push(new e(a));
|
|
1745
|
+
let o = i ? [...t.plugins, new i(this.diagnostics, this.config)] : t.plugins;
|
|
1746
|
+
for (let e of o) this.captures.push(this.pluginCapture(e));
|
|
1536
1747
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
|
|
1537
1748
|
e.install();
|
|
1538
1749
|
});
|
|
@@ -1544,19 +1755,19 @@ var Z = class e {
|
|
|
1544
1755
|
this.captures.length = 0;
|
|
1545
1756
|
}
|
|
1546
1757
|
loadWebSocket() {
|
|
1547
|
-
return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-
|
|
1758
|
+
return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-CpsD8WAa.js")).WebSocketCapture);
|
|
1548
1759
|
}
|
|
1549
1760
|
pluginCapture(e) {
|
|
1550
1761
|
let { name: t } = e, n = (e, t, n) => {
|
|
1551
1762
|
this.recordMetric(e, t, n);
|
|
1552
1763
|
}, r = {
|
|
1553
|
-
logger: new
|
|
1554
|
-
counter: (e, t = {}) =>
|
|
1555
|
-
histogram: (e, t = {}) =>
|
|
1764
|
+
logger: new F(() => this, `${me}.${t}`),
|
|
1765
|
+
counter: (e, t = {}) => vt(e, t, n),
|
|
1766
|
+
histogram: (e, t = {}) => yt(e, t, n),
|
|
1556
1767
|
addBreadcrumb: (e, t) => {
|
|
1557
1768
|
this.addBreadcrumb(e, t);
|
|
1558
1769
|
},
|
|
1559
|
-
ownRequest:
|
|
1770
|
+
ownRequest: Ye
|
|
1560
1771
|
};
|
|
1561
1772
|
return {
|
|
1562
1773
|
name: t,
|
|
@@ -1569,23 +1780,34 @@ var Z = class e {
|
|
|
1569
1780
|
};
|
|
1570
1781
|
}
|
|
1571
1782
|
loadCapture(e) {
|
|
1572
|
-
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`,
|
|
1783
|
+
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, er[e]);
|
|
1573
1784
|
}
|
|
1574
|
-
registerWorker(e) {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1785
|
+
registerWorker(e, t = {}) {
|
|
1786
|
+
let n = !1, r;
|
|
1787
|
+
return this.destroyed ? () => void 0 : (this.constructBus().then((i) => {
|
|
1788
|
+
!i || this.destroyed || n || (this.diagnostics.guard("bus.send_failed", "The library could not register the worker.", () => {
|
|
1789
|
+
r = i.attachWorker(e, t);
|
|
1578
1790
|
}), this.ensureBus());
|
|
1791
|
+
}), () => {
|
|
1792
|
+
n = !0, r?.();
|
|
1579
1793
|
});
|
|
1580
1794
|
}
|
|
1795
|
+
registerFrame(e, t) {
|
|
1796
|
+
let n = !1, r;
|
|
1797
|
+
return this.constructBus().then((i) => {
|
|
1798
|
+
!i || this.destroyed || n || (r = this.diagnostics.guard("bus.send_failed", "The frame could not be registered.", () => i.registerFrame(e, t)), this.ensureBus());
|
|
1799
|
+
}), () => {
|
|
1800
|
+
n = !0, r?.();
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1581
1803
|
async destroy() {
|
|
1582
1804
|
if (this.destroyed) return;
|
|
1583
1805
|
this.meter.collect(), this.tracing.end(), this.destroyed = !0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
|
|
1584
1806
|
let t = this.sender?.destroy();
|
|
1585
|
-
this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, e.pinned() === this && (Reflect.deleteProperty(globalThis,
|
|
1807
|
+
this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, await this.rotation?.catch(() => void 0), await this.memoryStorage?.close(), e.pinned() === this && (Reflect.deleteProperty(globalThis, ir), globalThis[ar] = this);
|
|
1586
1808
|
}
|
|
1587
1809
|
emit(e) {
|
|
1588
|
-
e
|
|
1810
|
+
!e || this.destroyed || this.rotating && !this.closingContext || (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
|
|
1589
1811
|
}
|
|
1590
1812
|
route(e) {
|
|
1591
1813
|
this.role() === "forwarder" ? this.forward(e) : this.deliver(e);
|
|
@@ -1606,19 +1828,26 @@ var Z = class e {
|
|
|
1606
1828
|
this.forwardBuffer = [], e.length > 0 && this.bus?.sendRecords(e);
|
|
1607
1829
|
}
|
|
1608
1830
|
ingestForwarded(e) {
|
|
1609
|
-
if (
|
|
1610
|
-
|
|
1611
|
-
|
|
1831
|
+
if (this.destroyed) return;
|
|
1832
|
+
if (!Array.isArray(e)) {
|
|
1833
|
+
this.diagnostics.count("record.dropped_malformed");
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
let t = [];
|
|
1837
|
+
for (let n of e) {
|
|
1838
|
+
if (!Ne(n)) {
|
|
1612
1839
|
this.diagnostics.count("record.dropped_malformed");
|
|
1613
1840
|
continue;
|
|
1614
1841
|
}
|
|
1615
|
-
if (!
|
|
1842
|
+
if (!Me(n, this.config, this.remote.sampling?.current() ?? null)) {
|
|
1616
1843
|
this.diagnostics.count("record.dropped_by_sampling");
|
|
1617
1844
|
continue;
|
|
1618
1845
|
}
|
|
1619
|
-
let e = this.builder.redactForwarded(
|
|
1620
|
-
e &&
|
|
1846
|
+
let e = this.builder.redactForwarded(n);
|
|
1847
|
+
e && t.push(e);
|
|
1621
1848
|
}
|
|
1849
|
+
if (this.rotating) this.drops.add("security_context", t);
|
|
1850
|
+
else for (let e of t) this.deliver(e);
|
|
1622
1851
|
}
|
|
1623
1852
|
releaseBootBuffer() {
|
|
1624
1853
|
let e = this.bootBuffer.take(), { processors: t, redact: n } = this.config, r = t.length === 0 && n === void 0 ? this.journey.current() : null;
|
|
@@ -1630,24 +1859,117 @@ var Z = class e {
|
|
|
1630
1859
|
reportGap = (e, t) => {
|
|
1631
1860
|
this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
|
|
1632
1861
|
let n = Date.now();
|
|
1633
|
-
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new
|
|
1862
|
+
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, ge).warn("stored records were dropped before delivery", {
|
|
1634
1863
|
"gap.batches": e.batches,
|
|
1635
1864
|
"gap.records": e.records,
|
|
1636
1865
|
"gap.reason": e.reason
|
|
1637
1866
|
}));
|
|
1638
1867
|
};
|
|
1639
1868
|
regenerateTabId() {
|
|
1640
|
-
let e =
|
|
1869
|
+
let e = j(this.diagnostics);
|
|
1641
1870
|
this.diagnostics.report("bus.role_resolved", "Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.", {
|
|
1642
1871
|
was: this.identity.tabId,
|
|
1643
1872
|
now: e
|
|
1644
|
-
}), this.identity.tabId = e,
|
|
1873
|
+
}), this.identity.tabId = e, Ue(e, this.diagnostics, this.stores), this.builder.invalidateResource();
|
|
1645
1874
|
}
|
|
1646
1875
|
newSession() {
|
|
1876
|
+
this.destroyed || this.resetSession(j(this.diagnostics));
|
|
1877
|
+
}
|
|
1878
|
+
resetSession(e) {
|
|
1879
|
+
this.meter.collect(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear(), this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
|
|
1880
|
+
}
|
|
1881
|
+
rotateSecurityContext(e, t = {}) {
|
|
1882
|
+
if (this.rotation) return Promise.reject(/* @__PURE__ */ Error("A security-context rotation is already running."));
|
|
1883
|
+
let n = t.pending ?? "discard", r = t.timeoutMs ?? 5e3;
|
|
1884
|
+
return !O(e) || !O(e.delivery) || ![
|
|
1885
|
+
"discard",
|
|
1886
|
+
"flush",
|
|
1887
|
+
"retain",
|
|
1888
|
+
"carry"
|
|
1889
|
+
].includes(n) || !Number.isFinite(r) || r < 0 || e.id !== void 0 && (typeof e.id != "string" || e.id.length === 0) ? Promise.reject(/* @__PURE__ */ Error("Invalid security-context rotation options.")) : this.destroyed ? Promise.reject(/* @__PURE__ */ Error("The runtime has stopped.")) : (this.rotating = !0, this.rotation = this.rotateContext(e, n, r).finally(() => {
|
|
1890
|
+
this.rotating = !1, this.rotation = void 0;
|
|
1891
|
+
}), this.rotation);
|
|
1892
|
+
}
|
|
1893
|
+
async rotateContext(e, t, n) {
|
|
1894
|
+
if (await this.started, this.role() === "forwarder") throw Error("Rotate the security context on the upstream owner, or use bus.mode: sender for an independent identity.");
|
|
1895
|
+
await this.senderLoad;
|
|
1896
|
+
let r = this.config.securityContext.id, i = e.id ?? j(this.diagnostics);
|
|
1897
|
+
if (i === r) throw Error("A rotation requires a different security-context id.");
|
|
1898
|
+
let a = {
|
|
1899
|
+
...sr,
|
|
1900
|
+
...e.delivery
|
|
1901
|
+
}, o = this.diagnostics.snapshot()["config.invalid"] ?? 0, s = K(this.allowed({
|
|
1902
|
+
...a,
|
|
1903
|
+
securityContext: { id: i }
|
|
1904
|
+
}), this.diagnostics, {
|
|
1905
|
+
...this.config,
|
|
1906
|
+
...sr
|
|
1907
|
+
});
|
|
1908
|
+
if ((this.diagnostics.snapshot()["config.invalid"] ?? 0) !== o) throw Error("Invalid delivery settings for the next security context.");
|
|
1909
|
+
let c = e.context ? Object.fromEntries(Object.entries(e.context)) : void 0, l = /* @__PURE__ */ new Set([
|
|
1910
|
+
this.config.endpoint,
|
|
1911
|
+
this.config.metricsEndpoint,
|
|
1912
|
+
this.config.tracesEndpoint
|
|
1913
|
+
]), u = /* @__PURE__ */ new Set([
|
|
1914
|
+
s.endpoint,
|
|
1915
|
+
s.metricsEndpoint,
|
|
1916
|
+
s.tracesEndpoint
|
|
1917
|
+
]);
|
|
1918
|
+
s.capture.ignoreUrls = s.capture.ignoreUrls.filter((e) => !l.has(e) || u.has(e)), this.closingContext = !0;
|
|
1919
|
+
try {
|
|
1920
|
+
this.meter.collect(), this.tracing.end(), this.journey.end();
|
|
1921
|
+
} finally {
|
|
1922
|
+
this.closingContext = !1;
|
|
1923
|
+
}
|
|
1924
|
+
let d = [
|
|
1925
|
+
...this.bootBuffer.take(),
|
|
1926
|
+
...this.pendingRecords.take(),
|
|
1927
|
+
...this.forwardBuffer
|
|
1928
|
+
];
|
|
1929
|
+
this.forwardBuffer = [];
|
|
1930
|
+
let f = this.sender;
|
|
1931
|
+
this.sender = void 0, this.senderLoad = void 0;
|
|
1932
|
+
let p = await f?.retire(t, n, r) ?? {
|
|
1933
|
+
buffered: [],
|
|
1934
|
+
stored: []
|
|
1935
|
+
};
|
|
1647
1936
|
if (this.destroyed) return;
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1937
|
+
let m = [...d, ...p.buffered], h = p.stored.flatMap((e) => e.records);
|
|
1938
|
+
t !== "retain" && t !== "carry" && this.drops.add("security_context", [...m, ...h]), s.lockConfiguration = this.config.lockConfiguration, Ln(this.config, s), this.remote.sampling = null, this.context.clear(), c && this.context.setMany(c), this.breadcrumbs.clear(), this.newSession(), this.builder.invalidateResource(), await this.syncSender(), this.bus?.rotateContext(), t === "carry" && (this.rotating = !1, await this.carry(m, p.stored)), this.diagnostics.report("security.rotated", "The runtime rotated its security context.", { pending: t });
|
|
1939
|
+
}
|
|
1940
|
+
async carry(e, t) {
|
|
1941
|
+
for (let t of e) this.route(t);
|
|
1942
|
+
this.sender && await this.sender.adopt(t, this.config.securityContext.id);
|
|
1943
|
+
}
|
|
1944
|
+
async health() {
|
|
1945
|
+
let e = this.sender?.stats() ?? {
|
|
1946
|
+
pending: 0,
|
|
1947
|
+
inFlight: 0,
|
|
1948
|
+
lastSendAt: null
|
|
1949
|
+
}, t = [];
|
|
1950
|
+
this.mismatchVersion && t.push("runtime.version_mismatch"), this.contextMismatch && t.push("security.context_mismatch"), this.ready && this.hasDestination() && this.role() === "sender" && !this.sender && t.push("sender.unavailable");
|
|
1951
|
+
let { sourcePolicy: n, validation: r, maxMessageBytes: i, maxRecordsPerMessage: a, maxMessagesPerSecond: o, maxTrackedSources: s } = this.config.bus;
|
|
1952
|
+
return {
|
|
1953
|
+
...e,
|
|
1954
|
+
pending: e.pending + this.bootBuffer.length + this.pendingRecords.length + this.forwardBuffer.length,
|
|
1955
|
+
stored: await this.sender?.queueDepth() ?? 0,
|
|
1956
|
+
sdkVersion: this.sdkVersion,
|
|
1957
|
+
owningSdkVersion: this.mismatchVersion,
|
|
1958
|
+
status: this.destroyed ? "stopped" : this.rotating ? "rotating" : t.length ? "degraded" : this.ready ? "ready" : "starting",
|
|
1959
|
+
mode: this.role() === "forwarder" ? "forwarder" : this.hasDestination() ? "sender" : "console-only",
|
|
1960
|
+
senderReady: this.sender !== void 0 && !this.destroyed && !this.rotating,
|
|
1961
|
+
configurationLocked: this.config.lockConfiguration,
|
|
1962
|
+
issues: t,
|
|
1963
|
+
securityContext: { ...this.config.securityContext },
|
|
1964
|
+
bus: {
|
|
1965
|
+
sourcePolicy: n,
|
|
1966
|
+
validation: r,
|
|
1967
|
+
maxMessageBytes: i,
|
|
1968
|
+
maxRecordsPerMessage: a,
|
|
1969
|
+
maxMessagesPerSecond: o,
|
|
1970
|
+
maxTrackedSources: s
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1651
1973
|
}
|
|
1652
1974
|
async stats() {
|
|
1653
1975
|
let e = await this.queueDepth(), t = this.sender?.stats() ?? {
|
|
@@ -1661,6 +1983,23 @@ var Z = class e {
|
|
|
1661
1983
|
stored: e
|
|
1662
1984
|
};
|
|
1663
1985
|
}
|
|
1986
|
+
async clearPersisted(e) {
|
|
1987
|
+
if (await this.senderLoad, this.sender) {
|
|
1988
|
+
await this.sender.clearPersisted(e, this.config.securityContext.id);
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
let [{ createStorage: t, storageName: n }, { ContextStorage: r }, { storageLimits: i }, { clearEmergencyContext: a }] = await Promise.all([
|
|
1992
|
+
import("./factory-C5TujXlU.js"),
|
|
1993
|
+
import("./context-storage-DxZf4Gfh.js"),
|
|
1994
|
+
import("./storage-w7Tslvlq.js"),
|
|
1995
|
+
import("./emergency-queue-BYUyDHGD.js")
|
|
1996
|
+
]), o = this.config.persistence.namespace, s = this.memoryStorage ?? await t(this.config.storage, n(o), i(this.config.retention), this.diagnostics, void 0, o), c = new r(s, this.config.securityContext, o);
|
|
1997
|
+
try {
|
|
1998
|
+
e === "namespace" ? await c.clearNamespace() : await c.clear(), a(this.config.securityContext.id, this.diagnostics, o, e === "namespace");
|
|
1999
|
+
} finally {
|
|
2000
|
+
s !== this.memoryStorage && await c.close();
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
1664
2003
|
async queueDepth() {
|
|
1665
2004
|
return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
|
|
1666
2005
|
}
|
|
@@ -1668,9 +2007,18 @@ var Z = class e {
|
|
|
1668
2007
|
this.meter.collect(), this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
|
|
1669
2008
|
}
|
|
1670
2009
|
};
|
|
2010
|
+
function Y(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
2011
|
+
if (Object.is(e, t)) return !0;
|
|
2012
|
+
if (e instanceof RegExp && t instanceof RegExp) return String(e) === String(t);
|
|
2013
|
+
if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
|
|
2014
|
+
if (n.has(e)) return n.get(e) === t;
|
|
2015
|
+
n.set(e, t);
|
|
2016
|
+
let r = Object.keys(e), i = Object.keys(t);
|
|
2017
|
+
return r.length === i.length && r.every((r) => Object.hasOwn(t, r) && Y(Reflect.get(e, r), Reflect.get(t, r), n));
|
|
2018
|
+
}
|
|
1671
2019
|
//#endregion
|
|
1672
2020
|
//#region src/transport/memory-transport.ts
|
|
1673
|
-
function
|
|
2021
|
+
function pr() {
|
|
1674
2022
|
let e = [], t = [], n = { status: 200 };
|
|
1675
2023
|
return {
|
|
1676
2024
|
transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
|
|
@@ -1689,119 +2037,150 @@ function tr() {
|
|
|
1689
2037
|
}
|
|
1690
2038
|
//#endregion
|
|
1691
2039
|
//#region src/index.ts
|
|
1692
|
-
var
|
|
1693
|
-
function
|
|
1694
|
-
return (
|
|
2040
|
+
var X = /* @__PURE__ */ new Map();
|
|
2041
|
+
function Z() {
|
|
2042
|
+
return (J.current() ?? J.stopped()) || J.configure({}, !0);
|
|
1695
2043
|
}
|
|
1696
|
-
function
|
|
1697
|
-
Z.
|
|
2044
|
+
function mr(e = "context") {
|
|
2045
|
+
return ["context", "namespace"].includes(e) ? Z().clearPersisted(e) : Promise.reject(/* @__PURE__ */ Error("Invalid persistence scope."));
|
|
2046
|
+
}
|
|
2047
|
+
function hr(e) {
|
|
2048
|
+
J.configure(e), Q();
|
|
2049
|
+
}
|
|
2050
|
+
function gr(e) {
|
|
2051
|
+
Z().setConfigurationLocked(e);
|
|
2052
|
+
}
|
|
2053
|
+
function _r(e, t) {
|
|
2054
|
+
return Z().rotateSecurityContext(e, t);
|
|
2055
|
+
}
|
|
2056
|
+
async function vr() {
|
|
2057
|
+
let e = Z();
|
|
2058
|
+
return Q(), {
|
|
2059
|
+
...await e.health(),
|
|
2060
|
+
loggerCache: {
|
|
2061
|
+
...e.config.loggerCache,
|
|
2062
|
+
size: X.size
|
|
2063
|
+
}
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
function Q() {
|
|
2067
|
+
let e = (J.current() ?? J.stopped())?.config.loggerCache.maxEntries, t = e === void 0 ? 256 : e;
|
|
2068
|
+
if (t !== null) for (let e of X.keys()) {
|
|
2069
|
+
if (X.size <= t) break;
|
|
2070
|
+
X.delete(e);
|
|
2071
|
+
}
|
|
2072
|
+
return t;
|
|
1698
2073
|
}
|
|
1699
|
-
function
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
2074
|
+
function yr(e, t) {
|
|
2075
|
+
let n = Q();
|
|
2076
|
+
if (t || n === 0) return new F(Z, e, t);
|
|
2077
|
+
let r = X.get(e);
|
|
2078
|
+
return r ??= new F(Z, e), X.delete(e), X.set(e, r), Q(), r;
|
|
1703
2079
|
}
|
|
1704
2080
|
function $() {
|
|
1705
|
-
return
|
|
2081
|
+
return yr("app");
|
|
1706
2082
|
}
|
|
1707
|
-
function
|
|
2083
|
+
function br(e, t) {
|
|
1708
2084
|
$().trace(e, t);
|
|
1709
2085
|
}
|
|
1710
|
-
function
|
|
2086
|
+
function xr(e, t) {
|
|
1711
2087
|
$().debug(e, t);
|
|
1712
2088
|
}
|
|
1713
|
-
function
|
|
2089
|
+
function Sr(e, t) {
|
|
1714
2090
|
$().info(e, t);
|
|
1715
2091
|
}
|
|
1716
|
-
function
|
|
2092
|
+
function Cr(e, t) {
|
|
1717
2093
|
$().warn(e, t);
|
|
1718
2094
|
}
|
|
1719
|
-
function
|
|
2095
|
+
function wr(e, t, n) {
|
|
1720
2096
|
$().error(e, t, n);
|
|
1721
2097
|
}
|
|
1722
|
-
function
|
|
2098
|
+
function Tr(e, t, n) {
|
|
1723
2099
|
$().fatal(e, t, n);
|
|
1724
2100
|
}
|
|
1725
|
-
function
|
|
2101
|
+
function Er(e, t) {
|
|
1726
2102
|
$().logAction(e, t);
|
|
1727
2103
|
}
|
|
1728
|
-
function
|
|
2104
|
+
function Dr(e, t) {
|
|
1729
2105
|
$().logEvent(e, t);
|
|
1730
2106
|
}
|
|
1731
|
-
function
|
|
2107
|
+
function Or(e, t, n, r, i) {
|
|
1732
2108
|
$().logMetric(e, t, n, r, i);
|
|
1733
2109
|
}
|
|
1734
|
-
function
|
|
1735
|
-
return
|
|
1736
|
-
|
|
2110
|
+
function kr(e, t = {}) {
|
|
2111
|
+
return vt(e, t, (e, t, n) => {
|
|
2112
|
+
Z().recordMetric(e, t, n);
|
|
1737
2113
|
});
|
|
1738
2114
|
}
|
|
1739
|
-
function
|
|
1740
|
-
return
|
|
1741
|
-
|
|
2115
|
+
function Ar(e, t = {}) {
|
|
2116
|
+
return yt(e, t, (e, t, n) => {
|
|
2117
|
+
Z().recordMetric(e, t, n);
|
|
1742
2118
|
});
|
|
1743
2119
|
}
|
|
1744
|
-
function
|
|
2120
|
+
function jr(e, t, n) {
|
|
1745
2121
|
return $().timeSync(e, t, n);
|
|
1746
2122
|
}
|
|
1747
|
-
function
|
|
2123
|
+
function Mr(e, t, n) {
|
|
1748
2124
|
return $().timeAsync(e, t, n);
|
|
1749
2125
|
}
|
|
1750
|
-
function
|
|
1751
|
-
|
|
2126
|
+
function Nr(e, t) {
|
|
2127
|
+
Z().addBreadcrumb(e, t);
|
|
1752
2128
|
}
|
|
1753
|
-
function
|
|
1754
|
-
|
|
2129
|
+
function Pr(e, t) {
|
|
2130
|
+
Z().context.set(e, t);
|
|
1755
2131
|
}
|
|
1756
|
-
function
|
|
1757
|
-
|
|
2132
|
+
function Fr(e) {
|
|
2133
|
+
Z().context.setMany(e);
|
|
1758
2134
|
}
|
|
1759
|
-
function
|
|
1760
|
-
|
|
2135
|
+
function Ir(e) {
|
|
2136
|
+
Z().context.remove(e);
|
|
1761
2137
|
}
|
|
1762
|
-
function
|
|
1763
|
-
return
|
|
2138
|
+
function Lr(e, t) {
|
|
2139
|
+
return Z().journey.start(e, t);
|
|
2140
|
+
}
|
|
2141
|
+
function Rr() {
|
|
2142
|
+
Z().journey.end();
|
|
1764
2143
|
}
|
|
1765
|
-
function
|
|
1766
|
-
|
|
2144
|
+
function zr() {
|
|
2145
|
+
return Z().journey.current();
|
|
1767
2146
|
}
|
|
1768
|
-
function
|
|
1769
|
-
return
|
|
2147
|
+
function Br() {
|
|
2148
|
+
return Z().journey.getToken();
|
|
1770
2149
|
}
|
|
1771
|
-
function
|
|
1772
|
-
return
|
|
2150
|
+
function Vr(e) {
|
|
2151
|
+
return Z().journey.adopt(e, "manual", !0);
|
|
1773
2152
|
}
|
|
1774
|
-
function
|
|
1775
|
-
return
|
|
2153
|
+
function Hr(e, t) {
|
|
2154
|
+
return Z().registerWorker(e, t);
|
|
1776
2155
|
}
|
|
1777
|
-
function
|
|
1778
|
-
|
|
2156
|
+
function Ur(e, t) {
|
|
2157
|
+
return Z().registerFrame(e, t);
|
|
1779
2158
|
}
|
|
1780
|
-
function
|
|
1781
|
-
|
|
2159
|
+
function Wr() {
|
|
2160
|
+
Z().tracing.rotate("explicit");
|
|
1782
2161
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return
|
|
2162
|
+
function Gr() {
|
|
2163
|
+
return Z().tracing.headers();
|
|
1785
2164
|
}
|
|
1786
|
-
function
|
|
1787
|
-
return
|
|
2165
|
+
function Kr() {
|
|
2166
|
+
return Z().flush();
|
|
1788
2167
|
}
|
|
1789
|
-
function
|
|
1790
|
-
return
|
|
2168
|
+
function qr() {
|
|
2169
|
+
return Z().queueDepth();
|
|
1791
2170
|
}
|
|
1792
|
-
function
|
|
1793
|
-
return
|
|
2171
|
+
function Jr() {
|
|
2172
|
+
return Z().stats();
|
|
1794
2173
|
}
|
|
1795
|
-
function
|
|
1796
|
-
|
|
2174
|
+
function Yr() {
|
|
2175
|
+
Z().newSession();
|
|
1797
2176
|
}
|
|
1798
|
-
function
|
|
1799
|
-
return
|
|
2177
|
+
function Xr() {
|
|
2178
|
+
return Z().diagnostics.snapshot();
|
|
1800
2179
|
}
|
|
1801
|
-
async function
|
|
1802
|
-
await
|
|
2180
|
+
async function Zr() {
|
|
2181
|
+
await J.current()?.destroy();
|
|
1803
2182
|
}
|
|
1804
2183
|
//#endregion
|
|
1805
|
-
export {
|
|
2184
|
+
export { F as OneLogger, Nr as addBreadcrumb, Vr as adoptJourney, mr as clearPersistedLogs, hr as configure, kr as counter, pr as createMemoryTransport, zr as currentJourney, xr as debug, Rr as endJourney, wr as error, Tr as fatal, Kr as flush, Xr as getDiagnosticCounters, vr as getHealth, Br as getJourneyToken, yr as getLogger, qr as getQueueDepth, Jr as getStats, Gr as getTraceHeaders, Ar as histogram, Sr as info, Er as logAction, Dr as logEvent, Or as logMetric, Yr as newSession, Ur as registerFrame, Hr as registerWorker, Ir as removeContext, _r as rotateSecurityContext, gr as setConfigurationLocked, Pr as setContext, Fr as setContextMap, Zr as shutdown, Lr as startJourney, Wr as startTrace, Mr as timeAsync, jr as timeSync, br as trace, Cr as warn };
|
|
1806
2185
|
|
|
1807
2186
|
//# sourceMappingURL=index.js.map
|