@utk09/ui-observability 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +56 -36
- package/dist/batch-DEK4bv9N.js +31 -0
- package/dist/batch-DEK4bv9N.js.map +1 -0
- package/dist/batch-DEVFs28i.cjs +2 -0
- package/dist/batch-DEVFs28i.cjs.map +1 -0
- package/dist/{bus-CtJWf9QN.cjs → bus-DNFvTkif.cjs} +2 -2
- package/dist/{bus-CtJWf9QN.cjs.map → bus-DNFvTkif.cjs.map} +1 -1
- package/dist/{bus-D8kH58tb.js → bus-HVQ8E72V.js} +8 -8
- package/dist/{bus-D8kH58tb.js.map → bus-HVQ8E72V.js.map} +1 -1
- package/dist/{console-DjLbryED.js → console-C9Y639mn.js} +3 -3
- package/dist/{console-DjLbryED.js.map → console-C9Y639mn.js.map} +1 -1
- package/dist/{console-BpHfWstv.cjs → console-DssDxq1B.cjs} +2 -2
- package/dist/{console-BpHfWstv.cjs.map → console-DssDxq1B.cjs.map} +1 -1
- package/dist/constants-N99w84xy.js +117 -0
- package/dist/constants-N99w84xy.js.map +1 -0
- package/dist/constants-X86IDwkC.cjs +2 -0
- package/dist/constants-X86IDwkC.cjs.map +1 -0
- package/dist/constants.d.ts +18 -11
- package/dist/core/drops.d.ts +29 -0
- package/dist/core/hold-buffer.d.ts +27 -0
- package/dist/core/pipeline.d.ts +2 -7
- package/dist/core/runtime.d.ts +44 -8
- package/dist/core/sender.d.ts +4 -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/{errors-CpGRhhIf.cjs → errors-BTWuVnHZ.cjs} +2 -2
- package/dist/{errors-CpGRhhIf.cjs.map → errors-BTWuVnHZ.cjs.map} +1 -1
- package/dist/{errors-DH4QJS0u.js → errors-CQusIGWJ.js} +4 -4
- package/dist/{errors-DH4QJS0u.js.map → errors-CQusIGWJ.js.map} +1 -1
- package/dist/{deadline-Cbg2cbUw.cjs → identity-B1GDS1Tb.cjs} +2 -2
- package/dist/identity-B1GDS1Tb.cjs.map +1 -0
- package/dist/{deadline-B5DINjD5.js → identity-D4DPjTM9.js} +3 -26
- package/dist/identity-D4DPjTM9.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +467 -318
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-n1qkFBGA.js → indexeddb-storage-B8SGUzSV.js} +79 -50
- package/dist/indexeddb-storage-B8SGUzSV.js.map +1 -0
- package/dist/indexeddb-storage-ukzC82dm.cjs +2 -0
- package/dist/indexeddb-storage-ukzC82dm.cjs.map +1 -0
- package/dist/{interactions-31eHGwEQ.cjs → interactions-CcxrVzpg.cjs} +2 -2
- package/dist/{interactions-31eHGwEQ.cjs.map → interactions-CcxrVzpg.cjs.map} +1 -1
- package/dist/{interactions-OU94MPXs.js → interactions-CnjfQgw3.js} +2 -2
- package/dist/{interactions-OU94MPXs.js.map → interactions-CnjfQgw3.js.map} +1 -1
- package/dist/{journey-CeJ1QoT2.js → journey-DjvDzHyp.js} +17 -16
- package/dist/{journey-CeJ1QoT2.js.map → journey-DjvDzHyp.js.map} +1 -1
- package/dist/journey-DxlfdFJV.cjs +2 -0
- package/dist/journey-DxlfdFJV.cjs.map +1 -0
- package/dist/{library-request-C9uJFlbq.cjs → library-request-BZ1ekVtl.cjs} +2 -2
- package/dist/{library-request-C9uJFlbq.cjs.map → library-request-BZ1ekVtl.cjs.map} +1 -1
- package/dist/{library-request-DvhuplAB.js → library-request-C8kc5YWv.js} +2 -2
- package/dist/{library-request-DvhuplAB.js.map → library-request-C8kc5YWv.js.map} +1 -1
- package/dist/{long-frames-B8VdA_ny.cjs → long-frames-BGik_Yhy.cjs} +2 -2
- package/dist/{long-frames-B8VdA_ny.cjs.map → long-frames-BGik_Yhy.cjs.map} +1 -1
- package/dist/{long-frames-C_7OutLs.js → long-frames-CZk3XOkH.js} +3 -3
- package/dist/{long-frames-C_7OutLs.js.map → long-frames-CZk3XOkH.js.map} +1 -1
- package/dist/models/batch.d.ts +14 -0
- package/dist/models/config.d.ts +146 -0
- package/dist/models/drop.d.ts +39 -0
- package/dist/models/storage.d.ts +15 -3
- package/dist/{network-D_lloS5t.js → network-51iicpLl.js} +19 -19
- package/dist/{network-D_lloS5t.js.map → network-51iicpLl.js.map} +1 -1
- package/dist/{network-BAV7ipyn.cjs → network-jBbjyAJP.cjs} +2 -2
- package/dist/{network-BAV7ipyn.cjs.map → network-jBbjyAJP.cjs.map} +1 -1
- package/dist/{platform-IHBZGqUe.js → platform-Cjts-8k8.js} +2 -2
- package/dist/{platform-IHBZGqUe.js.map → platform-Cjts-8k8.js.map} +1 -1
- package/dist/{platform-D4wu1eIF.cjs → platform-DW3GFIUE.cjs} +2 -2
- package/dist/{platform-D4wu1eIF.cjs.map → platform-DW3GFIUE.cjs.map} +1 -1
- package/dist/{remote-rules-kuDf5gbe.cjs → remote-rules-ByS34k4e.cjs} +2 -2
- package/dist/{remote-rules-kuDf5gbe.cjs.map → remote-rules-ByS34k4e.cjs.map} +1 -1
- package/dist/{remote-rules-Bt1XsdEQ.js → remote-rules-M-XZ1xbe.js} +2 -2
- package/dist/{remote-rules-Bt1XsdEQ.js.map → remote-rules-M-XZ1xbe.js.map} +1 -1
- package/dist/{sampling-o0VY1mqQ.js → sampling-BN3Oi6SV.js} +9 -9
- package/dist/{sampling-o0VY1mqQ.js.map → sampling-BN3Oi6SV.js.map} +1 -1
- package/dist/{sampling-BI15ds9D.cjs → sampling-b2ck5X98.cjs} +2 -2
- package/dist/{sampling-BI15ds9D.cjs.map → sampling-b2ck5X98.cjs.map} +1 -1
- package/dist/{sanitize-DSIP7amZ.cjs → sanitize-DKp5MRsa.cjs} +2 -2
- package/dist/{sanitize-DSIP7amZ.cjs.map → sanitize-DKp5MRsa.cjs.map} +1 -1
- package/dist/{sanitize-B9UheVKc.js → sanitize-Dwj9JCkI.js} +2 -2
- package/dist/{sanitize-B9UheVKc.js.map → sanitize-Dwj9JCkI.js.map} +1 -1
- package/dist/{sender-BnNj9bOX.js → sender-BBY0IcUo.js} +328 -269
- package/dist/sender-BBY0IcUo.js.map +1 -0
- package/dist/sender-BXoAZKum.cjs +3 -0
- package/dist/sender-BXoAZKum.cjs.map +1 -0
- package/dist/storage/emergency-queue.d.ts +4 -1
- package/dist/storage/eviction.d.ts +40 -0
- package/dist/storage/idb-driver.d.ts +6 -0
- package/dist/storage/indexeddb-storage.d.ts +13 -5
- package/dist/storage/local-storage.d.ts +24 -1
- package/dist/storage/memory-storage.d.ts +7 -0
- package/dist/{storm-Y-yuBhvv.cjs → storm-CKuaBp7i.cjs} +2 -2
- package/dist/{storm-Y-yuBhvv.cjs.map → storm-CKuaBp7i.cjs.map} +1 -1
- package/dist/{storm-BTw0J6eE.js → storm-DhtL2eVr.js} +2 -2
- package/dist/{storm-BTw0J6eE.js.map → storm-DhtL2eVr.js.map} +1 -1
- package/dist/transport/exit-flush.d.ts +6 -0
- package/dist/transport/retry-engine.d.ts +7 -3
- package/dist/transport/status-transport.d.ts +4 -1
- package/dist/utils/console.d.ts +4 -1
- package/package.json +1 -1
- package/dist/constants-Br3b89Wg.cjs +0 -2
- package/dist/constants-Br3b89Wg.cjs.map +0 -1
- package/dist/constants-DM94FjVX.js +0 -96
- package/dist/constants-DM94FjVX.js.map +0 -1
- package/dist/deadline-B5DINjD5.js.map +0 -1
- package/dist/deadline-Cbg2cbUw.cjs.map +0 -1
- package/dist/indexeddb-storage-DNdf1fmL.cjs +0 -2
- package/dist/indexeddb-storage-DNdf1fmL.cjs.map +0 -1
- package/dist/indexeddb-storage-n1qkFBGA.js.map +0 -1
- package/dist/journey-CE2EcwHW.cjs +0 -2
- package/dist/journey-CE2EcwHW.cjs.map +0 -1
- package/dist/sender-BnNj9bOX.js.map +0 -1
- package/dist/sender-D0OsyB1c.cjs +0 -3
- package/dist/sender-D0OsyB1c.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import { n as
|
|
7
|
-
import { n as
|
|
1
|
+
import { A as e, Bt as t, E as n, Et as r, F as i, Ft as a, Ht as o, I as s, It as c, Jt as l, Lt as u, Mt as d, Nt as f, O as p, P as m, Pt as h, R as g, Rt as _, Ut as ee, Vt as te, Xt as v, _n as ne, a as y, c as re, ct as ie, d as b, dn as ae, dt as oe, en as x, f as se, fn as S, gn as ce, i as le, jt as ue, k as de, l as fe, lt as C, mn as pe, n as me, o as he, p as ge, pn as _e, qt as ve, r as ye, rn as be, s as w, u as T, un as xe, vn as E, x as Se, zt as Ce } from "./constants-N99w84xy.js";
|
|
2
|
+
import { n as we, r as Te, t as Ee } from "./error-like-Ywo5uRHo.js";
|
|
3
|
+
import { a as D, i as De, n as Oe, o as ke, r as Ae } from "./sampling-BN3Oi6SV.js";
|
|
4
|
+
import { a as je, i as Me, n as Ne, o as O, r as k } from "./sanitize-Dwj9JCkI.js";
|
|
5
|
+
import { a as Pe, i as Fe, n as Ie, o as A, r as Le, s as Re, t as ze } from "./identity-D4DPjTM9.js";
|
|
6
|
+
import { n as Be, r as Ve, t as He } from "./platform-Cjts-8k8.js";
|
|
7
|
+
import { n as j, t as Ue } from "./batch-DEK4bv9N.js";
|
|
8
|
+
import { n as We } from "./library-request-C8kc5YWv.js";
|
|
9
|
+
import { n as Ge, t as Ke } from "./journey-DjvDzHyp.js";
|
|
8
10
|
//#region src/utils/timer.ts
|
|
9
|
-
function
|
|
10
|
-
return Math.round((performance.now() - e) *
|
|
11
|
+
function M(e) {
|
|
12
|
+
return Math.round((performance.now() - e) * g) / g;
|
|
11
13
|
}
|
|
12
|
-
function
|
|
14
|
+
function N(e, t, n, r, i) {
|
|
13
15
|
e.logMetric(`${t}.duration`, n, "ms", "histogram", {
|
|
14
16
|
status: r,
|
|
15
17
|
...i
|
|
16
18
|
});
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
let a =
|
|
20
|
+
function qe(e, t, n, r, i) {
|
|
21
|
+
let a = M(n);
|
|
20
22
|
e.error(`${t} failed`, r, {
|
|
21
23
|
"action.duration_ms": a,
|
|
22
24
|
status: "FAILURE",
|
|
23
25
|
...i
|
|
24
|
-
}),
|
|
26
|
+
}), N(e, t, a, "FAILURE", i);
|
|
25
27
|
}
|
|
26
|
-
function
|
|
28
|
+
function Je(e, t, n, r) {
|
|
27
29
|
let i = performance.now();
|
|
28
30
|
try {
|
|
29
31
|
let a = n();
|
|
30
|
-
return
|
|
32
|
+
return N(e, t, M(i), "SUCCESS", r), a;
|
|
31
33
|
} catch (n) {
|
|
32
|
-
throw
|
|
34
|
+
throw qe(e, t, i, n, r), n;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
async function
|
|
37
|
+
async function Ye(e, t, n, r) {
|
|
36
38
|
let i = performance.now();
|
|
37
39
|
try {
|
|
38
40
|
let a = await n();
|
|
39
|
-
return
|
|
41
|
+
return N(e, t, M(i), "SUCCESS", r), a;
|
|
40
42
|
} catch (n) {
|
|
41
|
-
throw
|
|
43
|
+
throw qe(e, t, i, n, r), n;
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
//#endregion
|
|
45
47
|
//#region src/core/logger.ts
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
+
var Xe = [n, be];
|
|
49
|
+
function Ze(e, t) {
|
|
48
50
|
let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
|
|
49
|
-
if (!(e instanceof Error) && !
|
|
51
|
+
if (!(e instanceof Error) && !Te(e)) return;
|
|
50
52
|
let t = Error(e.message);
|
|
51
53
|
return t.name = e.name, t.stack = e.stack, t;
|
|
52
54
|
});
|
|
@@ -54,27 +56,27 @@ function qe(e, t) {
|
|
|
54
56
|
let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
|
|
55
57
|
return Error(r ?? typeof e);
|
|
56
58
|
}
|
|
57
|
-
function
|
|
59
|
+
function Qe(e, t, n) {
|
|
58
60
|
return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
|
|
59
61
|
}
|
|
60
|
-
function
|
|
62
|
+
function $e(e, t) {
|
|
61
63
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
|
|
62
64
|
if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
|
|
63
|
-
let t = e, n =
|
|
65
|
+
let t = e, n = Te(e), r = {}, i = 0;
|
|
64
66
|
for (let e of Object.keys(t)) {
|
|
65
67
|
let a = t[e];
|
|
66
|
-
(!n || !
|
|
68
|
+
(!n || !Ee.has(e)) && we(a) && (r[e] = a, i++);
|
|
67
69
|
}
|
|
68
70
|
return i === 0 ? void 0 : r;
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
|
-
function
|
|
73
|
+
function et(e) {
|
|
72
74
|
if (typeof e != "object" || !e || Array.isArray(e) || e instanceof Error) return !1;
|
|
73
75
|
let t = Object.getPrototypeOf(e);
|
|
74
76
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
75
77
|
}
|
|
76
|
-
function
|
|
77
|
-
return
|
|
78
|
+
function tt(e) {
|
|
79
|
+
return Xe.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
|
|
78
80
|
}
|
|
79
81
|
function P(e, t) {
|
|
80
82
|
return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
|
|
@@ -85,7 +87,7 @@ var F = class e {
|
|
|
85
87
|
options;
|
|
86
88
|
levelType;
|
|
87
89
|
constructor(e, t, n = {}) {
|
|
88
|
-
this.bind = e, this.namespace = t, this.options = n, this.levelType =
|
|
90
|
+
this.bind = e, this.namespace = t, this.options = n, this.levelType = tt(t);
|
|
89
91
|
}
|
|
90
92
|
child(t, n = {}) {
|
|
91
93
|
return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
|
|
@@ -117,22 +119,22 @@ var F = class e {
|
|
|
117
119
|
logEvent = (e, t) => {
|
|
118
120
|
this.write("INFO", "event", e, t);
|
|
119
121
|
};
|
|
120
|
-
logMetric = (e, t, n =
|
|
122
|
+
logMetric = (e, t, n = i, r = "gauge", a) => {
|
|
121
123
|
if (!Number.isFinite(t)) {
|
|
122
124
|
this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
|
|
123
125
|
return;
|
|
124
126
|
}
|
|
125
|
-
let
|
|
126
|
-
...P(
|
|
127
|
+
let o = {
|
|
128
|
+
...P(a, this.bind().diagnostics),
|
|
127
129
|
"metric.name": e,
|
|
128
130
|
"metric.value": t,
|
|
129
131
|
"metric.unit": n,
|
|
130
132
|
"metric.type": r
|
|
131
133
|
};
|
|
132
|
-
this.write("INFO", "metric", e,
|
|
134
|
+
this.write("INFO", "metric", e, o, !0);
|
|
133
135
|
};
|
|
134
|
-
timeSync = (e, t, n) =>
|
|
135
|
-
timeAsync = (e, t, n) =>
|
|
136
|
+
timeSync = (e, t, n) => Je(this, e, t, n);
|
|
137
|
+
timeAsync = (e, t, n) => Ye(this, e, t, n);
|
|
136
138
|
write(e, t, n, r, i = !1) {
|
|
137
139
|
let a = this.bind();
|
|
138
140
|
if (a.isDestroyed()) return;
|
|
@@ -159,12 +161,12 @@ var F = class e {
|
|
|
159
161
|
if (i.isDestroyed()) return;
|
|
160
162
|
let a = i.builder.isEnabled(e);
|
|
161
163
|
if (!a && !this.mirrors(i, e)) return;
|
|
162
|
-
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () =>
|
|
164
|
+
let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => et(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : Ze(c, i.diagnostics), u = l === void 0 ? void 0 : Qe(c, l, i.diagnostics);
|
|
163
165
|
if (!a) {
|
|
164
166
|
this.print(i, e, t, s, u, null);
|
|
165
167
|
return;
|
|
166
168
|
}
|
|
167
|
-
let d = l ?
|
|
169
|
+
let d = l ? $e(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
|
|
168
170
|
level: e,
|
|
169
171
|
type: this.levelType,
|
|
170
172
|
body: t,
|
|
@@ -177,7 +179,7 @@ var F = class e {
|
|
|
177
179
|
"error.message": l.message,
|
|
178
180
|
"error.stack_trace": l.stack
|
|
179
181
|
} : {},
|
|
180
|
-
...d === void 0 ? {} : { [
|
|
182
|
+
...d === void 0 ? {} : { [he]: d },
|
|
181
183
|
[y]: i.breadcrumbs.snapshot()
|
|
182
184
|
}
|
|
183
185
|
});
|
|
@@ -189,72 +191,73 @@ var F = class e {
|
|
|
189
191
|
mirrors(e, t) {
|
|
190
192
|
return e.config.enabled && e.console.accepts(t);
|
|
191
193
|
}
|
|
192
|
-
},
|
|
194
|
+
}, nt = {
|
|
193
195
|
TRACE: "debug",
|
|
194
196
|
DEBUG: "debug",
|
|
195
197
|
INFO: "info",
|
|
196
198
|
WARN: "warn",
|
|
197
199
|
ERROR: "error",
|
|
198
200
|
FATAL: "error"
|
|
199
|
-
},
|
|
201
|
+
}, rt = class {
|
|
200
202
|
settings;
|
|
201
203
|
diagnostics;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
limits;
|
|
205
|
+
constructor(e, t, n = r) {
|
|
206
|
+
this.settings = e, this.diagnostics = t, this.limits = n;
|
|
204
207
|
}
|
|
205
208
|
update(e) {
|
|
206
209
|
this.settings = e;
|
|
207
210
|
}
|
|
208
211
|
accepts(e) {
|
|
209
|
-
return this.settings.level === null || !Object.hasOwn(
|
|
210
|
-
}
|
|
211
|
-
write(e, t, r, i
|
|
212
|
-
if (!this.accepts(t) || typeof console > "u" ||
|
|
213
|
-
let
|
|
214
|
-
this.diagnostics.guard("handler.threw", `The library could not print to console.${
|
|
215
|
-
let
|
|
216
|
-
|
|
217
|
-
console[
|
|
212
|
+
return this.settings.level === null || !Object.hasOwn(C, this.settings.level) ? !1 : C[e] >= C[this.settings.level];
|
|
213
|
+
}
|
|
214
|
+
write(e, t, n, r, i) {
|
|
215
|
+
if (!this.accepts(t) || typeof console > "u" || je()) return;
|
|
216
|
+
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = nt[t];
|
|
217
|
+
this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
|
|
218
|
+
let c = [];
|
|
219
|
+
i !== void 0 && c.push(i), r !== void 0 && c.push(Ne(r, this.limits, this.diagnostics)), O(() => {
|
|
220
|
+
console[s](a, o.namespace, e, o[t], "", n, ...c);
|
|
218
221
|
});
|
|
219
222
|
});
|
|
220
223
|
}
|
|
221
|
-
},
|
|
224
|
+
}, it = class {
|
|
222
225
|
value = 0;
|
|
223
226
|
next() {
|
|
224
227
|
return ++this.value;
|
|
225
228
|
}
|
|
226
|
-
},
|
|
227
|
-
function
|
|
228
|
-
return
|
|
229
|
+
}, at = /^[0-9a-f]{32}$/, ot = /^[0-9a-f]{16}$/, st = /[1-9a-f]/;
|
|
230
|
+
function ct(e) {
|
|
231
|
+
return at.test(e.traceId) && st.test(e.traceId) && ot.test(e.spanId) && st.test(e.spanId);
|
|
229
232
|
}
|
|
230
|
-
function
|
|
231
|
-
return
|
|
233
|
+
function lt() {
|
|
234
|
+
return A(16);
|
|
232
235
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
236
|
+
function ut() {
|
|
237
|
+
return A(8);
|
|
235
238
|
}
|
|
236
|
-
function
|
|
239
|
+
function dt() {
|
|
237
240
|
return {
|
|
238
|
-
traceId:
|
|
239
|
-
spanId:
|
|
241
|
+
traceId: lt(),
|
|
242
|
+
spanId: ut(),
|
|
240
243
|
traceFlags: 1,
|
|
241
244
|
startedAt: Date.now()
|
|
242
245
|
};
|
|
243
246
|
}
|
|
244
|
-
function
|
|
247
|
+
function ft(e) {
|
|
245
248
|
return {
|
|
246
249
|
traceId: e.traceId,
|
|
247
250
|
spanId: e.spanId,
|
|
248
251
|
traceFlags: e.traceFlags
|
|
249
252
|
};
|
|
250
253
|
}
|
|
251
|
-
var
|
|
254
|
+
var pt = class {
|
|
252
255
|
diagnostics;
|
|
253
256
|
maxAgeMs;
|
|
254
257
|
load;
|
|
255
|
-
ambient =
|
|
258
|
+
ambient = dt();
|
|
256
259
|
otel;
|
|
257
|
-
constructor(e, t =
|
|
260
|
+
constructor(e, t = pe, n) {
|
|
258
261
|
this.diagnostics = e, this.maxAgeMs = t, this.load = n;
|
|
259
262
|
}
|
|
260
263
|
async loadOtel() {
|
|
@@ -266,7 +269,7 @@ var lt = class {
|
|
|
266
269
|
}
|
|
267
270
|
resolve() {
|
|
268
271
|
let e = this.activeSpanContext();
|
|
269
|
-
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"),
|
|
272
|
+
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), ft(this.ambient)) : e;
|
|
270
273
|
}
|
|
271
274
|
activeSpanContext() {
|
|
272
275
|
let e = this.otel;
|
|
@@ -274,7 +277,7 @@ var lt = class {
|
|
|
274
277
|
let t = e.trace.getActiveSpan();
|
|
275
278
|
if (t === void 0) return;
|
|
276
279
|
let n = t.spanContext();
|
|
277
|
-
if (
|
|
280
|
+
if (ct(n)) return {
|
|
278
281
|
traceId: n.traceId,
|
|
279
282
|
spanId: n.spanId,
|
|
280
283
|
traceFlags: n.traceFlags
|
|
@@ -282,7 +285,7 @@ var lt = class {
|
|
|
282
285
|
});
|
|
283
286
|
}
|
|
284
287
|
rotate(e) {
|
|
285
|
-
return this.ambient =
|
|
288
|
+
return this.ambient = dt(), ft(this.ambient);
|
|
286
289
|
}
|
|
287
290
|
headers() {
|
|
288
291
|
let e = {}, t = this.otel;
|
|
@@ -290,11 +293,11 @@ var lt = class {
|
|
|
290
293
|
t.propagation.inject(t.context.active(), e);
|
|
291
294
|
}), !e.traceparent) {
|
|
292
295
|
let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
|
|
293
|
-
e[
|
|
296
|
+
e[_e] = `00-${t.traceId}-${t.spanId}-${n}`;
|
|
294
297
|
}
|
|
295
298
|
return e;
|
|
296
299
|
}
|
|
297
|
-
},
|
|
300
|
+
}, mt = class {
|
|
298
301
|
buffer;
|
|
299
302
|
pointer = 0;
|
|
300
303
|
filled = !1;
|
|
@@ -311,36 +314,54 @@ var lt = class {
|
|
|
311
314
|
clear() {
|
|
312
315
|
this.buffer = Array(this.capacity), this.pointer = 0, this.filled = !1;
|
|
313
316
|
}
|
|
314
|
-
},
|
|
317
|
+
}, ht = Object.keys(C), gt = ["gzip", "none"], _t = [
|
|
315
318
|
"omit",
|
|
316
319
|
"same-origin",
|
|
317
320
|
"include"
|
|
318
|
-
],
|
|
321
|
+
], vt = [
|
|
319
322
|
"auto",
|
|
320
323
|
"indexeddb",
|
|
321
324
|
"localstorage",
|
|
322
325
|
"memory",
|
|
323
326
|
"none"
|
|
324
|
-
],
|
|
327
|
+
], yt = ["storage", "memory"], bt = [
|
|
325
328
|
"auto",
|
|
326
329
|
"sender",
|
|
327
330
|
"forwarder",
|
|
328
331
|
"off"
|
|
329
|
-
],
|
|
332
|
+
], xt = [
|
|
330
333
|
"auto",
|
|
331
334
|
"provider",
|
|
332
335
|
"client"
|
|
333
|
-
],
|
|
336
|
+
], St = [
|
|
334
337
|
"auto",
|
|
335
338
|
"context",
|
|
336
339
|
"tab",
|
|
337
340
|
"origin"
|
|
338
|
-
],
|
|
341
|
+
], Ct = [
|
|
339
342
|
"error",
|
|
340
343
|
"warn",
|
|
341
344
|
"info",
|
|
342
345
|
"log"
|
|
343
|
-
],
|
|
346
|
+
], wt = ["limited", "until-delivered"], Tt = {
|
|
347
|
+
logFlushIntervalMs: [100, 6e4],
|
|
348
|
+
logBatchSize: [1, 1e3],
|
|
349
|
+
metricFlushIntervalMs: [100, 6e4],
|
|
350
|
+
metricBatchSize: [1, 1e3]
|
|
351
|
+
}, Et = {
|
|
352
|
+
maxBatches: [1, 5e3],
|
|
353
|
+
maxAgeMs: [6e4, 6048e5],
|
|
354
|
+
maxAttempts: [1, 20]
|
|
355
|
+
}, Dt = {
|
|
356
|
+
maxBodyChars: [256, 65536],
|
|
357
|
+
maxAttributeChars: [256, 65536],
|
|
358
|
+
maxAttributeCount: [1, 1024],
|
|
359
|
+
maxStackChars: [256, 65536],
|
|
360
|
+
maxDepth: [1, 16],
|
|
361
|
+
maxArrayLength: [1, 1e4],
|
|
362
|
+
maxNodes: [100, 1e5],
|
|
363
|
+
maxRecordBytes: [1024, Se]
|
|
364
|
+
}, Ot = [6e4, 864e5], kt = [
|
|
344
365
|
"errors",
|
|
345
366
|
"rejections",
|
|
346
367
|
"resourceErrors",
|
|
@@ -351,117 +372,126 @@ var lt = class {
|
|
|
351
372
|
"webVitals",
|
|
352
373
|
"longFrames",
|
|
353
374
|
"fullUrls"
|
|
354
|
-
],
|
|
355
|
-
function
|
|
375
|
+
], At = "null", I = `a level name: ${R(ht)}`, L = `true, false or a list of ${R(Ct)}`, jt = "a list of strings and RegExp patterns", Mt = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", Nt = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", Pt = "a list of strings";
|
|
376
|
+
function R(e) {
|
|
356
377
|
let t = e.map((e) => `"${e}"`);
|
|
357
378
|
return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
358
379
|
}
|
|
359
|
-
function
|
|
380
|
+
function z(e) {
|
|
360
381
|
return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
|
|
361
382
|
}
|
|
362
|
-
function
|
|
363
|
-
e.report("config.invalid", `${t} must be ${n}. The value is ${
|
|
383
|
+
function B(e, t, n, r, i) {
|
|
384
|
+
e.report("config.invalid", `${t} must be ${n}. The value is ${z(r)}. The library keeps ${i}.`);
|
|
364
385
|
}
|
|
365
|
-
function
|
|
386
|
+
function V(e, t, n, r, i) {
|
|
366
387
|
if (t === void 0) return r;
|
|
367
388
|
let a = n.find((e) => e === t);
|
|
368
|
-
return a === void 0 ? (
|
|
389
|
+
return a === void 0 ? (B(i, e, R(n), t, `"${r}"`), r) : a;
|
|
369
390
|
}
|
|
370
|
-
function
|
|
371
|
-
return t === void 0 ? n : typeof t == "boolean" ? t : (
|
|
391
|
+
function H(e, t, n, r) {
|
|
392
|
+
return t === void 0 ? n : typeof t == "boolean" ? t : (B(r, e, "true or false", t, String(n)), n);
|
|
372
393
|
}
|
|
373
|
-
function
|
|
374
|
-
return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (
|
|
394
|
+
function Ft(e, t, n, r) {
|
|
395
|
+
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);
|
|
396
|
+
}
|
|
397
|
+
function It(e, t, n, r, i) {
|
|
398
|
+
if (t === void 0) return r;
|
|
399
|
+
let [a, o] = n;
|
|
400
|
+
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);
|
|
375
401
|
}
|
|
376
|
-
function
|
|
402
|
+
function U(e, t, n, r, i) {
|
|
403
|
+
let a = t ?? {}, o = Object.keys(r);
|
|
404
|
+
return Object.fromEntries(o.map((t) => [t, It(`${e}.${t}`, a[t], r[t], n[t], i)]));
|
|
405
|
+
}
|
|
406
|
+
function W(e) {
|
|
377
407
|
if (typeof e != "string") return;
|
|
378
408
|
let t = e.toUpperCase();
|
|
379
|
-
return
|
|
409
|
+
return ht.find((e) => e === t);
|
|
380
410
|
}
|
|
381
|
-
function
|
|
411
|
+
function Lt(e, t, n, r) {
|
|
382
412
|
if (t === void 0) return n;
|
|
383
|
-
let i =
|
|
384
|
-
return i === void 0 ? (
|
|
413
|
+
let i = W(t);
|
|
414
|
+
return i === void 0 ? (B(r, e, I, t, `"${n}"`), n) : i;
|
|
385
415
|
}
|
|
386
|
-
function
|
|
416
|
+
function G(e, t, n, r, i, a) {
|
|
387
417
|
if (t === void 0) return n;
|
|
388
|
-
if (!Array.isArray(t)) return
|
|
418
|
+
if (!Array.isArray(t)) return B(a, e, r, t, "the list in force"), n;
|
|
389
419
|
let o = [], s = t;
|
|
390
420
|
for (let t of s) {
|
|
391
421
|
let n = i(t);
|
|
392
|
-
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 ${z(t)}. ${e} must be ${r}.`) : o.push(n);
|
|
393
423
|
}
|
|
394
424
|
return o;
|
|
395
425
|
}
|
|
396
|
-
function
|
|
426
|
+
function Rt(e) {
|
|
397
427
|
return typeof e == "string" ? e : void 0;
|
|
398
428
|
}
|
|
399
|
-
function
|
|
429
|
+
function zt(e) {
|
|
400
430
|
return typeof e == "string" || e instanceof RegExp ? e : void 0;
|
|
401
431
|
}
|
|
402
|
-
function
|
|
403
|
-
return
|
|
432
|
+
function Bt(e) {
|
|
433
|
+
return Ct.find((t) => t === e);
|
|
404
434
|
}
|
|
405
|
-
function
|
|
435
|
+
function Vt(e) {
|
|
406
436
|
if (typeof e == "string") try {
|
|
407
437
|
let { origin: t } = new URL(e);
|
|
408
|
-
return t ===
|
|
438
|
+
return t === At ? void 0 : t;
|
|
409
439
|
} catch {
|
|
410
440
|
return;
|
|
411
441
|
}
|
|
412
442
|
}
|
|
413
|
-
function
|
|
414
|
-
return e instanceof RegExp ? e :
|
|
443
|
+
function Ht(e) {
|
|
444
|
+
return e instanceof RegExp ? e : Vt(e);
|
|
415
445
|
}
|
|
416
|
-
function
|
|
446
|
+
function Ut(e) {
|
|
417
447
|
return typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.values(e).every((e) => typeof e == "string");
|
|
418
448
|
}
|
|
419
|
-
function
|
|
420
|
-
if (e !== void 0) return typeof e == "function" ||
|
|
449
|
+
function Wt(e, t, n) {
|
|
450
|
+
if (e !== void 0) return typeof e == "function" || Ut(e) ? e : (B(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
|
|
421
451
|
}
|
|
422
|
-
function
|
|
452
|
+
function Gt(e) {
|
|
423
453
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
424
454
|
}
|
|
425
|
-
function
|
|
426
|
-
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" ||
|
|
455
|
+
function Kt(e, t, n) {
|
|
456
|
+
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || Gt(e) ? e : (n.report("config.invalid", `serializer must be "${v}", "ecs" or an implementation. The library uses "${v}".`), v);
|
|
427
457
|
}
|
|
428
|
-
var
|
|
429
|
-
function
|
|
458
|
+
var qt = new Set(Object.keys(e));
|
|
459
|
+
function Jt(e, t) {
|
|
430
460
|
let n = {}, r = Object.entries(e ?? {});
|
|
431
|
-
for (let [e, i] of r)
|
|
461
|
+
for (let [e, i] of r) qt.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.`);
|
|
432
462
|
return n;
|
|
433
463
|
}
|
|
434
|
-
function
|
|
464
|
+
function Yt(e, t, n) {
|
|
435
465
|
if (e === void 0) return t ?? "DEBUG";
|
|
436
|
-
let r =
|
|
437
|
-
return r === void 0 ? (
|
|
466
|
+
let r = W(e);
|
|
467
|
+
return r === void 0 ? (B(n, "console.level", I, e, "the console level in force"), t) : r;
|
|
438
468
|
}
|
|
439
|
-
function
|
|
469
|
+
function Xt(e, t, n) {
|
|
440
470
|
if (e === void 0) return t;
|
|
441
471
|
if (e === !1) return {
|
|
442
472
|
level: null,
|
|
443
473
|
styles: t.styles
|
|
444
474
|
};
|
|
445
475
|
if (e === !0) return {
|
|
446
|
-
level:
|
|
476
|
+
level: de,
|
|
447
477
|
styles: t.styles
|
|
448
478
|
};
|
|
449
479
|
if (typeof e == "string") {
|
|
450
|
-
let r =
|
|
451
|
-
return r === void 0 ? (
|
|
480
|
+
let r = W(e);
|
|
481
|
+
return r === void 0 ? (B(n, "console", I, e, "the console level in force"), t) : {
|
|
452
482
|
level: r,
|
|
453
483
|
styles: t.styles
|
|
454
484
|
};
|
|
455
485
|
}
|
|
456
486
|
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) : {
|
|
457
|
-
level:
|
|
487
|
+
level: Yt(e.level, t.level, n),
|
|
458
488
|
styles: {
|
|
459
489
|
...t.styles,
|
|
460
|
-
...
|
|
490
|
+
...Jt(e.styles, n)
|
|
461
491
|
}
|
|
462
492
|
};
|
|
463
493
|
}
|
|
464
|
-
function
|
|
494
|
+
function Zt(e, t, n) {
|
|
465
495
|
let r = e ?? {};
|
|
466
496
|
return {
|
|
467
497
|
...t,
|
|
@@ -470,56 +500,70 @@ function zt(e, t, n) {
|
|
|
470
500
|
...t.rates,
|
|
471
501
|
...r.rates
|
|
472
502
|
},
|
|
473
|
-
alwaysSampleTypes:
|
|
474
|
-
remote:
|
|
503
|
+
alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, Pt, Rt, n),
|
|
504
|
+
remote: H("sampling.remote", r.remote, t.remote, n)
|
|
475
505
|
};
|
|
476
506
|
}
|
|
477
|
-
function
|
|
507
|
+
function Qt(e, t, n) {
|
|
478
508
|
let r = e ?? {};
|
|
479
509
|
return {
|
|
480
|
-
mode:
|
|
481
|
-
trustedOrigins:
|
|
482
|
-
openFinRole:
|
|
510
|
+
mode: V("bus.mode", r.mode, bt, t.mode, n),
|
|
511
|
+
trustedOrigins: G("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, Nt, Vt, n),
|
|
512
|
+
openFinRole: V("bus.openFinRole", r.openFinRole, xt, t.openFinRole, n)
|
|
483
513
|
};
|
|
484
514
|
}
|
|
485
|
-
function
|
|
486
|
-
|
|
515
|
+
function $t(e, t, n) {
|
|
516
|
+
let r = e ?? {};
|
|
517
|
+
return {
|
|
518
|
+
scope: V("journey.scope", r.scope, St, t.scope, n),
|
|
519
|
+
maxAgeMs: It("journey.maxAgeMs", r.maxAgeMs, Ot, t.maxAgeMs, n)
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function en(e, t, n) {
|
|
523
|
+
let r = e ?? {};
|
|
524
|
+
return {
|
|
525
|
+
mode: V("retention.mode", r.mode, wt, t.mode, n),
|
|
526
|
+
...U("retention", r, t, Et, n)
|
|
527
|
+
};
|
|
487
528
|
}
|
|
488
|
-
function
|
|
489
|
-
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ?
|
|
529
|
+
function tn(e, t, n) {
|
|
530
|
+
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [], L, Bt, n) : (B(n, "capture.console", L, e, "the value in force"), t);
|
|
490
531
|
}
|
|
491
|
-
function
|
|
532
|
+
function nn(e, t, n) {
|
|
492
533
|
let r = e ?? {}, i = {
|
|
493
534
|
...t,
|
|
494
535
|
...r,
|
|
495
|
-
console:
|
|
496
|
-
longFrameThresholdMs:
|
|
497
|
-
ignoreUrls:
|
|
498
|
-
propagateTraceHeaderTo:
|
|
536
|
+
console: tn(r.console, t.console, n),
|
|
537
|
+
longFrameThresholdMs: Ft("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
|
|
538
|
+
ignoreUrls: G("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, jt, zt, n),
|
|
539
|
+
propagateTraceHeaderTo: G("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, Mt, Ht, n)
|
|
499
540
|
};
|
|
500
|
-
for (let e of
|
|
541
|
+
for (let e of kt) i[e] = H(`capture.${e}`, r[e], t[e], n);
|
|
501
542
|
return i;
|
|
502
543
|
}
|
|
503
|
-
function
|
|
504
|
-
let r = n ??
|
|
544
|
+
function rn(e, t, n) {
|
|
545
|
+
let r = n ?? m, i = {
|
|
505
546
|
...r,
|
|
506
547
|
...e,
|
|
507
548
|
endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
|
|
508
|
-
enabled:
|
|
509
|
-
minLevel:
|
|
510
|
-
compression:
|
|
511
|
-
credentials:
|
|
512
|
-
headers: "headers" in e ?
|
|
513
|
-
storage:
|
|
514
|
-
identity:
|
|
515
|
-
serializer:
|
|
516
|
-
console:
|
|
517
|
-
sampling:
|
|
518
|
-
bus:
|
|
519
|
-
|
|
520
|
-
|
|
549
|
+
enabled: H("enabled", e.enabled, r.enabled, t),
|
|
550
|
+
minLevel: Lt("minLevel", e.minLevel, r.minLevel, t),
|
|
551
|
+
compression: V("compression", e.compression, gt, r.compression, t),
|
|
552
|
+
credentials: V("credentials", e.credentials, _t, r.credentials, t),
|
|
553
|
+
headers: "headers" in e ? Wt(e.headers, r.headers, t) : r.headers,
|
|
554
|
+
storage: V("storage", e.storage, vt, r.storage, t),
|
|
555
|
+
identity: V("identity", e.identity, yt, r.identity, t),
|
|
556
|
+
serializer: Kt(e.serializer, n?.serializer, t),
|
|
557
|
+
console: Xt(e.console, r.console, t),
|
|
558
|
+
sampling: Zt(e.sampling, r.sampling, t),
|
|
559
|
+
bus: Qt(e.bus, r.bus, t),
|
|
560
|
+
batching: U("batching", e.batching, r.batching, Tt, t),
|
|
561
|
+
retention: en(e.retention, r.retention, t),
|
|
562
|
+
limits: U("limits", e.limits, r.limits, Dt, t),
|
|
563
|
+
journey: $t(e.journey, r.journey, t),
|
|
564
|
+
capture: nn(e.capture, r.capture, t)
|
|
521
565
|
};
|
|
522
|
-
if (i.transport !== void 0 && typeof i.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), i.transport = r.transport), i.transportOnExit !== void 0 && typeof i.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), i.transportOnExit = r.transportOnExit), i.endpoint === "") i.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
|
|
566
|
+
if (i.transport !== void 0 && typeof i.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), i.transport = r.transport), i.onDrop !== void 0 && typeof i.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), i.onDrop = r.onDrop), i.transportOnExit !== void 0 && typeof i.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), i.transportOnExit = r.transportOnExit), i.endpoint === "") i.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
|
|
523
567
|
else if (i.endpoint !== null) try {
|
|
524
568
|
new URL(i.endpoint);
|
|
525
569
|
} catch (e) {
|
|
@@ -532,25 +576,25 @@ function Wt(e, t, n) {
|
|
|
532
576
|
(typeof o != "number" || !(o >= 0 && o <= 1)) && (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(o)}. The library uses 1.`), i.sampling.remoteMaxRate = 1);
|
|
533
577
|
let s = Object.entries(i.sampling.rates);
|
|
534
578
|
for (let [e, n] of s) (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.`), i.sampling.rates[e] = 1);
|
|
535
|
-
return i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]),
|
|
579
|
+
return i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]), an(e, t), i;
|
|
536
580
|
}
|
|
537
|
-
function
|
|
538
|
-
let
|
|
539
|
-
for (let
|
|
540
|
-
for (let
|
|
541
|
-
let
|
|
542
|
-
if (typeof
|
|
543
|
-
let i = /* @__PURE__ */ new Set([...Object.keys(
|
|
544
|
-
for (let e of Object.keys(
|
|
581
|
+
function an(e, t) {
|
|
582
|
+
let n = /* @__PURE__ */ new Set([...Object.keys(m), ...ce]);
|
|
583
|
+
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 p) {
|
|
585
|
+
let r = e[n];
|
|
586
|
+
if (typeof r != "object" || !r) continue;
|
|
587
|
+
let i = /* @__PURE__ */ new Set([...Object.keys(m[n]), ...ne[n]]);
|
|
588
|
+
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.`);
|
|
545
589
|
}
|
|
546
590
|
}
|
|
547
|
-
function
|
|
548
|
-
for (let
|
|
549
|
-
for (let
|
|
591
|
+
function on(e, t) {
|
|
592
|
+
for (let n of Object.keys(t)) p.includes(n) || Object.assign(e, { [n]: t[n] });
|
|
593
|
+
for (let n of p) Object.assign(e[n], t[n]);
|
|
550
594
|
}
|
|
551
595
|
//#endregion
|
|
552
596
|
//#region src/core/context.ts
|
|
553
|
-
var
|
|
597
|
+
var sn = class {
|
|
554
598
|
map = /* @__PURE__ */ new Map();
|
|
555
599
|
set(e, t) {
|
|
556
600
|
this.map.set(e, t);
|
|
@@ -570,12 +614,12 @@ var qt = class {
|
|
|
570
614
|
getAll() {
|
|
571
615
|
return Object.fromEntries(this.map);
|
|
572
616
|
}
|
|
573
|
-
},
|
|
617
|
+
}, cn = class {
|
|
574
618
|
handler;
|
|
575
619
|
throttleMs;
|
|
576
620
|
counters = /* @__PURE__ */ new Map();
|
|
577
621
|
lastEmitted = /* @__PURE__ */ new Map();
|
|
578
|
-
constructor(e, t =
|
|
622
|
+
constructor(e, t = s) {
|
|
579
623
|
this.handler = e, this.throttleMs = t;
|
|
580
624
|
}
|
|
581
625
|
setHandler(e) {
|
|
@@ -598,12 +642,12 @@ var qt = class {
|
|
|
598
642
|
count: i
|
|
599
643
|
}, { handler: s } = this;
|
|
600
644
|
if (s) try {
|
|
601
|
-
|
|
645
|
+
O(() => {
|
|
602
646
|
s(o);
|
|
603
647
|
});
|
|
604
648
|
} catch (e) {
|
|
605
|
-
this.count("handler.threw"), typeof console < "u" &&
|
|
606
|
-
console.warn(`${
|
|
649
|
+
this.count("handler.threw"), typeof console < "u" && O(() => {
|
|
650
|
+
console.warn(`${oe} The onDiagnostic handler threw an error.`, e);
|
|
607
651
|
});
|
|
608
652
|
}
|
|
609
653
|
}
|
|
@@ -629,15 +673,94 @@ var qt = class {
|
|
|
629
673
|
reset() {
|
|
630
674
|
this.counters.clear(), this.lastEmitted.clear();
|
|
631
675
|
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
676
|
+
};
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/core/drops.ts
|
|
679
|
+
function K(e, t) {
|
|
680
|
+
e.length < 20 && !e.includes(t) && e.push(t);
|
|
681
|
+
}
|
|
682
|
+
var ln = class {
|
|
683
|
+
config;
|
|
684
|
+
diagnostics;
|
|
685
|
+
pending = /* @__PURE__ */ new Map();
|
|
686
|
+
scheduled = !1;
|
|
687
|
+
reporting = !1;
|
|
688
|
+
constructor(e, t) {
|
|
689
|
+
this.config = e, this.diagnostics = t;
|
|
690
|
+
}
|
|
691
|
+
add(e, t, n = []) {
|
|
692
|
+
if (!this.config.onDrop || this.reporting || t.length === 0 && n.length === 0) return;
|
|
693
|
+
let r = this.pending.get(e);
|
|
694
|
+
r || (r = {
|
|
695
|
+
reason: e,
|
|
696
|
+
records: 0,
|
|
697
|
+
batchIds: [],
|
|
698
|
+
journeyIds: [],
|
|
699
|
+
actions: []
|
|
700
|
+
}, this.pending.set(e, r)), r.records += t.length;
|
|
701
|
+
for (let e of n) K(r.batchIds, e);
|
|
702
|
+
for (let e of t) {
|
|
703
|
+
let t = Ue(e, w);
|
|
704
|
+
typeof t == "string" && K(r.journeyIds, t);
|
|
705
|
+
let n = j(e) ? e.body : void 0;
|
|
706
|
+
typeof n == "string" && K(r.actions, n);
|
|
707
|
+
}
|
|
708
|
+
this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
|
|
709
|
+
this.flush();
|
|
710
|
+
}));
|
|
711
|
+
}
|
|
712
|
+
flush() {
|
|
713
|
+
this.scheduled = !1;
|
|
714
|
+
let e = [...this.pending.values()];
|
|
715
|
+
this.pending.clear();
|
|
716
|
+
let t = this.config.onDrop;
|
|
717
|
+
if (t) {
|
|
718
|
+
this.reporting = !0;
|
|
719
|
+
for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
|
|
720
|
+
We(() => {
|
|
721
|
+
O(() => {
|
|
722
|
+
t(n);
|
|
723
|
+
});
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
this.reporting = !1;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}, un = class {
|
|
730
|
+
onDrop;
|
|
731
|
+
held = [];
|
|
732
|
+
actions = 0;
|
|
733
|
+
constructor(e) {
|
|
734
|
+
this.onDrop = e;
|
|
735
|
+
}
|
|
736
|
+
get records() {
|
|
737
|
+
return this.held;
|
|
738
|
+
}
|
|
739
|
+
get length() {
|
|
740
|
+
return this.held.length;
|
|
741
|
+
}
|
|
742
|
+
push(e) {
|
|
743
|
+
let t = j(e);
|
|
744
|
+
if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
|
|
745
|
+
else {
|
|
746
|
+
let e = this.held.findIndex((e) => j(e) === t), [n] = this.held.splice(e, 1);
|
|
747
|
+
this.onDrop(n);
|
|
748
|
+
}
|
|
749
|
+
this.held.push(e);
|
|
750
|
+
}
|
|
751
|
+
take() {
|
|
752
|
+
let e = this.held;
|
|
753
|
+
return this.held = [], this.actions = 0, e;
|
|
754
|
+
}
|
|
755
|
+
}, dn = "error.", fn = [
|
|
756
|
+
se,
|
|
757
|
+
w,
|
|
758
|
+
re
|
|
636
759
|
];
|
|
637
760
|
function q(e) {
|
|
638
761
|
return e;
|
|
639
762
|
}
|
|
640
|
-
var
|
|
763
|
+
var pn = class {
|
|
641
764
|
deps;
|
|
642
765
|
resourceCache = null;
|
|
643
766
|
constructor(e) {
|
|
@@ -649,9 +772,9 @@ var Zt = class {
|
|
|
649
772
|
isEnabled(e, t) {
|
|
650
773
|
let { config: n } = this.deps;
|
|
651
774
|
if (!n.enabled) return !1;
|
|
652
|
-
if (t !== void 0 &&
|
|
775
|
+
if (t !== void 0 && ie.includes(t)) return !0;
|
|
653
776
|
let r = this.deps.remote.sampling?.minLevel() ?? n.minLevel;
|
|
654
|
-
return
|
|
777
|
+
return C[e] >= C[r];
|
|
655
778
|
}
|
|
656
779
|
build(e) {
|
|
657
780
|
let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o, remote: s } = this.deps;
|
|
@@ -660,7 +783,7 @@ var Zt = class {
|
|
|
660
783
|
dropped: "level"
|
|
661
784
|
};
|
|
662
785
|
let c = r.resolve(), l = i.current();
|
|
663
|
-
if (!
|
|
786
|
+
if (!Ae({
|
|
664
787
|
level: e.level,
|
|
665
788
|
type: e.type,
|
|
666
789
|
namespace: e.namespace,
|
|
@@ -670,26 +793,26 @@ var Zt = class {
|
|
|
670
793
|
record: null,
|
|
671
794
|
dropped: "sampling"
|
|
672
795
|
};
|
|
673
|
-
let u = a.next(), d =
|
|
796
|
+
let u = a.next(), d = He(n), f = t.capture.fullUrls ? d : Ve(d), p, m = 0;
|
|
674
797
|
try {
|
|
675
|
-
let t =
|
|
798
|
+
let t = k(this.deps.context.getAll(), o, n), r = k(e.scoped ?? {}, o, n), i = k(e.payload ?? {}, o, n);
|
|
676
799
|
m = t.bytes + r.bytes + i.bytes, p = {
|
|
677
800
|
...q(t.value),
|
|
678
801
|
...q(r.value),
|
|
679
802
|
...q(i.value)
|
|
680
803
|
};
|
|
681
804
|
} catch (e) {
|
|
682
|
-
n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [
|
|
805
|
+
n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [ge]: !0 };
|
|
683
806
|
}
|
|
684
|
-
p[
|
|
685
|
-
let h =
|
|
807
|
+
p[b] = e.type, p[T] = u, p[me] = e.namespace, p[se] = f, l && (p[w] = l.id, p[re] = l.name, l.parentId !== void 0 && (p[fe] = l.parentId));
|
|
808
|
+
let h = Me(e.body, o.maxBodyChars);
|
|
686
809
|
h !== e.body && n.count("record.truncated");
|
|
687
810
|
let g = {
|
|
688
|
-
timeUnixNano:
|
|
811
|
+
timeUnixNano: ke(),
|
|
689
812
|
traceId: c.traceId,
|
|
690
813
|
spanId: c.spanId,
|
|
691
814
|
traceFlags: c.traceFlags,
|
|
692
|
-
severityNumber:
|
|
815
|
+
severityNumber: x[e.level],
|
|
693
816
|
severityText: e.level,
|
|
694
817
|
body: h,
|
|
695
818
|
attributes: p,
|
|
@@ -710,22 +833,22 @@ var Zt = class {
|
|
|
710
833
|
dropped: "redact"
|
|
711
834
|
};
|
|
712
835
|
let t = e ?? g;
|
|
713
|
-
if (!
|
|
836
|
+
if (!D(t)) return t === g ? (n.report("record.dropped_malformed", "The redact hook changed the record to a shape that is not a record. The library dropped it."), {
|
|
714
837
|
record: null,
|
|
715
838
|
dropped: "malformed"
|
|
716
839
|
}) : (n.report("record.dropped_by_redact", "The redact hook returned a value that is not a record. The library dropped the record."), {
|
|
717
840
|
record: null,
|
|
718
841
|
dropped: "redact"
|
|
719
842
|
});
|
|
720
|
-
if (
|
|
843
|
+
if (De(t.severityText)) {
|
|
721
844
|
if (t !== g) {
|
|
722
|
-
let e =
|
|
845
|
+
let e = k(t.attributes, o, n);
|
|
723
846
|
g = {
|
|
724
847
|
...t,
|
|
725
848
|
attributes: q(e.value)
|
|
726
849
|
}, m = e.bytes;
|
|
727
850
|
}
|
|
728
|
-
g.severityNumber =
|
|
851
|
+
g.severityNumber = x[g.severityText];
|
|
729
852
|
} else return n.report("record.dropped_malformed", "The redact hook set a severityText that is not a log level. The library dropped the record."), {
|
|
730
853
|
record: null,
|
|
731
854
|
dropped: "malformed"
|
|
@@ -737,19 +860,19 @@ var Zt = class {
|
|
|
737
860
|
body: g.body
|
|
738
861
|
});
|
|
739
862
|
let t = {
|
|
740
|
-
[
|
|
863
|
+
[b]: e.type,
|
|
741
864
|
[T]: u,
|
|
742
|
-
[
|
|
743
|
-
[
|
|
744
|
-
[
|
|
865
|
+
[me]: e.namespace,
|
|
866
|
+
[le]: !0,
|
|
867
|
+
[ye]: m
|
|
745
868
|
};
|
|
746
|
-
for (let e of
|
|
747
|
-
for (let [e, n] of Object.entries(g.attributes)) e.startsWith(
|
|
748
|
-
let r =
|
|
749
|
-
r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t,
|
|
869
|
+
for (let e of fn) e in g.attributes && (t[e] = g.attributes[e]);
|
|
870
|
+
for (let [e, n] of Object.entries(g.attributes)) e.startsWith(dn) && (t[e] = n);
|
|
871
|
+
let r = k(t, o, n).bytes;
|
|
872
|
+
r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, he), r = k(t, o, n).bytes);
|
|
750
873
|
let i = g.attributes[y];
|
|
751
874
|
if (i !== void 0) {
|
|
752
|
-
let e =
|
|
875
|
+
let e = k(i, o, n).bytes;
|
|
753
876
|
r + e <= o.maxRecordBytes && (t[y] = i);
|
|
754
877
|
}
|
|
755
878
|
g.attributes = t;
|
|
@@ -758,32 +881,32 @@ var Zt = class {
|
|
|
758
881
|
}
|
|
759
882
|
resource() {
|
|
760
883
|
if (this.resourceCache) return this.resourceCache;
|
|
761
|
-
let { config:
|
|
884
|
+
let { config: e, identity: n, platform: r } = this.deps;
|
|
762
885
|
return this.resourceCache = {
|
|
763
|
-
[
|
|
764
|
-
[
|
|
765
|
-
[f]:
|
|
766
|
-
[
|
|
767
|
-
[ee]:
|
|
768
|
-
[te]:
|
|
886
|
+
[u]: e.serviceName,
|
|
887
|
+
[_]: e.serviceVersion,
|
|
888
|
+
[f]: e.environment,
|
|
889
|
+
[o]: ae,
|
|
890
|
+
[ee]: S,
|
|
891
|
+
[te]: xe,
|
|
769
892
|
[h]: r.platform,
|
|
770
|
-
[
|
|
771
|
-
[
|
|
772
|
-
[
|
|
773
|
-
[
|
|
774
|
-
...r.openfinUuid === void 0 ? {} : { [
|
|
775
|
-
...r.openfinName === void 0 ? {} : { [
|
|
893
|
+
[Ce]: n.sessionId,
|
|
894
|
+
[t]: n.tabId,
|
|
895
|
+
[d]: n.contextId,
|
|
896
|
+
[ue]: r.userAgent,
|
|
897
|
+
...r.openfinUuid === void 0 ? {} : { [c]: r.openfinUuid },
|
|
898
|
+
...r.openfinName === void 0 ? {} : { [a]: r.openfinName }
|
|
776
899
|
}, this.resourceCache;
|
|
777
900
|
}
|
|
778
|
-
},
|
|
779
|
-
errors: async () => (await import("./errors-
|
|
780
|
-
network: async () => (await import("./network-
|
|
781
|
-
interactions: async () => (await import("./interactions-
|
|
901
|
+
}, mn = {
|
|
902
|
+
errors: async () => (await import("./errors-CQusIGWJ.js")).ErrorCapture,
|
|
903
|
+
network: async () => (await import("./network-51iicpLl.js")).NetworkCapture,
|
|
904
|
+
interactions: async () => (await import("./interactions-CnjfQgw3.js")).InteractionCapture,
|
|
782
905
|
webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
|
|
783
|
-
longFrames: async () => (await import("./long-frames-
|
|
784
|
-
console: async () => (await import("./console-
|
|
785
|
-
}, J = Symbol.for(
|
|
786
|
-
function
|
|
906
|
+
longFrames: async () => (await import("./long-frames-CZk3XOkH.js")).LongFrameCapture,
|
|
907
|
+
console: async () => (await import("./console-C9Y639mn.js")).ConsoleCapture
|
|
908
|
+
}, J = Symbol.for(ve), Y = Symbol.for(l), hn = ["batching", "retention"];
|
|
909
|
+
function gn(e) {
|
|
787
910
|
return JSON.stringify({
|
|
788
911
|
...e,
|
|
789
912
|
webVitalsLoader: e.webVitalsLoader !== void 0,
|
|
@@ -791,7 +914,7 @@ function $t(e) {
|
|
|
791
914
|
propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String)
|
|
792
915
|
});
|
|
793
916
|
}
|
|
794
|
-
function
|
|
917
|
+
function _n(e) {
|
|
795
918
|
return {
|
|
796
919
|
...e,
|
|
797
920
|
endpoint: null,
|
|
@@ -804,12 +927,12 @@ function en(e) {
|
|
|
804
927
|
};
|
|
805
928
|
}
|
|
806
929
|
function X(e) {
|
|
807
|
-
return e.sdkVersion ===
|
|
930
|
+
return e.sdkVersion === S;
|
|
808
931
|
}
|
|
809
932
|
var Z = class e {
|
|
810
933
|
degraded;
|
|
811
934
|
static local = null;
|
|
812
|
-
sdkVersion =
|
|
935
|
+
sdkVersion = S;
|
|
813
936
|
diagnostics;
|
|
814
937
|
config;
|
|
815
938
|
platform;
|
|
@@ -817,21 +940,24 @@ var Z = class e {
|
|
|
817
940
|
stores;
|
|
818
941
|
identityBuiltAs;
|
|
819
942
|
sessionTouch;
|
|
820
|
-
context = new
|
|
943
|
+
context = new sn();
|
|
821
944
|
breadcrumbs;
|
|
822
945
|
tracing;
|
|
823
|
-
sequence = new
|
|
946
|
+
sequence = new it();
|
|
824
947
|
journey;
|
|
825
948
|
builder;
|
|
826
949
|
remote = { sampling: null };
|
|
827
950
|
console;
|
|
951
|
+
drops;
|
|
828
952
|
bus = null;
|
|
829
953
|
busBuilt;
|
|
830
954
|
busLoad;
|
|
831
955
|
storageBuiltAs;
|
|
832
956
|
sender;
|
|
833
957
|
senderLoad;
|
|
834
|
-
pendingRecords =
|
|
958
|
+
pendingRecords = new un((e) => {
|
|
959
|
+
this.dropHeld(e);
|
|
960
|
+
});
|
|
835
961
|
captures = [];
|
|
836
962
|
captureGeneration = 0;
|
|
837
963
|
captureOnce = {
|
|
@@ -839,7 +965,9 @@ var Z = class e {
|
|
|
839
965
|
navigationTiming: !1,
|
|
840
966
|
longFrames: !1
|
|
841
967
|
};
|
|
842
|
-
bootBuffer =
|
|
968
|
+
bootBuffer = new un((e) => {
|
|
969
|
+
this.dropHeld(e);
|
|
970
|
+
});
|
|
843
971
|
forwardBuffer = [];
|
|
844
972
|
forwardScheduled = !1;
|
|
845
973
|
roleResolved = !1;
|
|
@@ -847,13 +975,19 @@ var Z = class e {
|
|
|
847
975
|
ready = !1;
|
|
848
976
|
destroyed = !1;
|
|
849
977
|
lastGapAt = 0;
|
|
978
|
+
limits;
|
|
979
|
+
journeyOptions;
|
|
980
|
+
tunablesLocked = !0;
|
|
850
981
|
constructor(e, t = !1) {
|
|
851
|
-
this.degraded = t, this.diagnostics = new
|
|
982
|
+
this.degraded = t, this.diagnostics = new cn(e.onDiagnostic), this.platform = Be(this.diagnostics), this.config = rn(e, this.diagnostics), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" ? Le() : ze, this.identity = Re(this.diagnostics, this.stores), this.sessionTouch = new Ie(this.diagnostics, this.stores), this.breadcrumbs = new mt(50), this.tracing = new pt(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new rt(this.config.console, this.diagnostics, this.limits), this.drops = new ln(this.config, this.diagnostics), this.journeyOptions = {
|
|
983
|
+
...Ke,
|
|
984
|
+
maxAgeMs: this.config.journey.maxAgeMs
|
|
985
|
+
}, this.journey = new Ge(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
|
|
852
986
|
this.bus?.broadcastJourney(e);
|
|
853
|
-
}, this.stores), this.builder = new
|
|
987
|
+
}, this.stores), this.builder = new pn({
|
|
854
988
|
remote: this.remote,
|
|
855
989
|
config: this.config,
|
|
856
|
-
limits:
|
|
990
|
+
limits: this.limits,
|
|
857
991
|
diagnostics: this.diagnostics,
|
|
858
992
|
context: this.context,
|
|
859
993
|
journey: this.journey,
|
|
@@ -888,30 +1022,42 @@ var Z = class e {
|
|
|
888
1022
|
isDestroyed() {
|
|
889
1023
|
return this.destroyed;
|
|
890
1024
|
}
|
|
891
|
-
static configure(t) {
|
|
892
|
-
let
|
|
893
|
-
if (
|
|
1025
|
+
static configure(t, n = !1) {
|
|
1026
|
+
let r = e.local;
|
|
1027
|
+
if (r && !r.destroyed) return r.reconfigure(_n(t)), r;
|
|
894
1028
|
e.local = null;
|
|
895
|
-
let
|
|
896
|
-
if (
|
|
897
|
-
if (!X(
|
|
898
|
-
if (!
|
|
1029
|
+
let i = e.pinned();
|
|
1030
|
+
if (i) {
|
|
1031
|
+
if (!X(i)) return e.startDegraded(t, i.sdkVersion);
|
|
1032
|
+
if (!i.destroyed) return i.reconfigure(t), i;
|
|
899
1033
|
}
|
|
900
|
-
let
|
|
901
|
-
return globalThis[J] =
|
|
1034
|
+
let a = new e(t);
|
|
1035
|
+
return a.tunablesLocked = !n, globalThis[J] = a, Reflect.deleteProperty(globalThis, Y), a.init(), a;
|
|
902
1036
|
}
|
|
903
1037
|
static startDegraded(t, n) {
|
|
904
|
-
let r = new e(
|
|
1038
|
+
let r = new e(_n(t), !0);
|
|
905
1039
|
e.local = r;
|
|
906
1040
|
let i = typeof n == "string" ? n : "before 0.9.0";
|
|
907
|
-
return r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${
|
|
1041
|
+
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.`, {
|
|
908
1042
|
found: i,
|
|
909
|
-
own:
|
|
1043
|
+
own: S
|
|
910
1044
|
}), r.init(), r;
|
|
911
1045
|
}
|
|
912
1046
|
reconfigure(e) {
|
|
913
|
-
let t = this.keepDestination(e), n =
|
|
914
|
-
|
|
1047
|
+
let t = this.keepDestination(e), n = gn(this.config.capture), r = rn(t, this.diagnostics, this.config);
|
|
1048
|
+
this.keepStartupTunables(r), on(this.config, r), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), gn(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
|
|
1049
|
+
}
|
|
1050
|
+
keepStartupTunables(e) {
|
|
1051
|
+
if (this.senderLoad !== void 0 && this.keepSections(e, hn), !this.tunablesLocked) {
|
|
1052
|
+
this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
this.keepSections(e, ["limits"]);
|
|
1056
|
+
let { maxAgeMs: t } = this.config.journey;
|
|
1057
|
+
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);
|
|
1058
|
+
}
|
|
1059
|
+
keepSections(e, t) {
|
|
1060
|
+
for (let n of t) JSON.stringify(e[n]) !== JSON.stringify(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] }));
|
|
915
1061
|
}
|
|
916
1062
|
keepBuiltStorage() {
|
|
917
1063
|
let e = this.storageBuiltAs;
|
|
@@ -960,7 +1106,7 @@ var Z = class e {
|
|
|
960
1106
|
}
|
|
961
1107
|
async buildBus() {
|
|
962
1108
|
try {
|
|
963
|
-
let { Bus: e } = await import("./bus-
|
|
1109
|
+
let { Bus: e } = await import("./bus-HVQ8E72V.js");
|
|
964
1110
|
if (this.destroyed) return null;
|
|
965
1111
|
let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
966
1112
|
onRecords: (e) => {
|
|
@@ -984,7 +1130,10 @@ var Z = class e {
|
|
|
984
1130
|
return this.bus?.getRole() ?? "sender";
|
|
985
1131
|
}
|
|
986
1132
|
syncSender() {
|
|
987
|
-
return !
|
|
1133
|
+
return !this.hasDestination() || this.role() !== "sender" ? Promise.resolve() : this.loadSender();
|
|
1134
|
+
}
|
|
1135
|
+
hasDestination() {
|
|
1136
|
+
return !!this.config.endpoint || this.config.transport !== void 0;
|
|
988
1137
|
}
|
|
989
1138
|
loadSender() {
|
|
990
1139
|
return this.senderLoad ??= this.buildSender(), this.senderLoad;
|
|
@@ -992,10 +1141,11 @@ var Z = class e {
|
|
|
992
1141
|
async buildSender() {
|
|
993
1142
|
this.storageBuiltAs = this.config.storage;
|
|
994
1143
|
try {
|
|
995
|
-
let { Sender: e } = await import("./sender-
|
|
1144
|
+
let { Sender: e } = await import("./sender-BBY0IcUo.js"), t = this.destroyed ? null : await e.create({
|
|
996
1145
|
config: this.config,
|
|
997
1146
|
diagnostics: this.diagnostics,
|
|
998
1147
|
onGap: this.reportGap,
|
|
1148
|
+
onLoss: this.reportLoss,
|
|
999
1149
|
remote: this.remote
|
|
1000
1150
|
});
|
|
1001
1151
|
if (!t || this.destroyed) {
|
|
@@ -1004,28 +1154,26 @@ var Z = class e {
|
|
|
1004
1154
|
}
|
|
1005
1155
|
this.sender = t;
|
|
1006
1156
|
} catch (e) {
|
|
1007
|
-
this.senderLoad = void 0, this.diagnostics.report("pipeline.crashed", "The delivery stack did not load. The library does not send records.", { held: this.pendingRecords.length }, e);
|
|
1157
|
+
this.senderLoad = void 0, this.diagnostics.report("pipeline.crashed", "The delivery stack did not load. The library does not send records.", { held: this.pendingRecords.length }, e), this.drops.add("load_failed", this.pendingRecords.records);
|
|
1008
1158
|
}
|
|
1009
|
-
let e
|
|
1010
|
-
this.pendingRecords = [];
|
|
1011
|
-
for (let t of e) this.sender?.push(t);
|
|
1159
|
+
for (let e of this.pendingRecords.take()) this.sender?.push(e);
|
|
1012
1160
|
}
|
|
1013
1161
|
async installCaptures() {
|
|
1014
1162
|
if (this.degraded) return;
|
|
1015
|
-
let e = ++this.captureGeneration, t = this.config.capture,
|
|
1016
|
-
(t.errors || t.rejections || t.resourceErrors) &&
|
|
1017
|
-
let
|
|
1163
|
+
let e = ++this.captureGeneration, t = this.config.capture, r = [];
|
|
1164
|
+
(t.errors || t.rejections || t.resourceErrors) && r.push("errors"), (t.fetch || t.xhr) && r.push("network"), (t.interactions || t.navigation) && r.push("interactions"), t.webVitals && r.push("webVitals"), t.longFrames && r.push("longFrames"), (Array.isArray(t.console) ? t.console.length > 0 : t.console) && r.push("console");
|
|
1165
|
+
let i = await Promise.all(r.map((e) => this.loadCapture(e)));
|
|
1018
1166
|
if (e !== this.captureGeneration || this.destroyed) return;
|
|
1019
1167
|
this.uninstallCaptures();
|
|
1020
|
-
let
|
|
1168
|
+
let a = {
|
|
1021
1169
|
config: this.config,
|
|
1022
1170
|
diagnostics: this.diagnostics,
|
|
1023
1171
|
breadcrumbs: this.breadcrumbs,
|
|
1024
1172
|
tracing: this.tracing,
|
|
1025
|
-
logger: new F(() => this,
|
|
1173
|
+
logger: new F(() => this, n),
|
|
1026
1174
|
once: this.captureOnce
|
|
1027
1175
|
};
|
|
1028
|
-
for (let e of
|
|
1176
|
+
for (let e of i) e && this.captures.push(new e(a));
|
|
1029
1177
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
|
|
1030
1178
|
e.install();
|
|
1031
1179
|
});
|
|
@@ -1037,7 +1185,7 @@ var Z = class e {
|
|
|
1037
1185
|
this.captures.length = 0;
|
|
1038
1186
|
}
|
|
1039
1187
|
loadCapture(e) {
|
|
1040
|
-
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`,
|
|
1188
|
+
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, mn[e]);
|
|
1041
1189
|
}
|
|
1042
1190
|
registerWorker(e) {
|
|
1043
1191
|
this.destroyed || this.constructBus().then((t) => {
|
|
@@ -1050,65 +1198,66 @@ var Z = class e {
|
|
|
1050
1198
|
if (this.destroyed) return;
|
|
1051
1199
|
this.destroyed = !0, this.uninstallCaptures();
|
|
1052
1200
|
let t = this.sender?.destroy();
|
|
1053
|
-
this.journey.destroy(), this.bus?.destroy(), this.
|
|
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, J), globalThis[Y] = this);
|
|
1054
1202
|
}
|
|
1055
1203
|
emit(e) {
|
|
1056
|
-
e && !this.destroyed && (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.
|
|
1204
|
+
e && !this.destroyed && (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
|
|
1057
1205
|
}
|
|
1058
1206
|
route(e) {
|
|
1059
1207
|
this.role() === "forwarder" ? this.forward(e) : this.deliver(e);
|
|
1060
1208
|
}
|
|
1061
1209
|
deliver(e) {
|
|
1062
|
-
this.sender ? this.sender.push(e) : this.senderLoad ? this.
|
|
1210
|
+
this.sender ? this.sender.push(e) : this.senderLoad ? this.pendingRecords.push(e) : (this.diagnostics.count("record.dropped_no_destination"), this.hasDestination() && this.drops.add("load_failed", [e]));
|
|
1063
1211
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1212
|
+
dropHeld(e) {
|
|
1213
|
+
this.diagnostics.count("record.dropped_boot_buffer_full"), this.drops.add("buffer_full", [e]);
|
|
1066
1214
|
}
|
|
1067
1215
|
forward(e) {
|
|
1068
1216
|
this.forwardBuffer.push(e), !this.forwardScheduled && (this.forwardScheduled = !0, queueMicrotask(() => {
|
|
1069
|
-
this.forwardScheduled = !1;
|
|
1070
|
-
let e = this.forwardBuffer;
|
|
1071
|
-
this.forwardBuffer = [], e.length > 0 && this.bus?.sendRecords(e);
|
|
1217
|
+
this.forwardScheduled = !1, this.sendForwarded();
|
|
1072
1218
|
}));
|
|
1073
1219
|
}
|
|
1220
|
+
sendForwarded() {
|
|
1221
|
+
let e = this.forwardBuffer;
|
|
1222
|
+
this.forwardBuffer = [], e.length > 0 && this.bus?.sendRecords(e);
|
|
1223
|
+
}
|
|
1074
1224
|
ingestForwarded(e) {
|
|
1075
1225
|
if (!Array.isArray(e)) this.diagnostics.count("record.dropped_malformed");
|
|
1076
|
-
else for (let t of e)
|
|
1226
|
+
else for (let t of e) D(t) ? Oe(t, this.config, this.remote.sampling?.current() ?? null) ? this.deliver(t) : this.diagnostics.count("record.dropped_by_sampling") : this.diagnostics.count("record.dropped_malformed");
|
|
1077
1227
|
}
|
|
1078
1228
|
releaseBootBuffer() {
|
|
1079
|
-
let e = this.bootBuffer;
|
|
1080
|
-
this.bootBuffer = [];
|
|
1081
|
-
let t = this.journey.current();
|
|
1229
|
+
let e = this.bootBuffer.take(), t = this.journey.current();
|
|
1082
1230
|
for (let n of e) t && !n.attributes["journey.id"] && (n.attributes["journey.id"] = t.id, n.attributes["journey.name"] = t.name), this.route(n);
|
|
1083
1231
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1232
|
+
reportLoss = (e, t, n) => {
|
|
1233
|
+
this.drops.add(e, t, n);
|
|
1234
|
+
};
|
|
1235
|
+
reportGap = (e, t) => {
|
|
1236
|
+
this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
|
|
1237
|
+
let n = Date.now();
|
|
1238
|
+
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, be).warn("stored records were dropped before delivery", {
|
|
1087
1239
|
"gap.batches": e.batches,
|
|
1088
1240
|
"gap.records": e.records,
|
|
1089
1241
|
"gap.reason": e.reason
|
|
1090
1242
|
}));
|
|
1091
1243
|
};
|
|
1092
1244
|
regenerateTabId() {
|
|
1093
|
-
let e =
|
|
1245
|
+
let e = Fe(this.diagnostics);
|
|
1094
1246
|
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.", {
|
|
1095
1247
|
was: this.identity.tabId,
|
|
1096
1248
|
now: e
|
|
1097
|
-
}), this.identity.tabId = e,
|
|
1249
|
+
}), this.identity.tabId = e, Pe(e, this.diagnostics, this.stores), this.builder.invalidateResource();
|
|
1098
1250
|
}
|
|
1099
1251
|
async queueDepth() {
|
|
1100
1252
|
return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
|
|
1101
1253
|
}
|
|
1102
1254
|
async flush() {
|
|
1103
|
-
|
|
1104
|
-
let e = this.forwardBuffer;
|
|
1105
|
-
this.forwardBuffer = [], e.length > 0 && this.bus?.sendRecords(e);
|
|
1106
|
-
} else await this.senderLoad, await this.sender?.flush();
|
|
1255
|
+
this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
|
|
1107
1256
|
}
|
|
1108
1257
|
};
|
|
1109
1258
|
//#endregion
|
|
1110
1259
|
//#region src/transport/memory-transport.ts
|
|
1111
|
-
function
|
|
1260
|
+
function vn() {
|
|
1112
1261
|
let e = [], t = [], n = { status: 200 };
|
|
1113
1262
|
return {
|
|
1114
1263
|
transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
|
|
@@ -1127,100 +1276,100 @@ function tn() {
|
|
|
1127
1276
|
}
|
|
1128
1277
|
//#endregion
|
|
1129
1278
|
//#region src/index.ts
|
|
1130
|
-
var
|
|
1279
|
+
var yn = /* @__PURE__ */ new Map();
|
|
1131
1280
|
function Q() {
|
|
1132
|
-
return (Z.current() ?? Z.stopped()) || Z.configure({});
|
|
1281
|
+
return (Z.current() ?? Z.stopped()) || Z.configure({}, !0);
|
|
1133
1282
|
}
|
|
1134
|
-
function
|
|
1283
|
+
function bn(e) {
|
|
1135
1284
|
Z.configure(e);
|
|
1136
1285
|
}
|
|
1137
|
-
function
|
|
1286
|
+
function xn(e, t) {
|
|
1138
1287
|
if (t) return new F(Q, e, t);
|
|
1139
|
-
let n =
|
|
1140
|
-
return n || (n = new F(Q, e),
|
|
1288
|
+
let n = yn.get(e);
|
|
1289
|
+
return n || (n = new F(Q, e), yn.set(e, n)), n;
|
|
1141
1290
|
}
|
|
1142
1291
|
function $() {
|
|
1143
|
-
return
|
|
1292
|
+
return xn("app");
|
|
1144
1293
|
}
|
|
1145
|
-
function
|
|
1294
|
+
function Sn(e, t) {
|
|
1146
1295
|
$().trace(e, t);
|
|
1147
1296
|
}
|
|
1148
|
-
function
|
|
1297
|
+
function Cn(e, t) {
|
|
1149
1298
|
$().debug(e, t);
|
|
1150
1299
|
}
|
|
1151
|
-
function
|
|
1300
|
+
function wn(e, t) {
|
|
1152
1301
|
$().info(e, t);
|
|
1153
1302
|
}
|
|
1154
|
-
function
|
|
1303
|
+
function Tn(e, t) {
|
|
1155
1304
|
$().warn(e, t);
|
|
1156
1305
|
}
|
|
1157
|
-
function
|
|
1306
|
+
function En(e, t, n) {
|
|
1158
1307
|
$().error(e, t, n);
|
|
1159
1308
|
}
|
|
1160
|
-
function
|
|
1309
|
+
function Dn(e, t, n) {
|
|
1161
1310
|
$().fatal(e, t, n);
|
|
1162
1311
|
}
|
|
1163
|
-
function
|
|
1312
|
+
function On(e, t) {
|
|
1164
1313
|
$().logAction(e, t);
|
|
1165
1314
|
}
|
|
1166
|
-
function
|
|
1315
|
+
function kn(e, t) {
|
|
1167
1316
|
$().logEvent(e, t);
|
|
1168
1317
|
}
|
|
1169
|
-
function
|
|
1318
|
+
function An(e, t, n, r, i) {
|
|
1170
1319
|
$().logMetric(e, t, n, r, i);
|
|
1171
1320
|
}
|
|
1172
|
-
function
|
|
1321
|
+
function jn(e, t, n) {
|
|
1173
1322
|
return $().timeSync(e, t, n);
|
|
1174
1323
|
}
|
|
1175
|
-
function
|
|
1324
|
+
function Mn(e, t, n) {
|
|
1176
1325
|
return $().timeAsync(e, t, n);
|
|
1177
1326
|
}
|
|
1178
|
-
function
|
|
1327
|
+
function Nn(e, t) {
|
|
1179
1328
|
Q().context.set(e, t);
|
|
1180
1329
|
}
|
|
1181
|
-
function
|
|
1330
|
+
function Pn(e) {
|
|
1182
1331
|
Q().context.setMany(e);
|
|
1183
1332
|
}
|
|
1184
|
-
function
|
|
1333
|
+
function Fn(e) {
|
|
1185
1334
|
Q().context.remove(e);
|
|
1186
1335
|
}
|
|
1187
|
-
function
|
|
1336
|
+
function In(e, t) {
|
|
1188
1337
|
return Q().journey.start(e, t);
|
|
1189
1338
|
}
|
|
1190
|
-
function
|
|
1339
|
+
function Ln() {
|
|
1191
1340
|
Q().journey.end();
|
|
1192
1341
|
}
|
|
1193
|
-
function
|
|
1342
|
+
function Rn() {
|
|
1194
1343
|
return Q().journey.current();
|
|
1195
1344
|
}
|
|
1196
|
-
function
|
|
1345
|
+
function zn() {
|
|
1197
1346
|
return Q().journey.getToken();
|
|
1198
1347
|
}
|
|
1199
|
-
function
|
|
1348
|
+
function Bn(e) {
|
|
1200
1349
|
return Q().journey.adopt(e, "manual", !0);
|
|
1201
1350
|
}
|
|
1202
|
-
function
|
|
1351
|
+
function Vn(e) {
|
|
1203
1352
|
Q().registerWorker(e);
|
|
1204
1353
|
}
|
|
1205
|
-
function
|
|
1354
|
+
function Hn() {
|
|
1206
1355
|
Q().tracing.rotate("explicit");
|
|
1207
1356
|
}
|
|
1208
|
-
function
|
|
1357
|
+
function Un() {
|
|
1209
1358
|
return Q().tracing.headers();
|
|
1210
1359
|
}
|
|
1211
|
-
function
|
|
1360
|
+
function Wn() {
|
|
1212
1361
|
return Q().flush();
|
|
1213
1362
|
}
|
|
1214
|
-
function
|
|
1363
|
+
function Gn() {
|
|
1215
1364
|
return Q().queueDepth();
|
|
1216
1365
|
}
|
|
1217
|
-
function
|
|
1366
|
+
function Kn() {
|
|
1218
1367
|
return Q().diagnostics.snapshot();
|
|
1219
1368
|
}
|
|
1220
|
-
async function
|
|
1369
|
+
async function qn() {
|
|
1221
1370
|
await Z.current()?.destroy();
|
|
1222
1371
|
}
|
|
1223
1372
|
//#endregion
|
|
1224
|
-
export { F as OneLogger,
|
|
1373
|
+
export { F as OneLogger, Bn as adoptJourney, bn as configure, vn as createMemoryTransport, Rn as currentJourney, Cn as debug, Ln as endJourney, En as error, Dn as fatal, Wn as flush, Kn as getDiagnosticCounters, zn as getJourneyToken, xn as getLogger, Gn as getQueueDepth, Un as getTraceHeaders, wn as info, On as logAction, kn as logEvent, An as logMetric, Vn as registerWorker, Fn as removeContext, Nn as setContext, Pn as setContextMap, qn as shutdown, In as startJourney, Hn as startTrace, Mn as timeAsync, jn as timeSync, Sn as trace, Tn as warn };
|
|
1225
1374
|
|
|
1226
1375
|
//# sourceMappingURL=index.js.map
|