@utk09/ui-observability 0.9.1 → 0.9.3
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 +33 -0
- package/README.md +75 -64
- package/dist/batch-D5qvsMQ_.cjs +2 -0
- package/dist/batch-D5qvsMQ_.cjs.map +1 -0
- package/dist/{batch-DEK4bv9N.js → batch-DDgxg16_.js} +7 -4
- package/dist/batch-DDgxg16_.js.map +1 -0
- package/dist/bus/bus.d.ts +0 -4
- package/dist/{bus-HVQ8E72V.js → bus-C6RwKzPW.js} +63 -66
- package/dist/bus-C6RwKzPW.js.map +1 -0
- package/dist/bus-WPVDFw2y.cjs +2 -0
- package/dist/bus-WPVDFw2y.cjs.map +1 -0
- package/dist/capture/network.d.ts +2 -0
- package/dist/capture/storm.d.ts +2 -7
- package/dist/capture/types.d.ts +3 -0
- package/dist/{console-DssDxq1B.cjs → console-BSusX_M-.cjs} +2 -2
- package/dist/{console-DssDxq1B.cjs.map → console-BSusX_M-.cjs.map} +1 -1
- package/dist/{console-C9Y639mn.js → console-Dv5GfaNn.js} +3 -3
- package/dist/{console-C9Y639mn.js.map → console-Dv5GfaNn.js.map} +1 -1
- package/dist/constants-Cb92egPS.cjs +2 -0
- package/dist/constants-Cb92egPS.cjs.map +1 -0
- package/dist/{constants-N99w84xy.js → constants-DhH6VI5a.js} +39 -12
- package/dist/constants-DhH6VI5a.js.map +1 -0
- package/dist/constants.d.ts +28 -3
- package/dist/core/breadcrumbs.d.ts +1 -3
- package/dist/core/context.d.ts +0 -8
- package/dist/core/diagnostics.d.ts +1 -3
- package/dist/core/meter.d.ts +45 -0
- package/dist/core/pipeline.d.ts +5 -12
- package/dist/core/record.d.ts +7 -0
- package/dist/core/runtime.d.ts +17 -0
- package/dist/core/sampling.d.ts +3 -3
- package/dist/core/sender.d.ts +2 -0
- package/dist/deadline-CUrH0Hd8.cjs +2 -0
- package/dist/deadline-CUrH0Hd8.cjs.map +1 -0
- package/dist/deadline-DeqXEliN.js +31 -0
- package/dist/deadline-DeqXEliN.js.map +1 -0
- package/dist/{errors-CQusIGWJ.js → errors-DCZWcHkd.js} +4 -4
- package/dist/{errors-CQusIGWJ.js.map → errors-DCZWcHkd.js.map} +1 -1
- package/dist/{errors-BTWuVnHZ.cjs → errors-ERu-su8m.cjs} +3 -3
- package/dist/{errors-BTWuVnHZ.cjs.map → errors-ERu-su8m.cjs.map} +1 -1
- package/dist/fixed-window-BR0bu32Y.cjs +2 -0
- package/dist/fixed-window-BR0bu32Y.cjs.map +1 -0
- package/dist/fixed-window-Re7jIRJH.js +9 -0
- package/dist/fixed-window-Re7jIRJH.js.map +1 -0
- package/dist/{identity-B1GDS1Tb.cjs → identity-C1WLItSl.cjs} +2 -2
- package/dist/{identity-B1GDS1Tb.cjs.map → identity-C1WLItSl.cjs.map} +1 -1
- package/dist/{identity-D4DPjTM9.js → identity-Di-QXGCC.js} +2 -2
- package/dist/{identity-D4DPjTM9.js.map → identity-Di-QXGCC.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +522 -369
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-DX18p39D.cjs +2 -0
- package/dist/indexeddb-storage-DX18p39D.cjs.map +1 -0
- package/dist/{indexeddb-storage-B8SGUzSV.js → indexeddb-storage-T9YIYVYC.js} +48 -59
- package/dist/indexeddb-storage-T9YIYVYC.js.map +1 -0
- package/dist/{interactions-CnjfQgw3.js → interactions-BLH_tX87.js} +2 -2
- package/dist/{interactions-CnjfQgw3.js.map → interactions-BLH_tX87.js.map} +1 -1
- package/dist/{interactions-CcxrVzpg.cjs → interactions-_hfOerfC.cjs} +2 -2
- package/dist/{interactions-CcxrVzpg.cjs.map → interactions-_hfOerfC.cjs.map} +1 -1
- package/dist/journey-BRUj0hqD.cjs +2 -0
- package/dist/journey-BRUj0hqD.cjs.map +1 -0
- package/dist/{journey-DjvDzHyp.js → journey-yALMEWF7.js} +39 -38
- package/dist/journey-yALMEWF7.js.map +1 -0
- package/dist/library-request-BcAxuwsf.cjs +2 -0
- package/dist/library-request-BcAxuwsf.cjs.map +1 -0
- package/dist/library-request-CQD4HUiP.js +25 -0
- package/dist/library-request-CQD4HUiP.js.map +1 -0
- package/dist/{long-frames-BGik_Yhy.cjs → long-frames-D4Bm3Zkz.cjs} +2 -2
- package/dist/{long-frames-BGik_Yhy.cjs.map → long-frames-D4Bm3Zkz.cjs.map} +1 -1
- package/dist/{long-frames-CZk3XOkH.js → long-frames-DD_Um9_4.js} +3 -3
- package/dist/{long-frames-CZk3XOkH.js.map → long-frames-DD_Um9_4.js.map} +1 -1
- package/dist/models/batch.d.ts +6 -0
- package/dist/models/config.d.ts +23 -0
- package/dist/models/metric.d.ts +50 -0
- package/dist/network--GoE7_Or.js +211 -0
- package/dist/network--GoE7_Or.js.map +1 -0
- package/dist/network-DcuS2H1P.cjs +2 -0
- package/dist/network-DcuS2H1P.cjs.map +1 -0
- package/dist/openfin-BwEN0uj4.js +8 -0
- package/dist/openfin-BwEN0uj4.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs +2 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -0
- package/dist/platform-GaM6h7XM.js +52 -0
- package/dist/platform-GaM6h7XM.js.map +1 -0
- package/dist/platform-kIL5AZB7.cjs +2 -0
- package/dist/platform-kIL5AZB7.cjs.map +1 -0
- package/dist/{remote-rules-M-XZ1xbe.js → remote-rules-6ePq8CrI.js} +23 -25
- package/dist/remote-rules-6ePq8CrI.js.map +1 -0
- package/dist/remote-rules-CI3gbRCL.cjs +2 -0
- package/dist/remote-rules-CI3gbRCL.cjs.map +1 -0
- package/dist/sampling-C-M8p3FK.cjs +2 -0
- package/dist/sampling-C-M8p3FK.cjs.map +1 -0
- package/dist/sampling-Ud_WiuU9.js +65 -0
- package/dist/sampling-Ud_WiuU9.js.map +1 -0
- package/dist/{sanitize-DKp5MRsa.cjs → sanitize--_e4oOPX.cjs} +2 -2
- package/dist/{sanitize-DKp5MRsa.cjs.map → sanitize--_e4oOPX.cjs.map} +1 -1
- package/dist/{sanitize-Dwj9JCkI.js → sanitize-DP0xDPrt.js} +2 -2
- package/dist/{sanitize-Dwj9JCkI.js.map → sanitize-DP0xDPrt.js.map} +1 -1
- package/dist/sender-BESHz6my.cjs +3 -0
- package/dist/sender-BESHz6my.cjs.map +1 -0
- package/dist/{sender-BBY0IcUo.js → sender-BUBWLn5i.js} +425 -290
- package/dist/sender-BUBWLn5i.js.map +1 -0
- package/dist/storage/gap.d.ts +20 -0
- package/dist/storage/indexeddb-storage.d.ts +1 -7
- package/dist/storage/keys.d.ts +9 -0
- package/dist/storage/local-storage.d.ts +0 -6
- package/dist/storage/memory-storage.d.ts +1 -1
- package/dist/storm-DhHGHhOc.cjs +2 -0
- package/dist/storm-DhHGHhOc.cjs.map +1 -0
- package/dist/storm-OD5J6Ylm.js +10 -0
- package/dist/storm-OD5J6Ylm.js.map +1 -0
- package/dist/transport/custom-transport.d.ts +3 -2
- package/dist/transport/exit-flush.d.ts +13 -2
- package/dist/transport/http-transport.d.ts +6 -4
- package/dist/transport/retry-engine.d.ts +3 -1
- package/dist/transport/serializers/otlp-metrics.d.ts +3 -0
- package/dist/transport/serializers/otlp.d.ts +30 -0
- package/dist/transport/serializers/select.d.ts +20 -4
- package/dist/transport/status-transport.d.ts +19 -11
- package/dist/utils/fixed-window.d.ts +15 -0
- package/dist/utils/guards.d.ts +6 -0
- package/dist/utils/library-request.d.ts +12 -0
- package/dist/utils/openfin.d.ts +48 -0
- package/dist/utils/platform.d.ts +5 -0
- package/package.json +2 -3
- package/dist/batch-DEK4bv9N.js.map +0 -1
- package/dist/batch-DEVFs28i.cjs +0 -2
- package/dist/batch-DEVFs28i.cjs.map +0 -1
- package/dist/bus-DNFvTkif.cjs +0 -2
- package/dist/bus-DNFvTkif.cjs.map +0 -1
- package/dist/bus-HVQ8E72V.js.map +0 -1
- package/dist/constants-N99w84xy.js.map +0 -1
- package/dist/constants-X86IDwkC.cjs +0 -2
- package/dist/constants-X86IDwkC.cjs.map +0 -1
- package/dist/deadline-5_PecIl5.js +0 -26
- package/dist/deadline-5_PecIl5.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/indexeddb-storage-B8SGUzSV.js.map +0 -1
- package/dist/indexeddb-storage-ukzC82dm.cjs +0 -2
- package/dist/indexeddb-storage-ukzC82dm.cjs.map +0 -1
- package/dist/journey-DjvDzHyp.js.map +0 -1
- package/dist/journey-DxlfdFJV.cjs +0 -2
- package/dist/journey-DxlfdFJV.cjs.map +0 -1
- package/dist/library-request-BZ1ekVtl.cjs +0 -2
- package/dist/library-request-BZ1ekVtl.cjs.map +0 -1
- package/dist/library-request-C8kc5YWv.js +0 -14
- package/dist/library-request-C8kc5YWv.js.map +0 -1
- package/dist/network-51iicpLl.js +0 -174
- package/dist/network-51iicpLl.js.map +0 -1
- package/dist/network-jBbjyAJP.cjs +0 -2
- package/dist/network-jBbjyAJP.cjs.map +0 -1
- package/dist/platform-Cjts-8k8.js +0 -48
- package/dist/platform-Cjts-8k8.js.map +0 -1
- package/dist/platform-DW3GFIUE.cjs +0 -2
- package/dist/platform-DW3GFIUE.cjs.map +0 -1
- package/dist/remote-rules-ByS34k4e.cjs +0 -2
- package/dist/remote-rules-ByS34k4e.cjs.map +0 -1
- package/dist/remote-rules-M-XZ1xbe.js.map +0 -1
- package/dist/sampling-BN3Oi6SV.js +0 -63
- package/dist/sampling-BN3Oi6SV.js.map +0 -1
- package/dist/sampling-b2ck5X98.cjs +0 -2
- package/dist/sampling-b2ck5X98.cjs.map +0 -1
- package/dist/sender-BBY0IcUo.js.map +0 -1
- package/dist/sender-BXoAZKum.cjs +0 -3
- package/dist/sender-BXoAZKum.cjs.map +0 -1
- package/dist/storm-CKuaBp7i.cjs +0 -2
- package/dist/storm-CKuaBp7i.cjs.map +0 -1
- package/dist/storm-DhtL2eVr.js +0 -10
- package/dist/storm-DhtL2eVr.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import { A as e,
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import { n as Be,
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { A as e, At as t, Bt as n, Cn as r, D as i, F as a, Ft as o, Gt as s, Ht as c, I as l, It as u, Kt as d, L as f, Lt as p, Qt as m, Rt as h, S as g, Sn as _, Ut as ee, Vt as te, Wt as ne, Zt as re, _n as ie, _t as ae, a as v, c as y, d as b, en as x, f as oe, ft as se, gn as S, hn as ce, i as le, in as ue, j as de, k as C, l as fe, lt as pe, m as me, mn as he, n as w, o as ge, p as T, qt as _e, r as ve, s as E, sn as ye, u as D, ut as O, vn as be, vt as k, xn as xe, yt as Se, z as Ce, zt as we } from "./constants-DhH6VI5a.js";
|
|
2
|
+
import { n as Te, r as Ee, t as De } from "./error-like-Ywo5uRHo.js";
|
|
3
|
+
import { i as Oe, r as ke } from "./deadline-DeqXEliN.js";
|
|
4
|
+
import { a as Ae, i as je, n as Me, o as Ne, r as Pe } from "./sampling-Ud_WiuU9.js";
|
|
5
|
+
import { a as Fe, i as Ie, n as Le, o as A, r as j } from "./sanitize-DP0xDPrt.js";
|
|
6
|
+
import { a as Re, i as ze, n as Be, o as Ve, r as He, s as Ue, t as We } from "./identity-Di-QXGCC.js";
|
|
7
|
+
import { i as Ge, n as Ke, t as qe } from "./platform-GaM6h7XM.js";
|
|
8
|
+
import { r as M, t as Je } from "./batch-DDgxg16_.js";
|
|
9
|
+
import { r as Ye } from "./library-request-CQD4HUiP.js";
|
|
10
|
+
import { n as Xe, t as Ze } from "./journey-yALMEWF7.js";
|
|
10
11
|
//#region src/utils/timer.ts
|
|
11
|
-
function
|
|
12
|
-
return Math.round((performance.now() - e) *
|
|
12
|
+
function N(e) {
|
|
13
|
+
return Math.round((performance.now() - e) * Ce) / Ce;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function P(e, t, n, r, i) {
|
|
15
16
|
e.logMetric(`${t}.duration`, n, "ms", "histogram", {
|
|
16
17
|
status: r,
|
|
17
18
|
...i
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
let a =
|
|
21
|
+
function Qe(e, t, n, r, i) {
|
|
22
|
+
let a = N(n);
|
|
22
23
|
e.error(`${t} failed`, r, {
|
|
23
24
|
"action.duration_ms": a,
|
|
24
25
|
status: "FAILURE",
|
|
25
26
|
...i
|
|
26
|
-
}),
|
|
27
|
+
}), P(e, t, a, "FAILURE", i);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function $e(e, t, n, r) {
|
|
29
30
|
let i = performance.now();
|
|
30
31
|
try {
|
|
31
32
|
let a = n();
|
|
32
|
-
return
|
|
33
|
+
return P(e, t, N(i), "SUCCESS", r), a;
|
|
33
34
|
} catch (n) {
|
|
34
|
-
throw
|
|
35
|
+
throw Qe(e, t, i, n, r), n;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
async function
|
|
38
|
+
async function et(e, t, n, r) {
|
|
38
39
|
let i = performance.now();
|
|
39
40
|
try {
|
|
40
41
|
let a = await n();
|
|
41
|
-
return
|
|
42
|
+
return P(e, t, N(i), "SUCCESS", r), a;
|
|
42
43
|
} catch (n) {
|
|
43
|
-
throw
|
|
44
|
+
throw Qe(e, t, i, n, r), n;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region src/core/logger.ts
|
|
48
|
-
var
|
|
49
|
-
function
|
|
49
|
+
var tt = [i, ye];
|
|
50
|
+
function nt(e, t) {
|
|
50
51
|
let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
|
|
51
|
-
if (!(e instanceof Error) && !
|
|
52
|
+
if (!(e instanceof Error) && !Ee(e)) return;
|
|
52
53
|
let t = Error(e.message);
|
|
53
54
|
return t.name = e.name, t.stack = e.stack, t;
|
|
54
55
|
});
|
|
@@ -56,38 +57,38 @@ function Ze(e, t) {
|
|
|
56
57
|
let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
|
|
57
58
|
return Error(r ?? typeof e);
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function rt(e, t, n) {
|
|
60
61
|
return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function it(e, t) {
|
|
63
64
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
|
|
64
65
|
if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
|
|
65
|
-
let t = e, n =
|
|
66
|
+
let t = e, n = Ee(e), r = {}, i = 0;
|
|
66
67
|
for (let e of Object.keys(t)) {
|
|
67
68
|
let a = t[e];
|
|
68
|
-
(!n || !
|
|
69
|
+
(!n || !De.has(e)) && Te(a) && (r[e] = a, i++);
|
|
69
70
|
}
|
|
70
71
|
return i === 0 ? void 0 : r;
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
if (
|
|
74
|
+
function at(e) {
|
|
75
|
+
if (!Oe(e) || e instanceof Error) return !1;
|
|
75
76
|
let t = Object.getPrototypeOf(e);
|
|
76
77
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
79
|
+
function ot(e) {
|
|
80
|
+
return tt.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function F(e, t) {
|
|
82
83
|
return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
|
|
83
84
|
}
|
|
84
|
-
var
|
|
85
|
+
var I = class e {
|
|
85
86
|
bind;
|
|
86
87
|
namespace;
|
|
87
88
|
options;
|
|
88
89
|
levelType;
|
|
89
90
|
constructor(e, t, n = {}) {
|
|
90
|
-
this.bind = e, this.namespace = t, this.options = n, this.levelType =
|
|
91
|
+
this.bind = e, this.namespace = t, this.options = n, this.levelType = ot(t);
|
|
91
92
|
}
|
|
92
93
|
child(t, n = {}) {
|
|
93
94
|
return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
|
|
@@ -119,22 +120,23 @@ var F = class e {
|
|
|
119
120
|
logEvent = (e, t) => {
|
|
120
121
|
this.write("INFO", "event", e, t);
|
|
121
122
|
};
|
|
122
|
-
logMetric = (e, t, n =
|
|
123
|
+
logMetric = (e, t, n = l, r = "gauge", i) => {
|
|
123
124
|
if (!Number.isFinite(t)) {
|
|
124
125
|
this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
|
-
let o = {
|
|
128
|
-
...
|
|
128
|
+
let a = F(i, this.bind().diagnostics), o = {
|
|
129
|
+
...a,
|
|
129
130
|
"metric.name": e,
|
|
130
131
|
"metric.value": t,
|
|
131
132
|
"metric.unit": n,
|
|
132
|
-
"metric.type": r
|
|
133
|
+
"metric.type": r,
|
|
134
|
+
[k.attributeKeys]: Object.keys(a)
|
|
133
135
|
};
|
|
134
136
|
this.write("INFO", "metric", e, o, !0);
|
|
135
137
|
};
|
|
136
|
-
timeSync = (e, t, n) =>
|
|
137
|
-
timeAsync = (e, t, n) =>
|
|
138
|
+
timeSync = (e, t, n) => $e(this, e, t, n);
|
|
139
|
+
timeAsync = (e, t, n) => et(this, e, t, n);
|
|
138
140
|
write(e, t, n, r, i = !1) {
|
|
139
141
|
let a = this.bind();
|
|
140
142
|
if (a.isDestroyed()) return;
|
|
@@ -148,7 +150,7 @@ var F = class e {
|
|
|
148
150
|
body: n,
|
|
149
151
|
namespace: this.namespace,
|
|
150
152
|
scoped: this.options.scopedContext,
|
|
151
|
-
payload: i ? r :
|
|
153
|
+
payload: i ? r : F(r, a.diagnostics)
|
|
152
154
|
}), c = o ? o.body : s === "sampling" ? n : void 0;
|
|
153
155
|
t !== "metric" && c !== void 0 && a.breadcrumbs.push({
|
|
154
156
|
t: Date.now(),
|
|
@@ -161,26 +163,26 @@ var F = class e {
|
|
|
161
163
|
if (i.isDestroyed()) return;
|
|
162
164
|
let a = i.builder.isEnabled(e);
|
|
163
165
|
if (!a && !this.mirrors(i, e)) return;
|
|
164
|
-
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () =>
|
|
166
|
+
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => at(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : nt(c, i.diagnostics), u = l === void 0 ? void 0 : rt(c, l, i.diagnostics);
|
|
165
167
|
if (!a) {
|
|
166
168
|
this.print(i, e, t, s, u, null);
|
|
167
169
|
return;
|
|
168
170
|
}
|
|
169
|
-
let d = l ?
|
|
171
|
+
let d = l ? it(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
|
|
170
172
|
level: e,
|
|
171
173
|
type: this.levelType,
|
|
172
174
|
body: t,
|
|
173
175
|
namespace: this.namespace,
|
|
174
176
|
scoped: this.options.scopedContext,
|
|
175
177
|
payload: {
|
|
176
|
-
...
|
|
178
|
+
...F(s, i.diagnostics),
|
|
177
179
|
...l ? {
|
|
178
180
|
"error.type": l.name,
|
|
179
181
|
"error.message": l.message,
|
|
180
182
|
"error.stack_trace": l.stack
|
|
181
183
|
} : {},
|
|
182
|
-
...d === void 0 ? {} : { [
|
|
183
|
-
[
|
|
184
|
+
...d === void 0 ? {} : { [ge]: d },
|
|
185
|
+
[v]: i.breadcrumbs.snapshot()
|
|
184
186
|
}
|
|
185
187
|
});
|
|
186
188
|
this.print(i, e, t, s, u, f, p), i.emit(f);
|
|
@@ -191,73 +193,73 @@ var F = class e {
|
|
|
191
193
|
mirrors(e, t) {
|
|
192
194
|
return e.config.enabled && e.console.accepts(t);
|
|
193
195
|
}
|
|
194
|
-
},
|
|
196
|
+
}, st = {
|
|
195
197
|
TRACE: "debug",
|
|
196
198
|
DEBUG: "debug",
|
|
197
199
|
INFO: "info",
|
|
198
200
|
WARN: "warn",
|
|
199
201
|
ERROR: "error",
|
|
200
202
|
FATAL: "error"
|
|
201
|
-
},
|
|
203
|
+
}, ct = class {
|
|
202
204
|
settings;
|
|
203
205
|
diagnostics;
|
|
204
206
|
limits;
|
|
205
|
-
constructor(e,
|
|
206
|
-
this.settings = e, this.diagnostics =
|
|
207
|
+
constructor(e, n, r = t) {
|
|
208
|
+
this.settings = e, this.diagnostics = n, this.limits = r;
|
|
207
209
|
}
|
|
208
210
|
update(e) {
|
|
209
211
|
this.settings = e;
|
|
210
212
|
}
|
|
211
213
|
accepts(e) {
|
|
212
|
-
return this.settings.level === null || !Object.hasOwn(
|
|
214
|
+
return this.settings.level === null || !Object.hasOwn(O, this.settings.level) ? !1 : O[e] >= O[this.settings.level];
|
|
213
215
|
}
|
|
214
216
|
write(e, t, n, r, i) {
|
|
215
|
-
if (!this.accepts(t) || typeof console > "u" ||
|
|
216
|
-
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s =
|
|
217
|
+
if (!this.accepts(t) || typeof console > "u" || Fe()) return;
|
|
218
|
+
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = st[t];
|
|
217
219
|
this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
|
|
218
220
|
let c = [];
|
|
219
|
-
i !== void 0 && c.push(i), r !== void 0 && c.push(
|
|
221
|
+
i !== void 0 && c.push(i), r !== void 0 && c.push(Le(r, this.limits, this.diagnostics)), A(() => {
|
|
220
222
|
console[s](a, o.namespace, e, o[t], "", n, ...c);
|
|
221
223
|
});
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
|
-
},
|
|
226
|
+
}, lt = class {
|
|
225
227
|
value = 0;
|
|
226
228
|
next() {
|
|
227
229
|
return ++this.value;
|
|
228
230
|
}
|
|
229
|
-
},
|
|
230
|
-
function
|
|
231
|
-
return
|
|
231
|
+
}, ut = /^[0-9a-f]{32}$/, dt = /^[0-9a-f]{16}$/, ft = /[1-9a-f]/;
|
|
232
|
+
function pt(e) {
|
|
233
|
+
return ut.test(e.traceId) && ft.test(e.traceId) && dt.test(e.spanId) && ft.test(e.spanId);
|
|
232
234
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
235
|
+
function mt() {
|
|
236
|
+
return Ve(16);
|
|
235
237
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
238
|
+
function ht() {
|
|
239
|
+
return Ve(8);
|
|
238
240
|
}
|
|
239
|
-
function
|
|
241
|
+
function gt() {
|
|
240
242
|
return {
|
|
241
|
-
traceId:
|
|
242
|
-
spanId:
|
|
243
|
+
traceId: mt(),
|
|
244
|
+
spanId: ht(),
|
|
243
245
|
traceFlags: 1,
|
|
244
246
|
startedAt: Date.now()
|
|
245
247
|
};
|
|
246
248
|
}
|
|
247
|
-
function
|
|
249
|
+
function _t(e) {
|
|
248
250
|
return {
|
|
249
251
|
traceId: e.traceId,
|
|
250
252
|
spanId: e.spanId,
|
|
251
253
|
traceFlags: e.traceFlags
|
|
252
254
|
};
|
|
253
255
|
}
|
|
254
|
-
var
|
|
256
|
+
var vt = class {
|
|
255
257
|
diagnostics;
|
|
256
258
|
maxAgeMs;
|
|
257
259
|
load;
|
|
258
|
-
ambient =
|
|
260
|
+
ambient = gt();
|
|
259
261
|
otel;
|
|
260
|
-
constructor(e, t =
|
|
262
|
+
constructor(e, t = be, n) {
|
|
261
263
|
this.diagnostics = e, this.maxAgeMs = t, this.load = n;
|
|
262
264
|
}
|
|
263
265
|
async loadOtel() {
|
|
@@ -269,7 +271,7 @@ var pt = class {
|
|
|
269
271
|
}
|
|
270
272
|
resolve() {
|
|
271
273
|
let e = this.activeSpanContext();
|
|
272
|
-
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"),
|
|
274
|
+
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), _t(this.ambient)) : e;
|
|
273
275
|
}
|
|
274
276
|
activeSpanContext() {
|
|
275
277
|
let e = this.otel;
|
|
@@ -277,7 +279,7 @@ var pt = class {
|
|
|
277
279
|
let t = e.trace.getActiveSpan();
|
|
278
280
|
if (t === void 0) return;
|
|
279
281
|
let n = t.spanContext();
|
|
280
|
-
if (
|
|
282
|
+
if (pt(n)) return {
|
|
281
283
|
traceId: n.traceId,
|
|
282
284
|
spanId: n.spanId,
|
|
283
285
|
traceFlags: n.traceFlags
|
|
@@ -285,7 +287,7 @@ var pt = class {
|
|
|
285
287
|
});
|
|
286
288
|
}
|
|
287
289
|
rotate(e) {
|
|
288
|
-
return this.ambient =
|
|
290
|
+
return this.ambient = gt(), _t(this.ambient);
|
|
289
291
|
}
|
|
290
292
|
headers() {
|
|
291
293
|
let e = {}, t = this.otel;
|
|
@@ -293,11 +295,11 @@ var pt = class {
|
|
|
293
295
|
t.propagation.inject(t.context.active(), e);
|
|
294
296
|
}), !e.traceparent) {
|
|
295
297
|
let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
|
|
296
|
-
e[
|
|
298
|
+
e[ie] = `00-${t.traceId}-${t.spanId}-${n}`;
|
|
297
299
|
}
|
|
298
300
|
return e;
|
|
299
301
|
}
|
|
300
|
-
},
|
|
302
|
+
}, yt = class {
|
|
301
303
|
buffer;
|
|
302
304
|
pointer = 0;
|
|
303
305
|
filled = !1;
|
|
@@ -311,48 +313,45 @@ var pt = class {
|
|
|
311
313
|
snapshot() {
|
|
312
314
|
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);
|
|
313
315
|
}
|
|
314
|
-
|
|
315
|
-
this.buffer = Array(this.capacity), this.pointer = 0, this.filled = !1;
|
|
316
|
-
}
|
|
317
|
-
}, ht = Object.keys(C), gt = ["gzip", "none"], _t = [
|
|
316
|
+
}, bt = Object.keys(O), xt = ["gzip", "none"], St = [
|
|
318
317
|
"omit",
|
|
319
318
|
"same-origin",
|
|
320
319
|
"include"
|
|
321
|
-
],
|
|
320
|
+
], Ct = [
|
|
322
321
|
"auto",
|
|
323
322
|
"indexeddb",
|
|
324
323
|
"localstorage",
|
|
325
324
|
"memory",
|
|
326
325
|
"none"
|
|
327
|
-
],
|
|
326
|
+
], wt = ["storage", "memory"], Tt = [
|
|
328
327
|
"auto",
|
|
329
328
|
"sender",
|
|
330
329
|
"forwarder",
|
|
331
330
|
"off"
|
|
332
|
-
],
|
|
331
|
+
], Et = [
|
|
333
332
|
"auto",
|
|
334
333
|
"provider",
|
|
335
334
|
"client"
|
|
336
|
-
],
|
|
335
|
+
], Dt = [
|
|
337
336
|
"auto",
|
|
338
337
|
"context",
|
|
339
338
|
"tab",
|
|
340
339
|
"origin"
|
|
341
|
-
],
|
|
340
|
+
], Ot = [
|
|
342
341
|
"error",
|
|
343
342
|
"warn",
|
|
344
343
|
"info",
|
|
345
344
|
"log"
|
|
346
|
-
],
|
|
345
|
+
], kt = ["limited", "until-delivered"], At = {
|
|
347
346
|
logFlushIntervalMs: [100, 6e4],
|
|
348
347
|
logBatchSize: [1, 1e3],
|
|
349
348
|
metricFlushIntervalMs: [100, 6e4],
|
|
350
349
|
metricBatchSize: [1, 1e3]
|
|
351
|
-
},
|
|
350
|
+
}, jt = {
|
|
352
351
|
maxBatches: [1, 5e3],
|
|
353
352
|
maxAgeMs: [6e4, 6048e5],
|
|
354
353
|
maxAttempts: [1, 20]
|
|
355
|
-
},
|
|
354
|
+
}, Mt = {
|
|
356
355
|
maxBodyChars: [256, 65536],
|
|
357
356
|
maxAttributeChars: [256, 65536],
|
|
358
357
|
maxAttributeCount: [1, 1024],
|
|
@@ -360,138 +359,139 @@ var pt = class {
|
|
|
360
359
|
maxDepth: [1, 16],
|
|
361
360
|
maxArrayLength: [1, 1e4],
|
|
362
361
|
maxNodes: [100, 1e5],
|
|
363
|
-
maxRecordBytes: [1024,
|
|
364
|
-
},
|
|
362
|
+
maxRecordBytes: [1024, g]
|
|
363
|
+
}, Nt = [6e4, 864e5], Pt = [
|
|
365
364
|
"errors",
|
|
366
365
|
"rejections",
|
|
367
366
|
"resourceErrors",
|
|
368
367
|
"fetch",
|
|
369
368
|
"xhr",
|
|
369
|
+
"httpMetrics",
|
|
370
370
|
"interactions",
|
|
371
371
|
"navigation",
|
|
372
372
|
"webVitals",
|
|
373
373
|
"longFrames",
|
|
374
374
|
"fullUrls"
|
|
375
|
-
],
|
|
375
|
+
], Ft = "null", L = `a level name: ${R(bt)}`, It = `true, false or a list of ${R(Ot)}`, Lt = "a list of strings and RegExp patterns", Rt = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", zt = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", Bt = "a list of strings";
|
|
376
376
|
function R(e) {
|
|
377
377
|
let t = e.map((e) => `"${e}"`);
|
|
378
378
|
return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Vt(e) {
|
|
381
381
|
return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
e.report("config.invalid", `${t} must be ${n}. The value is ${
|
|
383
|
+
function z(e, t, n, r, i) {
|
|
384
|
+
e.report("config.invalid", `${t} must be ${n}. The value is ${Vt(r)}. The library keeps ${i}.`);
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function B(e, t, n, r, i) {
|
|
387
387
|
if (t === void 0) return r;
|
|
388
388
|
let a = n.find((e) => e === t);
|
|
389
|
-
return a === void 0 ? (
|
|
389
|
+
return a === void 0 ? (z(i, e, R(n), t, `"${r}"`), r) : a;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
return t === void 0 ? n : typeof t == "boolean" ? t : (
|
|
391
|
+
function V(e, t, n, r) {
|
|
392
|
+
return t === void 0 ? n : typeof t == "boolean" ? t : (z(r, e, "true or false", t, String(n)), n);
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (
|
|
394
|
+
function Ht(e, t, n, r) {
|
|
395
|
+
return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (z(r, e, "a finite number of 0 or more", t, String(n)), n);
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function Ut(e, t, n, r, i) {
|
|
398
398
|
if (t === void 0) return r;
|
|
399
399
|
let [a, o] = n;
|
|
400
|
-
return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (
|
|
400
|
+
return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (z(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function H(e, t, n, r, i) {
|
|
403
403
|
let a = t ?? {}, o = Object.keys(r);
|
|
404
|
-
return Object.fromEntries(o.map((t) => [t,
|
|
404
|
+
return Object.fromEntries(o.map((t) => [t, Ut(`${e}.${t}`, a[t], r[t], n[t], i)]));
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function U(e) {
|
|
407
407
|
if (typeof e != "string") return;
|
|
408
408
|
let t = e.toUpperCase();
|
|
409
|
-
return
|
|
409
|
+
return bt.find((e) => e === t);
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function Wt(e, t, n, r) {
|
|
412
412
|
if (t === void 0) return n;
|
|
413
|
-
let i =
|
|
414
|
-
return i === void 0 ? (
|
|
413
|
+
let i = U(t);
|
|
414
|
+
return i === void 0 ? (z(r, e, L, t, `"${n}"`), n) : i;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function W(e, t, n, r, i, a) {
|
|
417
417
|
if (t === void 0) return n;
|
|
418
|
-
if (!Array.isArray(t)) return
|
|
418
|
+
if (!Array.isArray(t)) return z(a, e, r, t, "the list in force"), n;
|
|
419
419
|
let o = [], s = t;
|
|
420
420
|
for (let t of s) {
|
|
421
421
|
let n = i(t);
|
|
422
|
-
n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${
|
|
422
|
+
n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${Vt(t)}. ${e} must be ${r}.`) : o.push(n);
|
|
423
423
|
}
|
|
424
424
|
return o;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function Gt(e) {
|
|
427
427
|
return typeof e == "string" ? e : void 0;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function Kt(e) {
|
|
430
430
|
return typeof e == "string" || e instanceof RegExp ? e : void 0;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
return
|
|
432
|
+
function qt(e) {
|
|
433
|
+
return Ot.find((t) => t === e);
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function Jt(e) {
|
|
436
436
|
if (typeof e == "string") try {
|
|
437
437
|
let { origin: t } = new URL(e);
|
|
438
|
-
return t ===
|
|
438
|
+
return t === Ft ? void 0 : t;
|
|
439
439
|
} catch {
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
return e instanceof RegExp ? e :
|
|
443
|
+
function Yt(e) {
|
|
444
|
+
return e instanceof RegExp ? e : Jt(e);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
447
|
-
return
|
|
446
|
+
function Xt(e) {
|
|
447
|
+
return Oe(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
if (e !== void 0) return typeof e == "function" ||
|
|
449
|
+
function Zt(e, t, n) {
|
|
450
|
+
if (e !== void 0) return typeof e == "function" || Xt(e) ? e : (z(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function Qt(e) {
|
|
453
453
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" ||
|
|
455
|
+
function $t(e, t, n) {
|
|
456
|
+
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || Qt(e) ? e : (n.report("config.invalid", `serializer must be "${x}", "ecs" or an implementation. The library uses "${x}".`), x);
|
|
457
457
|
}
|
|
458
|
-
var
|
|
459
|
-
function
|
|
458
|
+
var en = new Set(Object.keys(de));
|
|
459
|
+
function tn(e, t) {
|
|
460
460
|
let n = {}, r = Object.entries(e ?? {});
|
|
461
|
-
for (let [e, i] of r)
|
|
461
|
+
for (let [e, i] of r) en.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.`);
|
|
462
462
|
return n;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function nn(e, t, n) {
|
|
465
465
|
if (e === void 0) return t ?? "DEBUG";
|
|
466
|
-
let r =
|
|
467
|
-
return r === void 0 ? (
|
|
466
|
+
let r = U(e);
|
|
467
|
+
return r === void 0 ? (z(n, "console.level", L, e, "the console level in force"), t) : r;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
if (
|
|
471
|
-
if (
|
|
469
|
+
function rn(t, n, r) {
|
|
470
|
+
if (t === void 0) return n;
|
|
471
|
+
if (t === !1) return {
|
|
472
472
|
level: null,
|
|
473
|
-
styles:
|
|
473
|
+
styles: n.styles
|
|
474
474
|
};
|
|
475
|
-
if (
|
|
476
|
-
level:
|
|
477
|
-
styles:
|
|
475
|
+
if (t === !0) return {
|
|
476
|
+
level: e,
|
|
477
|
+
styles: n.styles
|
|
478
478
|
};
|
|
479
|
-
if (typeof
|
|
480
|
-
let
|
|
481
|
-
return
|
|
482
|
-
level:
|
|
483
|
-
styles:
|
|
479
|
+
if (typeof t == "string") {
|
|
480
|
+
let e = U(t);
|
|
481
|
+
return e === void 0 ? (z(r, "console", L, t, "the console level in force"), n) : {
|
|
482
|
+
level: e,
|
|
483
|
+
styles: n.styles
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
|
-
return typeof
|
|
487
|
-
level:
|
|
486
|
+
return typeof t != "object" || !t ? (r.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), n) : {
|
|
487
|
+
level: nn(t.level, n.level, r),
|
|
488
488
|
styles: {
|
|
489
|
-
...
|
|
490
|
-
...
|
|
489
|
+
...n.styles,
|
|
490
|
+
...tn(t.styles, r)
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function an(e, t, n) {
|
|
495
495
|
let r = e ?? {};
|
|
496
496
|
return {
|
|
497
497
|
...t,
|
|
@@ -500,101 +500,113 @@ function Zt(e, t, n) {
|
|
|
500
500
|
...t.rates,
|
|
501
501
|
...r.rates
|
|
502
502
|
},
|
|
503
|
-
alwaysSampleTypes:
|
|
504
|
-
remote:
|
|
503
|
+
alwaysSampleTypes: W("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, Bt, Gt, n),
|
|
504
|
+
remote: V("sampling.remote", r.remote, t.remote, n)
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function on(e, t, n) {
|
|
508
508
|
let r = e ?? {};
|
|
509
509
|
return {
|
|
510
|
-
mode:
|
|
511
|
-
trustedOrigins:
|
|
512
|
-
openFinRole:
|
|
510
|
+
mode: B("bus.mode", r.mode, Tt, t.mode, n),
|
|
511
|
+
trustedOrigins: W("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, zt, Jt, n),
|
|
512
|
+
openFinRole: B("bus.openFinRole", r.openFinRole, Et, t.openFinRole, n)
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function sn(e, t, n) {
|
|
516
516
|
let r = e ?? {};
|
|
517
517
|
return {
|
|
518
|
-
scope:
|
|
519
|
-
maxAgeMs:
|
|
518
|
+
scope: B("journey.scope", r.scope, Dt, t.scope, n),
|
|
519
|
+
maxAgeMs: Ut("journey.maxAgeMs", r.maxAgeMs, Nt, t.maxAgeMs, n)
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function cn(e, t, n) {
|
|
523
523
|
let r = e ?? {};
|
|
524
524
|
return {
|
|
525
|
-
mode:
|
|
526
|
-
...
|
|
525
|
+
mode: B("retention.mode", r.mode, kt, t.mode, n),
|
|
526
|
+
...H("retention", r, t, jt, n)
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ?
|
|
529
|
+
function ln(e, t, n) {
|
|
530
|
+
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? W("capture.console", e, [], It, qt, n) : (z(n, "capture.console", It, e, "the value in force"), t);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function un(e, t, n) {
|
|
533
533
|
let r = e ?? {}, i = {
|
|
534
534
|
...t,
|
|
535
535
|
...r,
|
|
536
|
-
console:
|
|
537
|
-
longFrameThresholdMs:
|
|
538
|
-
ignoreUrls:
|
|
539
|
-
propagateTraceHeaderTo:
|
|
536
|
+
console: ln(r.console, t.console, n),
|
|
537
|
+
longFrameThresholdMs: Ht("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
|
|
538
|
+
ignoreUrls: W("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, Lt, Kt, n),
|
|
539
|
+
propagateTraceHeaderTo: W("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, Rt, Yt, n)
|
|
540
540
|
};
|
|
541
|
-
for (let e of
|
|
541
|
+
for (let e of Pt) i[e] = V(`capture.${e}`, r[e], t[e], n);
|
|
542
542
|
return i;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
let
|
|
546
|
-
|
|
544
|
+
function dn(e, t, n, r) {
|
|
545
|
+
let i = t;
|
|
546
|
+
if (typeof e == "string" && e !== "") try {
|
|
547
|
+
new URL(e), i = e;
|
|
548
|
+
} catch (t) {
|
|
549
|
+
r.report("config.invalid", `metricsEndpoint is not a valid absolute URL: ${e}. The library keeps the value in force.`, void 0, t);
|
|
550
|
+
}
|
|
551
|
+
else e === "" ? i = "" : e !== void 0 && z(r, "metricsEndpoint", "a URL string", e, "the value in force");
|
|
552
|
+
return i !== "" && n !== "otlp" ? (r.report("config.invalid", `metricsEndpoint needs serializer "${x}". The library sends metric records as log records.`), "") : i;
|
|
553
|
+
}
|
|
554
|
+
function fn(e, t, n) {
|
|
555
|
+
let i = n ?? a, o = {
|
|
556
|
+
...i,
|
|
547
557
|
...e,
|
|
548
|
-
endpoint: e.endpoint === void 0 ?
|
|
549
|
-
enabled:
|
|
550
|
-
minLevel:
|
|
551
|
-
compression:
|
|
552
|
-
credentials:
|
|
553
|
-
headers: "headers" in e ?
|
|
554
|
-
storage:
|
|
555
|
-
identity:
|
|
556
|
-
serializer:
|
|
557
|
-
console:
|
|
558
|
-
sampling:
|
|
559
|
-
bus:
|
|
560
|
-
batching:
|
|
561
|
-
retention:
|
|
562
|
-
limits:
|
|
563
|
-
journey:
|
|
564
|
-
capture:
|
|
558
|
+
endpoint: e.endpoint === void 0 ? i.endpoint : e.endpoint,
|
|
559
|
+
enabled: V("enabled", e.enabled, i.enabled, t),
|
|
560
|
+
minLevel: Wt("minLevel", e.minLevel, i.minLevel, t),
|
|
561
|
+
compression: B("compression", e.compression, xt, i.compression, t),
|
|
562
|
+
credentials: B("credentials", e.credentials, St, i.credentials, t),
|
|
563
|
+
headers: "headers" in e ? Zt(e.headers, i.headers, t) : i.headers,
|
|
564
|
+
storage: B("storage", e.storage, Ct, i.storage, t),
|
|
565
|
+
identity: B("identity", e.identity, wt, i.identity, t),
|
|
566
|
+
serializer: $t(e.serializer, n?.serializer, t),
|
|
567
|
+
console: rn(e.console, i.console, t),
|
|
568
|
+
sampling: an(e.sampling, i.sampling, t),
|
|
569
|
+
bus: on(e.bus, i.bus, t),
|
|
570
|
+
batching: H("batching", e.batching, i.batching, At, t),
|
|
571
|
+
retention: cn(e.retention, i.retention, t),
|
|
572
|
+
limits: H("limits", e.limits, i.limits, Mt, t),
|
|
573
|
+
journey: sn(e.journey, i.journey, t),
|
|
574
|
+
capture: un(e.capture, i.capture, t)
|
|
565
575
|
};
|
|
566
|
-
if (i.transport !== void 0 && typeof
|
|
567
|
-
else if (
|
|
568
|
-
new URL(
|
|
576
|
+
if (o.metricsEndpoint = dn(e.metricsEndpoint, i.metricsEndpoint, o.serializer, t), o.transport !== void 0 && typeof o.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), o.transport = i.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 = i.onDrop), o.transportOnExit !== void 0 && typeof o.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), o.transportOnExit = i.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.");
|
|
577
|
+
else if (o.endpoint !== null) try {
|
|
578
|
+
new URL(o.endpoint);
|
|
569
579
|
} catch (e) {
|
|
570
|
-
t.report("config.invalid", `endpoint is not a valid absolute URL: ${
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
let
|
|
574
|
-
(typeof
|
|
575
|
-
let
|
|
576
|
-
(typeof
|
|
577
|
-
let
|
|
578
|
-
for (let [e, n] of
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
580
|
+
t.report("config.invalid", `endpoint is not a valid absolute URL: ${o.endpoint}.`, void 0, e);
|
|
581
|
+
}
|
|
582
|
+
o.metricsEndpoint !== "" && o.endpoint === null && !o.transport && t.report("config.invalid", "metricsEndpoint needs endpoint or transport. The library sends nothing to metricsEndpoint."), o.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${r}'.`), r);
|
|
583
|
+
let s = o.sampling.defaultRate;
|
|
584
|
+
(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);
|
|
585
|
+
let c = o.sampling.remoteMaxRate;
|
|
586
|
+
(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);
|
|
587
|
+
let l = Object.entries(o.sampling.rates);
|
|
588
|
+
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);
|
|
589
|
+
o.capture.ignoreUrls = o.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint);
|
|
590
|
+
for (let e of [o.endpoint, o.metricsEndpoint]) e && !o.capture.ignoreUrls.includes(e) && (o.capture.ignoreUrls = [...o.capture.ignoreUrls, e]);
|
|
591
|
+
return pn(e, t), o;
|
|
592
|
+
}
|
|
593
|
+
function pn(e, t) {
|
|
594
|
+
let n = /* @__PURE__ */ new Set([...Object.keys(a), ...xe]);
|
|
583
595
|
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.`);
|
|
584
|
-
for (let n of
|
|
596
|
+
for (let n of C) {
|
|
585
597
|
let r = e[n];
|
|
586
598
|
if (typeof r != "object" || !r) continue;
|
|
587
|
-
let i = /* @__PURE__ */ new Set([...Object.keys(
|
|
599
|
+
let i = /* @__PURE__ */ new Set([...Object.keys(a[n]), ..._[n]]);
|
|
588
600
|
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.`);
|
|
589
601
|
}
|
|
590
602
|
}
|
|
591
|
-
function
|
|
592
|
-
for (let n of Object.keys(t))
|
|
593
|
-
for (let n of
|
|
603
|
+
function mn(e, t) {
|
|
604
|
+
for (let n of Object.keys(t)) C.includes(n) || Object.assign(e, { [n]: t[n] });
|
|
605
|
+
for (let n of C) Object.assign(e[n], t[n]);
|
|
594
606
|
}
|
|
595
607
|
//#endregion
|
|
596
608
|
//#region src/core/context.ts
|
|
597
|
-
var
|
|
609
|
+
var hn = class {
|
|
598
610
|
map = /* @__PURE__ */ new Map();
|
|
599
611
|
set(e, t) {
|
|
600
612
|
this.map.set(e, t);
|
|
@@ -602,24 +614,18 @@ var sn = class {
|
|
|
602
614
|
setMany(e) {
|
|
603
615
|
for (let [t, n] of Object.entries(e)) this.map.set(t, n);
|
|
604
616
|
}
|
|
605
|
-
get(e) {
|
|
606
|
-
return this.map.get(e);
|
|
607
|
-
}
|
|
608
617
|
remove(e) {
|
|
609
618
|
this.map.delete(e);
|
|
610
619
|
}
|
|
611
|
-
clear() {
|
|
612
|
-
this.map.clear();
|
|
613
|
-
}
|
|
614
620
|
getAll() {
|
|
615
621
|
return Object.fromEntries(this.map);
|
|
616
622
|
}
|
|
617
|
-
},
|
|
623
|
+
}, gn = class {
|
|
618
624
|
handler;
|
|
619
625
|
throttleMs;
|
|
620
626
|
counters = /* @__PURE__ */ new Map();
|
|
621
627
|
lastEmitted = /* @__PURE__ */ new Map();
|
|
622
|
-
constructor(e, t =
|
|
628
|
+
constructor(e, t = f) {
|
|
623
629
|
this.handler = e, this.throttleMs = t;
|
|
624
630
|
}
|
|
625
631
|
setHandler(e) {
|
|
@@ -642,12 +648,12 @@ var sn = class {
|
|
|
642
648
|
count: i
|
|
643
649
|
}, { handler: s } = this;
|
|
644
650
|
if (s) try {
|
|
645
|
-
|
|
651
|
+
A(() => {
|
|
646
652
|
s(o);
|
|
647
653
|
});
|
|
648
654
|
} catch (e) {
|
|
649
|
-
this.count("handler.threw"), typeof console < "u" &&
|
|
650
|
-
console.warn(`${
|
|
655
|
+
this.count("handler.threw"), typeof console < "u" && A(() => {
|
|
656
|
+
console.warn(`${se} The onDiagnostic handler threw an error.`, e);
|
|
651
657
|
});
|
|
652
658
|
}
|
|
653
659
|
}
|
|
@@ -670,16 +676,13 @@ var sn = class {
|
|
|
670
676
|
snapshot() {
|
|
671
677
|
return Object.fromEntries(this.counters);
|
|
672
678
|
}
|
|
673
|
-
reset() {
|
|
674
|
-
this.counters.clear(), this.lastEmitted.clear();
|
|
675
|
-
}
|
|
676
679
|
};
|
|
677
680
|
//#endregion
|
|
678
681
|
//#region src/core/drops.ts
|
|
679
|
-
function
|
|
682
|
+
function G(e, t) {
|
|
680
683
|
e.length < 20 && !e.includes(t) && e.push(t);
|
|
681
684
|
}
|
|
682
|
-
var
|
|
685
|
+
var _n = class {
|
|
683
686
|
config;
|
|
684
687
|
diagnostics;
|
|
685
688
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -698,12 +701,12 @@ var ln = class {
|
|
|
698
701
|
journeyIds: [],
|
|
699
702
|
actions: []
|
|
700
703
|
}, this.pending.set(e, r)), r.records += t.length;
|
|
701
|
-
for (let e of n)
|
|
704
|
+
for (let e of n) G(r.batchIds, e);
|
|
702
705
|
for (let e of t) {
|
|
703
|
-
let t =
|
|
704
|
-
typeof t == "string" &&
|
|
705
|
-
let n =
|
|
706
|
-
typeof n == "string" &&
|
|
706
|
+
let t = Je(e, E);
|
|
707
|
+
typeof t == "string" && G(r.journeyIds, t);
|
|
708
|
+
let n = M(e) ? e.body : void 0;
|
|
709
|
+
typeof n == "string" && G(r.actions, n);
|
|
707
710
|
}
|
|
708
711
|
this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
|
|
709
712
|
this.flush();
|
|
@@ -717,8 +720,8 @@ var ln = class {
|
|
|
717
720
|
if (t) {
|
|
718
721
|
this.reporting = !0;
|
|
719
722
|
for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
|
|
720
|
-
|
|
721
|
-
|
|
723
|
+
Ye(() => {
|
|
724
|
+
A(() => {
|
|
722
725
|
t(n);
|
|
723
726
|
});
|
|
724
727
|
});
|
|
@@ -726,7 +729,7 @@ var ln = class {
|
|
|
726
729
|
this.reporting = !1;
|
|
727
730
|
}
|
|
728
731
|
}
|
|
729
|
-
},
|
|
732
|
+
}, vn = class {
|
|
730
733
|
onDrop;
|
|
731
734
|
held = [];
|
|
732
735
|
actions = 0;
|
|
@@ -740,10 +743,10 @@ var ln = class {
|
|
|
740
743
|
return this.held.length;
|
|
741
744
|
}
|
|
742
745
|
push(e) {
|
|
743
|
-
let t =
|
|
746
|
+
let t = M(e);
|
|
744
747
|
if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
|
|
745
748
|
else {
|
|
746
|
-
let e = this.held.findIndex((e) =>
|
|
749
|
+
let e = this.held.findIndex((e) => M(e) === t), [n] = this.held.splice(e, 1);
|
|
747
750
|
this.onDrop(n);
|
|
748
751
|
}
|
|
749
752
|
this.held.push(e);
|
|
@@ -752,15 +755,118 @@ var ln = class {
|
|
|
752
755
|
let e = this.held;
|
|
753
756
|
return this.held = [], this.actions = 0, e;
|
|
754
757
|
}
|
|
755
|
-
},
|
|
756
|
-
|
|
758
|
+
}, yn = "overflow", bn = /* @__PURE__ */ new Set([
|
|
759
|
+
b,
|
|
760
|
+
D,
|
|
757
761
|
w,
|
|
758
|
-
|
|
762
|
+
T,
|
|
763
|
+
E,
|
|
764
|
+
y,
|
|
765
|
+
fe
|
|
766
|
+
]);
|
|
767
|
+
function xn(e = {}) {
|
|
768
|
+
let t = {};
|
|
769
|
+
for (let n of Object.keys(e).sort()) {
|
|
770
|
+
if (n.startsWith("metric.") || bn.has(n)) continue;
|
|
771
|
+
let r = e[n];
|
|
772
|
+
(typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
|
|
773
|
+
}
|
|
774
|
+
return t;
|
|
775
|
+
}
|
|
776
|
+
function Sn(e) {
|
|
777
|
+
if (!Array.isArray(e)) return null;
|
|
778
|
+
let t = Math.min(e.length, 51);
|
|
779
|
+
return Array.from({ length: t }, (t, n) => e[n]);
|
|
780
|
+
}
|
|
781
|
+
function Cn(e) {
|
|
782
|
+
return Array.isArray(e) && e.length <= 50 && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
|
|
783
|
+
}
|
|
784
|
+
function wn(e, t, n) {
|
|
785
|
+
let r = {
|
|
786
|
+
"metric.name": e.name,
|
|
787
|
+
"metric.unit": e.unit,
|
|
788
|
+
"metric.type": e.kind,
|
|
789
|
+
[k.start]: n,
|
|
790
|
+
[k.attributeKeys]: Object.keys(t.attributes)
|
|
791
|
+
};
|
|
792
|
+
return e.kind === "counter" ? (r["metric.value"] = t.sum, r) : {
|
|
793
|
+
...r,
|
|
794
|
+
[k.count]: t.count,
|
|
795
|
+
[k.sum]: t.sum,
|
|
796
|
+
[k.min]: t.min,
|
|
797
|
+
[k.max]: t.max,
|
|
798
|
+
[k.bounds]: e.boundaries,
|
|
799
|
+
[k.buckets]: t.buckets
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
var Tn = class {
|
|
803
|
+
intervalMs;
|
|
804
|
+
emit;
|
|
805
|
+
diagnostics;
|
|
806
|
+
instruments = /* @__PURE__ */ new Map();
|
|
807
|
+
timer = null;
|
|
808
|
+
startedAt = 0;
|
|
809
|
+
constructor(e, t, n) {
|
|
810
|
+
this.intervalMs = e, this.emit = t, this.diagnostics = n;
|
|
811
|
+
}
|
|
812
|
+
record(e, t, n) {
|
|
813
|
+
!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}.`, () => {
|
|
814
|
+
let r = this.instrumentOf(e);
|
|
815
|
+
r && (this.add(r, t, xn(n)), this.arm());
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
collect() {
|
|
819
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
820
|
+
let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
|
|
821
|
+
this.instruments.clear();
|
|
822
|
+
for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, wn(n, t, e));
|
|
823
|
+
}
|
|
824
|
+
instrumentOf(e) {
|
|
825
|
+
let t = this.instruments.get(e.name);
|
|
826
|
+
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);
|
|
827
|
+
let n = Sn(e.boundaries), r = Cn(n);
|
|
828
|
+
e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must be at most 50 finite numbers in ascending order. The library uses the default boundaries.`);
|
|
829
|
+
let i = {
|
|
830
|
+
def: {
|
|
831
|
+
...e,
|
|
832
|
+
boundaries: r ? n : [...ae]
|
|
833
|
+
},
|
|
834
|
+
series: /* @__PURE__ */ new Map()
|
|
835
|
+
};
|
|
836
|
+
return this.instruments.set(e.name, i), i;
|
|
837
|
+
}
|
|
838
|
+
add(e, t, n) {
|
|
839
|
+
let r = JSON.stringify(n), i = e.series.get(r), a = n;
|
|
840
|
+
if (!i && e.series.size >= 100 && (r = yn, i = e.series.get(r), a = { [oe]: !0 }), !i) {
|
|
841
|
+
let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
|
|
842
|
+
i = {
|
|
843
|
+
attributes: a,
|
|
844
|
+
count: 0,
|
|
845
|
+
sum: 0,
|
|
846
|
+
min: t,
|
|
847
|
+
max: t,
|
|
848
|
+
buckets: o
|
|
849
|
+
}, e.series.set(r, i);
|
|
850
|
+
}
|
|
851
|
+
if (i.count += 1, i.sum += t, i.min = Math.min(i.min, t), i.max = Math.max(i.max, t), i.buckets.length > 0) {
|
|
852
|
+
let n = e.def.boundaries.findIndex((e) => t <= e);
|
|
853
|
+
i.buckets[n === -1 ? i.buckets.length - 1 : n] += 1;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
arm() {
|
|
857
|
+
this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
|
|
858
|
+
this.collect();
|
|
859
|
+
}, this.intervalMs()), ke(this.timer));
|
|
860
|
+
}
|
|
861
|
+
}, En = "error.", Dn = [
|
|
862
|
+
T,
|
|
863
|
+
E,
|
|
864
|
+
y
|
|
759
865
|
];
|
|
760
|
-
function
|
|
866
|
+
function K(e) {
|
|
761
867
|
return e;
|
|
762
868
|
}
|
|
763
|
-
var
|
|
869
|
+
var On = class {
|
|
764
870
|
deps;
|
|
765
871
|
resourceCache = null;
|
|
766
872
|
constructor(e) {
|
|
@@ -772,9 +878,9 @@ var pn = class {
|
|
|
772
878
|
isEnabled(e, t) {
|
|
773
879
|
let { config: n } = this.deps;
|
|
774
880
|
if (!n.enabled) return !1;
|
|
775
|
-
if (t !== void 0 &&
|
|
881
|
+
if (t !== void 0 && pe.includes(t)) return !0;
|
|
776
882
|
let r = this.deps.remote.sampling?.minLevel() ?? n.minLevel;
|
|
777
|
-
return
|
|
883
|
+
return O[e] >= O[r];
|
|
778
884
|
}
|
|
779
885
|
build(e) {
|
|
780
886
|
let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o, remote: s } = this.deps;
|
|
@@ -783,72 +889,73 @@ var pn = class {
|
|
|
783
889
|
dropped: "level"
|
|
784
890
|
};
|
|
785
891
|
let c = r.resolve(), l = i.current();
|
|
786
|
-
if (!
|
|
892
|
+
if (!Pe({
|
|
787
893
|
level: e.level,
|
|
788
894
|
type: e.type,
|
|
789
895
|
namespace: e.namespace,
|
|
790
896
|
journeyId: l?.id ?? "",
|
|
791
|
-
traceId: c.traceId
|
|
897
|
+
traceId: c.traceId,
|
|
898
|
+
aggregated: e.aggregated
|
|
792
899
|
}, t, s.sampling?.current() ?? null)) return n.count("record.dropped_by_sampling"), {
|
|
793
900
|
record: null,
|
|
794
901
|
dropped: "sampling"
|
|
795
902
|
};
|
|
796
|
-
let u = a.next(), d =
|
|
903
|
+
let u = a.next(), d = qe(n), f = t.capture.fullUrls ? d : Ge(d), p, m = 0;
|
|
797
904
|
try {
|
|
798
|
-
let t =
|
|
905
|
+
let t = j(this.deps.context.getAll(), o, n), r = j(e.scoped ?? {}, o, n), i = j(e.payload ?? {}, o, n);
|
|
799
906
|
m = t.bytes + r.bytes + i.bytes, p = {
|
|
800
|
-
...
|
|
801
|
-
...
|
|
802
|
-
...
|
|
907
|
+
...K(t.value),
|
|
908
|
+
...K(r.value),
|
|
909
|
+
...K(i.value)
|
|
803
910
|
};
|
|
804
911
|
} catch (e) {
|
|
805
|
-
n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [
|
|
912
|
+
n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [me]: !0 };
|
|
806
913
|
}
|
|
807
|
-
p[b] = e.type, p[
|
|
808
|
-
let h =
|
|
914
|
+
Object.assign(p, e.fixed), p[b] = e.type, p[D] = u, p[w] = e.namespace, p[T] = f, l && (p[E] = l.id, p[y] = l.name, l.parentId !== void 0 && (p[fe] = l.parentId));
|
|
915
|
+
let h = Ie(e.body, o.maxBodyChars);
|
|
809
916
|
h !== e.body && n.count("record.truncated");
|
|
810
917
|
let g = {
|
|
811
|
-
timeUnixNano:
|
|
918
|
+
timeUnixNano: Ne(),
|
|
812
919
|
traceId: c.traceId,
|
|
813
920
|
spanId: c.spanId,
|
|
814
921
|
traceFlags: c.traceFlags,
|
|
815
|
-
severityNumber:
|
|
922
|
+
severityNumber: ue[e.level],
|
|
816
923
|
severityText: e.level,
|
|
817
924
|
body: h,
|
|
818
925
|
attributes: p,
|
|
819
926
|
resource: this.resource()
|
|
820
927
|
}, _ = t.redact;
|
|
821
928
|
if (_) {
|
|
822
|
-
let
|
|
929
|
+
let t;
|
|
823
930
|
try {
|
|
824
|
-
|
|
931
|
+
t = _(g);
|
|
825
932
|
} catch (e) {
|
|
826
933
|
return n.report("record.dropped_by_redact", "The redact hook threw an error. The library dropped the record.", void 0, e), {
|
|
827
934
|
record: null,
|
|
828
935
|
dropped: "redact"
|
|
829
936
|
};
|
|
830
937
|
}
|
|
831
|
-
if (
|
|
938
|
+
if (t === null) return n.count("record.dropped_by_redact"), {
|
|
832
939
|
record: null,
|
|
833
940
|
dropped: "redact"
|
|
834
941
|
};
|
|
835
|
-
let
|
|
836
|
-
if (!
|
|
942
|
+
let r = t ?? g;
|
|
943
|
+
if (!Ae(r)) return r === g ? (n.report("record.dropped_malformed", "The redact hook changed the record to a shape that is not a record. The library dropped it."), {
|
|
837
944
|
record: null,
|
|
838
945
|
dropped: "malformed"
|
|
839
946
|
}) : (n.report("record.dropped_by_redact", "The redact hook returned a value that is not a record. The library dropped the record."), {
|
|
840
947
|
record: null,
|
|
841
948
|
dropped: "redact"
|
|
842
949
|
});
|
|
843
|
-
if (
|
|
844
|
-
if (
|
|
845
|
-
let
|
|
950
|
+
if (je(r.severityText)) {
|
|
951
|
+
if (r !== g) {
|
|
952
|
+
let t = j(r.attributes, o, n);
|
|
846
953
|
g = {
|
|
847
|
-
...
|
|
848
|
-
attributes:
|
|
849
|
-
}, m = e.
|
|
954
|
+
...r,
|
|
955
|
+
attributes: K(t.value)
|
|
956
|
+
}, m = t.bytes, Object.assign(g.attributes, e.fixed);
|
|
850
957
|
}
|
|
851
|
-
g.severityNumber =
|
|
958
|
+
g.severityNumber = ue[g.severityText];
|
|
852
959
|
} else return n.report("record.dropped_malformed", "The redact hook set a severityText that is not a log level. The library dropped the record."), {
|
|
853
960
|
record: null,
|
|
854
961
|
dropped: "malformed"
|
|
@@ -861,52 +968,52 @@ var pn = class {
|
|
|
861
968
|
});
|
|
862
969
|
let t = {
|
|
863
970
|
[b]: e.type,
|
|
864
|
-
[
|
|
865
|
-
[
|
|
971
|
+
[D]: u,
|
|
972
|
+
[w]: e.namespace,
|
|
866
973
|
[le]: !0,
|
|
867
|
-
[
|
|
974
|
+
[ve]: m
|
|
868
975
|
};
|
|
869
|
-
for (let e of
|
|
870
|
-
for (let [e, n] of Object.entries(g.attributes)) e.startsWith(
|
|
871
|
-
let r =
|
|
872
|
-
r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t,
|
|
873
|
-
let i = g.attributes[
|
|
976
|
+
for (let e of Dn) e in g.attributes && (t[e] = g.attributes[e]);
|
|
977
|
+
for (let [e, n] of Object.entries(g.attributes)) e.startsWith(En) && (t[e] = n);
|
|
978
|
+
let r = j(t, o, n).bytes;
|
|
979
|
+
r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, ge), r = j(t, o, n).bytes);
|
|
980
|
+
let i = g.attributes[v];
|
|
874
981
|
if (i !== void 0) {
|
|
875
|
-
let e =
|
|
876
|
-
r + e <= o.maxRecordBytes && (t[
|
|
982
|
+
let e = j(i, o, n).bytes;
|
|
983
|
+
r + e <= o.maxRecordBytes && (t[v] = i);
|
|
877
984
|
}
|
|
878
|
-
g.attributes = t;
|
|
985
|
+
Object.assign(t, e.fixed), g.attributes = t;
|
|
879
986
|
}
|
|
880
987
|
return { record: g };
|
|
881
988
|
}
|
|
882
989
|
resource() {
|
|
883
990
|
if (this.resourceCache) return this.resourceCache;
|
|
884
|
-
let { config: e, identity:
|
|
991
|
+
let { config: e, identity: t, platform: r } = this.deps;
|
|
885
992
|
return this.resourceCache = {
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
889
|
-
[
|
|
890
|
-
[
|
|
891
|
-
[
|
|
993
|
+
[te]: e.serviceName,
|
|
994
|
+
[c]: e.serviceVersion,
|
|
995
|
+
[p]: e.environment,
|
|
996
|
+
[d]: ce,
|
|
997
|
+
[_e]: S,
|
|
998
|
+
[s]: he,
|
|
892
999
|
[h]: r.platform,
|
|
893
|
-
[
|
|
894
|
-
[
|
|
895
|
-
[
|
|
896
|
-
[
|
|
897
|
-
...r.openfinUuid === void 0 ? {} : { [
|
|
898
|
-
...r.openfinName === void 0 ? {} : { [
|
|
1000
|
+
[ee]: t.sessionId,
|
|
1001
|
+
[ne]: t.tabId,
|
|
1002
|
+
[u]: t.contextId,
|
|
1003
|
+
[o]: r.userAgent,
|
|
1004
|
+
...r.openfinUuid === void 0 ? {} : { [n]: r.openfinUuid },
|
|
1005
|
+
...r.openfinName === void 0 ? {} : { [we]: r.openfinName }
|
|
899
1006
|
}, this.resourceCache;
|
|
900
1007
|
}
|
|
901
|
-
},
|
|
902
|
-
errors: async () => (await import("./errors-
|
|
903
|
-
network: async () => (await import("./network
|
|
904
|
-
interactions: async () => (await import("./interactions-
|
|
1008
|
+
}, kn = {
|
|
1009
|
+
errors: async () => (await import("./errors-DCZWcHkd.js")).ErrorCapture,
|
|
1010
|
+
network: async () => (await import("./network--GoE7_Or.js")).NetworkCapture,
|
|
1011
|
+
interactions: async () => (await import("./interactions-BLH_tX87.js")).InteractionCapture,
|
|
905
1012
|
webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
|
|
906
|
-
longFrames: async () => (await import("./long-frames-
|
|
907
|
-
console: async () => (await import("./console-
|
|
908
|
-
},
|
|
909
|
-
function
|
|
1013
|
+
longFrames: async () => (await import("./long-frames-DD_Um9_4.js")).LongFrameCapture,
|
|
1014
|
+
console: async () => (await import("./console-Dv5GfaNn.js")).ConsoleCapture
|
|
1015
|
+
}, q = Symbol.for(re), J = Symbol.for(m), An = ["batching", "retention"];
|
|
1016
|
+
function Y(e) {
|
|
910
1017
|
return JSON.stringify({
|
|
911
1018
|
...e,
|
|
912
1019
|
webVitalsLoader: e.webVitalsLoader !== void 0,
|
|
@@ -914,7 +1021,7 @@ function gn(e) {
|
|
|
914
1021
|
propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String)
|
|
915
1022
|
});
|
|
916
1023
|
}
|
|
917
|
-
function
|
|
1024
|
+
function jn(e) {
|
|
918
1025
|
return {
|
|
919
1026
|
...e,
|
|
920
1027
|
endpoint: null,
|
|
@@ -940,22 +1047,23 @@ var Z = class e {
|
|
|
940
1047
|
stores;
|
|
941
1048
|
identityBuiltAs;
|
|
942
1049
|
sessionTouch;
|
|
943
|
-
context = new
|
|
1050
|
+
context = new hn();
|
|
944
1051
|
breadcrumbs;
|
|
945
1052
|
tracing;
|
|
946
|
-
sequence = new
|
|
1053
|
+
sequence = new lt();
|
|
947
1054
|
journey;
|
|
948
1055
|
builder;
|
|
949
1056
|
remote = { sampling: null };
|
|
950
1057
|
console;
|
|
951
1058
|
drops;
|
|
1059
|
+
meter;
|
|
952
1060
|
bus = null;
|
|
953
1061
|
busBuilt;
|
|
954
1062
|
busLoad;
|
|
955
1063
|
storageBuiltAs;
|
|
956
1064
|
sender;
|
|
957
1065
|
senderLoad;
|
|
958
|
-
pendingRecords = new
|
|
1066
|
+
pendingRecords = new vn((e) => {
|
|
959
1067
|
this.dropHeld(e);
|
|
960
1068
|
});
|
|
961
1069
|
captures = [];
|
|
@@ -965,7 +1073,7 @@ var Z = class e {
|
|
|
965
1073
|
navigationTiming: !1,
|
|
966
1074
|
longFrames: !1
|
|
967
1075
|
};
|
|
968
|
-
bootBuffer = new
|
|
1076
|
+
bootBuffer = new vn((e) => {
|
|
969
1077
|
this.dropHeld(e);
|
|
970
1078
|
});
|
|
971
1079
|
forwardBuffer = [];
|
|
@@ -979,12 +1087,12 @@ var Z = class e {
|
|
|
979
1087
|
journeyOptions;
|
|
980
1088
|
tunablesLocked = !0;
|
|
981
1089
|
constructor(e, t = !1) {
|
|
982
|
-
this.degraded = t, this.diagnostics = new
|
|
983
|
-
...
|
|
1090
|
+
this.degraded = t, this.diagnostics = new gn(e.onDiagnostic), this.platform = Ke(this.diagnostics), this.config = fn(e, this.diagnostics), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" ? He() : We, this.identity = Ue(this.diagnostics, this.stores), this.sessionTouch = new Be(this.diagnostics, this.stores), this.breadcrumbs = new yt(50), this.tracing = new vt(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new ct(this.config.console, this.diagnostics, this.limits), this.drops = new _n(this.config, this.diagnostics), this.journeyOptions = {
|
|
1091
|
+
...Ze,
|
|
984
1092
|
maxAgeMs: this.config.journey.maxAgeMs
|
|
985
|
-
}, this.journey = new
|
|
1093
|
+
}, this.journey = new Xe(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
|
|
986
1094
|
this.bus?.broadcastJourney(e);
|
|
987
|
-
}, this.stores), this.builder = new
|
|
1095
|
+
}, this.stores), this.builder = new On({
|
|
988
1096
|
remote: this.remote,
|
|
989
1097
|
config: this.config,
|
|
990
1098
|
limits: this.limits,
|
|
@@ -995,7 +1103,24 @@ var Z = class e {
|
|
|
995
1103
|
sequence: this.sequence,
|
|
996
1104
|
identity: this.identity,
|
|
997
1105
|
platform: this.platform
|
|
1106
|
+
}), this.meter = new Tn(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
|
|
1107
|
+
this.emitPoint(e, t, n);
|
|
1108
|
+
}, this.diagnostics);
|
|
1109
|
+
}
|
|
1110
|
+
recordMetric(e, t, n) {
|
|
1111
|
+
this.destroyed || this.meter.record(e, t, n);
|
|
1112
|
+
}
|
|
1113
|
+
emitPoint(e, t, n) {
|
|
1114
|
+
let { record: r } = this.builder.build({
|
|
1115
|
+
level: "INFO",
|
|
1116
|
+
type: "metric",
|
|
1117
|
+
body: e,
|
|
1118
|
+
namespace: Se,
|
|
1119
|
+
payload: t,
|
|
1120
|
+
fixed: n,
|
|
1121
|
+
aggregated: !0
|
|
998
1122
|
});
|
|
1123
|
+
this.emit(r);
|
|
999
1124
|
}
|
|
1000
1125
|
busAccept = (e, t) => {
|
|
1001
1126
|
this.destroyed || this.ensureBus().then((n) => {
|
|
@@ -1005,7 +1130,7 @@ var Z = class e {
|
|
|
1005
1130
|
});
|
|
1006
1131
|
};
|
|
1007
1132
|
static pinned() {
|
|
1008
|
-
return globalThis[
|
|
1133
|
+
return globalThis[q] ?? null;
|
|
1009
1134
|
}
|
|
1010
1135
|
static current() {
|
|
1011
1136
|
let t = e.local;
|
|
@@ -1016,7 +1141,7 @@ var Z = class e {
|
|
|
1016
1141
|
static stopped() {
|
|
1017
1142
|
let t = e.local;
|
|
1018
1143
|
if (t?.destroyed) return t;
|
|
1019
|
-
let n = globalThis[
|
|
1144
|
+
let n = globalThis[J];
|
|
1020
1145
|
return n && X(n) ? n : null;
|
|
1021
1146
|
}
|
|
1022
1147
|
isDestroyed() {
|
|
@@ -1024,7 +1149,7 @@ var Z = class e {
|
|
|
1024
1149
|
}
|
|
1025
1150
|
static configure(t, n = !1) {
|
|
1026
1151
|
let r = e.local;
|
|
1027
|
-
if (r && !r.destroyed) return r.reconfigure(
|
|
1152
|
+
if (r && !r.destroyed) return r.reconfigure(jn(t)), r;
|
|
1028
1153
|
e.local = null;
|
|
1029
1154
|
let i = e.pinned();
|
|
1030
1155
|
if (i) {
|
|
@@ -1032,10 +1157,10 @@ var Z = class e {
|
|
|
1032
1157
|
if (!i.destroyed) return i.reconfigure(t), i;
|
|
1033
1158
|
}
|
|
1034
1159
|
let a = new e(t);
|
|
1035
|
-
return a.tunablesLocked = !n, globalThis[
|
|
1160
|
+
return a.tunablesLocked = !n, globalThis[q] = a, Reflect.deleteProperty(globalThis, J), a.init(), a;
|
|
1036
1161
|
}
|
|
1037
1162
|
static startDegraded(t, n) {
|
|
1038
|
-
let r = new e(
|
|
1163
|
+
let r = new e(jn(t), !0);
|
|
1039
1164
|
e.local = r;
|
|
1040
1165
|
let i = typeof n == "string" ? n : "before 0.9.0";
|
|
1041
1166
|
return r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${S}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
|
|
@@ -1044,11 +1169,11 @@ var Z = class e {
|
|
|
1044
1169
|
}), r.init(), r;
|
|
1045
1170
|
}
|
|
1046
1171
|
reconfigure(e) {
|
|
1047
|
-
let t = this.keepDestination(e), n =
|
|
1048
|
-
this.keepStartupTunables(r),
|
|
1172
|
+
let t = this.keepDestination(e), n = Y(this.config.capture), r = fn(t, this.diagnostics, this.config);
|
|
1173
|
+
this.keepStartupTunables(r), mn(this.config, r), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), Y(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
|
|
1049
1174
|
}
|
|
1050
1175
|
keepStartupTunables(e) {
|
|
1051
|
-
if (this.senderLoad !== void 0 && this.keepSections(e,
|
|
1176
|
+
if (this.senderLoad !== void 0 && this.keepSections(e, An), !this.tunablesLocked) {
|
|
1052
1177
|
this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
|
|
1053
1178
|
return;
|
|
1054
1179
|
}
|
|
@@ -1106,7 +1231,7 @@ var Z = class e {
|
|
|
1106
1231
|
}
|
|
1107
1232
|
async buildBus() {
|
|
1108
1233
|
try {
|
|
1109
|
-
let { Bus: e } = await import("./bus-
|
|
1234
|
+
let { Bus: e } = await import("./bus-C6RwKzPW.js");
|
|
1110
1235
|
if (this.destroyed) return null;
|
|
1111
1236
|
let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
1112
1237
|
onRecords: (e) => {
|
|
@@ -1141,12 +1266,15 @@ var Z = class e {
|
|
|
1141
1266
|
async buildSender() {
|
|
1142
1267
|
this.storageBuiltAs = this.config.storage;
|
|
1143
1268
|
try {
|
|
1144
|
-
let { Sender: e } = await import("./sender-
|
|
1269
|
+
let { Sender: e } = await import("./sender-BUBWLn5i.js"), t = this.destroyed ? null : await e.create({
|
|
1145
1270
|
config: this.config,
|
|
1146
1271
|
diagnostics: this.diagnostics,
|
|
1147
1272
|
onGap: this.reportGap,
|
|
1148
1273
|
onLoss: this.reportLoss,
|
|
1149
|
-
remote: this.remote
|
|
1274
|
+
remote: this.remote,
|
|
1275
|
+
beforeExit: () => {
|
|
1276
|
+
this.meter.collect();
|
|
1277
|
+
}
|
|
1150
1278
|
});
|
|
1151
1279
|
if (!t || this.destroyed) {
|
|
1152
1280
|
await t?.destroy();
|
|
@@ -1160,9 +1288,9 @@ var Z = class e {
|
|
|
1160
1288
|
}
|
|
1161
1289
|
async installCaptures() {
|
|
1162
1290
|
if (this.degraded) return;
|
|
1163
|
-
let e = ++this.captureGeneration, t = this.config.capture,
|
|
1164
|
-
(t.errors || t.rejections || t.resourceErrors) &&
|
|
1165
|
-
let
|
|
1291
|
+
let e = ++this.captureGeneration, t = this.config.capture, n = [];
|
|
1292
|
+
(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");
|
|
1293
|
+
let r = await Promise.all(n.map((e) => this.loadCapture(e)));
|
|
1166
1294
|
if (e !== this.captureGeneration || this.destroyed) return;
|
|
1167
1295
|
this.uninstallCaptures();
|
|
1168
1296
|
let a = {
|
|
@@ -1170,10 +1298,13 @@ var Z = class e {
|
|
|
1170
1298
|
diagnostics: this.diagnostics,
|
|
1171
1299
|
breadcrumbs: this.breadcrumbs,
|
|
1172
1300
|
tracing: this.tracing,
|
|
1173
|
-
logger: new
|
|
1174
|
-
once: this.captureOnce
|
|
1301
|
+
logger: new I(() => this, i),
|
|
1302
|
+
once: this.captureOnce,
|
|
1303
|
+
recordMetric: (e, t, n) => {
|
|
1304
|
+
this.recordMetric(e, t, n);
|
|
1305
|
+
}
|
|
1175
1306
|
};
|
|
1176
|
-
for (let e of
|
|
1307
|
+
for (let e of r) e && this.captures.push(new e(a));
|
|
1177
1308
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
|
|
1178
1309
|
e.install();
|
|
1179
1310
|
});
|
|
@@ -1185,7 +1316,7 @@ var Z = class e {
|
|
|
1185
1316
|
this.captures.length = 0;
|
|
1186
1317
|
}
|
|
1187
1318
|
loadCapture(e) {
|
|
1188
|
-
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`,
|
|
1319
|
+
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, kn[e]);
|
|
1189
1320
|
}
|
|
1190
1321
|
registerWorker(e) {
|
|
1191
1322
|
this.destroyed || this.constructBus().then((t) => {
|
|
@@ -1196,9 +1327,9 @@ var Z = class e {
|
|
|
1196
1327
|
}
|
|
1197
1328
|
async destroy() {
|
|
1198
1329
|
if (this.destroyed) return;
|
|
1199
|
-
this.destroyed = !0, this.uninstallCaptures();
|
|
1330
|
+
this.meter.collect(), this.destroyed = !0, this.uninstallCaptures();
|
|
1200
1331
|
let t = this.sender?.destroy();
|
|
1201
|
-
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,
|
|
1332
|
+
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, q), globalThis[J] = this);
|
|
1202
1333
|
}
|
|
1203
1334
|
emit(e) {
|
|
1204
1335
|
e && !this.destroyed && (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
|
|
@@ -1223,7 +1354,7 @@ var Z = class e {
|
|
|
1223
1354
|
}
|
|
1224
1355
|
ingestForwarded(e) {
|
|
1225
1356
|
if (!Array.isArray(e)) this.diagnostics.count("record.dropped_malformed");
|
|
1226
|
-
else for (let t of e)
|
|
1357
|
+
else for (let t of e) Ae(t) ? Me(t, this.config, this.remote.sampling?.current() ?? null) ? this.deliver(t) : this.diagnostics.count("record.dropped_by_sampling") : this.diagnostics.count("record.dropped_malformed");
|
|
1227
1358
|
}
|
|
1228
1359
|
releaseBootBuffer() {
|
|
1229
1360
|
let e = this.bootBuffer.take(), t = this.journey.current();
|
|
@@ -1235,29 +1366,29 @@ var Z = class e {
|
|
|
1235
1366
|
reportGap = (e, t) => {
|
|
1236
1367
|
this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
|
|
1237
1368
|
let n = Date.now();
|
|
1238
|
-
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new
|
|
1369
|
+
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new I(() => this, ye).warn("stored records were dropped before delivery", {
|
|
1239
1370
|
"gap.batches": e.batches,
|
|
1240
1371
|
"gap.records": e.records,
|
|
1241
1372
|
"gap.reason": e.reason
|
|
1242
1373
|
}));
|
|
1243
1374
|
};
|
|
1244
1375
|
regenerateTabId() {
|
|
1245
|
-
let e =
|
|
1376
|
+
let e = ze(this.diagnostics);
|
|
1246
1377
|
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.", {
|
|
1247
1378
|
was: this.identity.tabId,
|
|
1248
1379
|
now: e
|
|
1249
|
-
}), this.identity.tabId = e,
|
|
1380
|
+
}), this.identity.tabId = e, Re(e, this.diagnostics, this.stores), this.builder.invalidateResource();
|
|
1250
1381
|
}
|
|
1251
1382
|
async queueDepth() {
|
|
1252
1383
|
return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
|
|
1253
1384
|
}
|
|
1254
1385
|
async flush() {
|
|
1255
|
-
this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
|
|
1386
|
+
this.meter.collect(), this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
|
|
1256
1387
|
}
|
|
1257
1388
|
};
|
|
1258
1389
|
//#endregion
|
|
1259
1390
|
//#region src/transport/memory-transport.ts
|
|
1260
|
-
function
|
|
1391
|
+
function Mn() {
|
|
1261
1392
|
let e = [], t = [], n = { status: 200 };
|
|
1262
1393
|
return {
|
|
1263
1394
|
transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
|
|
@@ -1276,100 +1407,122 @@ function vn() {
|
|
|
1276
1407
|
}
|
|
1277
1408
|
//#endregion
|
|
1278
1409
|
//#region src/index.ts
|
|
1279
|
-
var
|
|
1410
|
+
var Nn = /* @__PURE__ */ new Map();
|
|
1280
1411
|
function Q() {
|
|
1281
1412
|
return (Z.current() ?? Z.stopped()) || Z.configure({}, !0);
|
|
1282
1413
|
}
|
|
1283
|
-
function
|
|
1414
|
+
function Pn(e) {
|
|
1284
1415
|
Z.configure(e);
|
|
1285
1416
|
}
|
|
1286
|
-
function
|
|
1287
|
-
if (t) return new
|
|
1288
|
-
let n =
|
|
1289
|
-
return n || (n = new
|
|
1417
|
+
function Fn(e, t) {
|
|
1418
|
+
if (t) return new I(Q, e, t);
|
|
1419
|
+
let n = Nn.get(e);
|
|
1420
|
+
return n || (n = new I(Q, e), Nn.set(e, n)), n;
|
|
1290
1421
|
}
|
|
1291
1422
|
function $() {
|
|
1292
|
-
return
|
|
1423
|
+
return Fn("app");
|
|
1293
1424
|
}
|
|
1294
|
-
function
|
|
1425
|
+
function In(e, t) {
|
|
1295
1426
|
$().trace(e, t);
|
|
1296
1427
|
}
|
|
1297
|
-
function
|
|
1428
|
+
function Ln(e, t) {
|
|
1298
1429
|
$().debug(e, t);
|
|
1299
1430
|
}
|
|
1300
|
-
function
|
|
1431
|
+
function Rn(e, t) {
|
|
1301
1432
|
$().info(e, t);
|
|
1302
1433
|
}
|
|
1303
|
-
function
|
|
1434
|
+
function zn(e, t) {
|
|
1304
1435
|
$().warn(e, t);
|
|
1305
1436
|
}
|
|
1306
|
-
function
|
|
1437
|
+
function Bn(e, t, n) {
|
|
1307
1438
|
$().error(e, t, n);
|
|
1308
1439
|
}
|
|
1309
|
-
function
|
|
1440
|
+
function Vn(e, t, n) {
|
|
1310
1441
|
$().fatal(e, t, n);
|
|
1311
1442
|
}
|
|
1312
|
-
function
|
|
1443
|
+
function Hn(e, t) {
|
|
1313
1444
|
$().logAction(e, t);
|
|
1314
1445
|
}
|
|
1315
|
-
function
|
|
1446
|
+
function Un(e, t) {
|
|
1316
1447
|
$().logEvent(e, t);
|
|
1317
1448
|
}
|
|
1318
|
-
function
|
|
1449
|
+
function Wn(e, t, n, r, i) {
|
|
1319
1450
|
$().logMetric(e, t, n, r, i);
|
|
1320
1451
|
}
|
|
1321
|
-
function
|
|
1452
|
+
function Gn(e, t = {}) {
|
|
1453
|
+
let n = {
|
|
1454
|
+
name: e,
|
|
1455
|
+
kind: "counter",
|
|
1456
|
+
unit: t.unit ?? "count",
|
|
1457
|
+
boundaries: []
|
|
1458
|
+
};
|
|
1459
|
+
return { add: (e, t) => {
|
|
1460
|
+
Q().recordMetric(n, e, t);
|
|
1461
|
+
} };
|
|
1462
|
+
}
|
|
1463
|
+
function Kn(e, t = {}) {
|
|
1464
|
+
let n = {
|
|
1465
|
+
name: e,
|
|
1466
|
+
kind: "histogram",
|
|
1467
|
+
unit: t.unit ?? "count",
|
|
1468
|
+
boundaries: t.boundaries ?? ae
|
|
1469
|
+
};
|
|
1470
|
+
return { record: (e, t) => {
|
|
1471
|
+
Q().recordMetric(n, e, t);
|
|
1472
|
+
} };
|
|
1473
|
+
}
|
|
1474
|
+
function qn(e, t, n) {
|
|
1322
1475
|
return $().timeSync(e, t, n);
|
|
1323
1476
|
}
|
|
1324
|
-
function
|
|
1477
|
+
function Jn(e, t, n) {
|
|
1325
1478
|
return $().timeAsync(e, t, n);
|
|
1326
1479
|
}
|
|
1327
|
-
function
|
|
1480
|
+
function Yn(e, t) {
|
|
1328
1481
|
Q().context.set(e, t);
|
|
1329
1482
|
}
|
|
1330
|
-
function
|
|
1483
|
+
function Xn(e) {
|
|
1331
1484
|
Q().context.setMany(e);
|
|
1332
1485
|
}
|
|
1333
|
-
function
|
|
1486
|
+
function Zn(e) {
|
|
1334
1487
|
Q().context.remove(e);
|
|
1335
1488
|
}
|
|
1336
|
-
function
|
|
1489
|
+
function Qn(e, t) {
|
|
1337
1490
|
return Q().journey.start(e, t);
|
|
1338
1491
|
}
|
|
1339
|
-
function
|
|
1492
|
+
function $n() {
|
|
1340
1493
|
Q().journey.end();
|
|
1341
1494
|
}
|
|
1342
|
-
function
|
|
1495
|
+
function er() {
|
|
1343
1496
|
return Q().journey.current();
|
|
1344
1497
|
}
|
|
1345
|
-
function
|
|
1498
|
+
function tr() {
|
|
1346
1499
|
return Q().journey.getToken();
|
|
1347
1500
|
}
|
|
1348
|
-
function
|
|
1501
|
+
function nr(e) {
|
|
1349
1502
|
return Q().journey.adopt(e, "manual", !0);
|
|
1350
1503
|
}
|
|
1351
|
-
function
|
|
1504
|
+
function rr(e) {
|
|
1352
1505
|
Q().registerWorker(e);
|
|
1353
1506
|
}
|
|
1354
|
-
function
|
|
1507
|
+
function ir() {
|
|
1355
1508
|
Q().tracing.rotate("explicit");
|
|
1356
1509
|
}
|
|
1357
|
-
function
|
|
1510
|
+
function ar() {
|
|
1358
1511
|
return Q().tracing.headers();
|
|
1359
1512
|
}
|
|
1360
|
-
function
|
|
1513
|
+
function or() {
|
|
1361
1514
|
return Q().flush();
|
|
1362
1515
|
}
|
|
1363
|
-
function
|
|
1516
|
+
function sr() {
|
|
1364
1517
|
return Q().queueDepth();
|
|
1365
1518
|
}
|
|
1366
|
-
function
|
|
1519
|
+
function cr() {
|
|
1367
1520
|
return Q().diagnostics.snapshot();
|
|
1368
1521
|
}
|
|
1369
|
-
async function
|
|
1522
|
+
async function lr() {
|
|
1370
1523
|
await Z.current()?.destroy();
|
|
1371
1524
|
}
|
|
1372
1525
|
//#endregion
|
|
1373
|
-
export {
|
|
1526
|
+
export { I as OneLogger, nr as adoptJourney, Pn as configure, Gn as counter, Mn as createMemoryTransport, er as currentJourney, Ln as debug, $n as endJourney, Bn as error, Vn as fatal, or as flush, cr as getDiagnosticCounters, tr as getJourneyToken, Fn as getLogger, sr as getQueueDepth, ar as getTraceHeaders, Kn as histogram, Rn as info, Hn as logAction, Un as logEvent, Wn as logMetric, rr as registerWorker, Zn as removeContext, Yn as setContext, Xn as setContextMap, lr as shutdown, Qn as startJourney, ir as startTrace, Jn as timeAsync, qn as timeSync, In as trace, zn as warn };
|
|
1374
1527
|
|
|
1375
1528
|
//# sourceMappingURL=index.js.map
|