@utk09/ui-observability 0.1.1 → 0.2.0
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 +66 -0
- package/README.md +29 -32
- package/dist/bus/bus.d.ts +11 -23
- package/dist/constants-DkrpC_xK.cjs +2 -0
- package/dist/constants-DkrpC_xK.cjs.map +1 -0
- package/dist/constants-NJNXpfPi.js +67 -0
- package/dist/constants-NJNXpfPi.js.map +1 -0
- package/dist/constants.d.ts +73 -6
- package/dist/core/breadcrumbs.d.ts +1 -6
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/journey.d.ts +11 -1
- package/dist/core/pipeline.d.ts +39 -18
- package/dist/core/record.d.ts +10 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +496 -481
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CH9NocOC.cjs +2 -0
- package/dist/indexeddb-storage-CH9NocOC.cjs.map +1 -0
- package/dist/indexeddb-storage-DAoHV_oL.js +154 -0
- package/dist/indexeddb-storage-DAoHV_oL.js.map +1 -0
- package/dist/models/config.d.ts +17 -261
- package/dist/storage/idb-driver.d.ts +67 -0
- package/dist/storage/indexeddb-storage.d.ts +1 -1
- package/dist/utils/console.d.ts +5 -8
- package/package.json +6 -6
- package/dist/constants-4eu3x1qw.js +0 -110
- package/dist/constants-4eu3x1qw.js.map +0 -1
- package/dist/constants-Daya7Mc-.cjs +0 -2
- package/dist/constants-Daya7Mc-.cjs.map +0 -1
- package/dist/indexeddb-storage-2PCdF5Ji.js +0 -88
- package/dist/indexeddb-storage-2PCdF5Ji.js.map +0 -1
- package/dist/indexeddb-storage-BhMUPgyG.cjs +0 -2
- package/dist/indexeddb-storage-BhMUPgyG.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { context as
|
|
3
|
-
import { EMPTY as dt, Subject as ft, asapScheduler as pt, bufferTime as mt, catchError as ht, filter as S, from as gt, map as _t, merge as vt, mergeMap as yt, observeOn as bt, partition as xt, tap as St } from "rxjs";
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, Gt as m, H as h, It as ee, J as te, Jt as ne, K as re, Kt as ie, L as g, Lt as ae, M as oe, Mt as se, N as ce, Nt as le, O as ue, Ot as de, Pt as fe, Qt as pe, R as me, S as he, St as ge, T as _e, Tt as ve, Ut as ye, V as be, Vt as _, W as xe, Wt as Se, Xt as Ce, Yt as we, Zt as Te, _ as Ee, _t as De, a as Oe, an as ke, at as Ae, b as je, bt as Me, c as Ne, ct as Pe, d as Fe, dt as Ie, en as Le, et as Re, ft as ze, g as Be, gt as Ve, h as He, ht as Ue, i as We, in as Ge, it as Ke, j as qe, jt as Je, k as Ye, kt as Xe, l as v, lt as Ze, m as Qe, mt as $e, n as y, nn as et, nt as tt, o as nt, on as rt, ot as it, p as at, pt as ot, q as st, r as ct, rn as lt, rt as b, s as ut, st as dt, t as ft, tn as pt, tt as x, u as mt, ut as ht, v as gt, wt as _t, x as vt, xt as yt, yt as bt, zt as xt } from "./constants-NJNXpfPi.js";
|
|
2
|
+
import { context as St, isSpanContextValid as Ct, propagation as wt, trace as Tt } from "@opentelemetry/api";
|
|
4
3
|
//#region src/utils/timer.ts
|
|
5
|
-
function
|
|
6
|
-
return Math.round((performance.now() - e) *
|
|
4
|
+
function Et(e) {
|
|
5
|
+
return Math.round((performance.now() - e) * d) / d;
|
|
7
6
|
}
|
|
8
|
-
function
|
|
9
|
-
e.logMetric(`${t}.duration`,
|
|
7
|
+
function Dt(e, t, n, r, i) {
|
|
8
|
+
e.logMetric(`${t}.duration`, Et(n), "ms", "histogram", {
|
|
10
9
|
status: r,
|
|
11
10
|
...i
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
function
|
|
13
|
+
function Ot(e, t, n, r, i) {
|
|
15
14
|
e.error(`${t} failed`, r, {
|
|
16
|
-
"action.duration_ms":
|
|
15
|
+
"action.duration_ms": Et(n),
|
|
17
16
|
status: "FAILURE",
|
|
18
17
|
...i
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function kt(e, t, n, r) {
|
|
22
21
|
let i = performance.now();
|
|
23
22
|
try {
|
|
24
23
|
let a = n();
|
|
25
|
-
return
|
|
24
|
+
return Dt(e, t, i, "SUCCESS", r), a;
|
|
26
25
|
} catch (n) {
|
|
27
|
-
throw
|
|
26
|
+
throw Ot(e, t, i, n, r), n;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
async function
|
|
29
|
+
async function At(e, t, n, r) {
|
|
31
30
|
let i = performance.now();
|
|
32
31
|
try {
|
|
33
32
|
let a = await n();
|
|
34
|
-
return
|
|
33
|
+
return Dt(e, t, i, "SUCCESS", r), a;
|
|
35
34
|
} catch (n) {
|
|
36
|
-
throw
|
|
35
|
+
throw Ot(e, t, i, n, r), n;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region src/core/logger.ts
|
|
41
|
-
function
|
|
40
|
+
function jt(e) {
|
|
42
41
|
return e instanceof Error ? e : Error(String(e));
|
|
43
42
|
}
|
|
44
|
-
var
|
|
43
|
+
var S = class e {
|
|
45
44
|
runtime;
|
|
46
45
|
namespace;
|
|
47
46
|
options;
|
|
@@ -78,7 +77,7 @@ var w = class e {
|
|
|
78
77
|
logEvent = (e, t) => {
|
|
79
78
|
this.write("INFO", "event", e, t);
|
|
80
79
|
};
|
|
81
|
-
logMetric = (e, t, n =
|
|
80
|
+
logMetric = (e, t, n = oe, r = "gauge", i) => {
|
|
82
81
|
this.write("INFO", "metric", e, {
|
|
83
82
|
"metric.name": e,
|
|
84
83
|
"metric.value": t,
|
|
@@ -87,8 +86,8 @@ var w = class e {
|
|
|
87
86
|
...i
|
|
88
87
|
});
|
|
89
88
|
};
|
|
90
|
-
timeSync = (e, t, n) =>
|
|
91
|
-
timeAsync = (e, t, n) =>
|
|
89
|
+
timeSync = (e, t, n) => kt(this, e, t, n);
|
|
90
|
+
timeAsync = (e, t, n) => At(this, e, t, n);
|
|
92
91
|
write(e, t, n, r) {
|
|
93
92
|
if (!this.runtime.builder.isEnabled(e)) return;
|
|
94
93
|
let i = this.runtime.builder.build({
|
|
@@ -107,7 +106,7 @@ var w = class e {
|
|
|
107
106
|
}
|
|
108
107
|
writeError(e, t, n, r) {
|
|
109
108
|
if (!this.runtime.builder.isEnabled(e)) return;
|
|
110
|
-
let i = n === void 0 ? void 0 :
|
|
109
|
+
let i = n === void 0 ? void 0 : jt(n), a = this.runtime.builder.build({
|
|
111
110
|
level: e,
|
|
112
111
|
type: "system",
|
|
113
112
|
body: t,
|
|
@@ -128,18 +127,18 @@ var w = class e {
|
|
|
128
127
|
};
|
|
129
128
|
//#endregion
|
|
130
129
|
//#region src/utils/unref.ts
|
|
131
|
-
function
|
|
130
|
+
function C(e) {
|
|
132
131
|
typeof e != "number" && e.unref?.();
|
|
133
132
|
}
|
|
134
133
|
//#endregion
|
|
135
134
|
//#region src/models/bus.ts
|
|
136
|
-
function
|
|
135
|
+
function w(e) {
|
|
137
136
|
return {
|
|
138
|
-
p:
|
|
137
|
+
p: he,
|
|
139
138
|
m: e
|
|
140
139
|
};
|
|
141
140
|
}
|
|
142
|
-
function
|
|
141
|
+
function T(e) {
|
|
143
142
|
if (typeof e != "object" || !e) return null;
|
|
144
143
|
let t = e;
|
|
145
144
|
if (t.p !== "ui-observability/1" || typeof t.m != "object" || t.m === null) return null;
|
|
@@ -148,12 +147,12 @@ function D(e) {
|
|
|
148
147
|
}
|
|
149
148
|
//#endregion
|
|
150
149
|
//#region src/bus/links.ts
|
|
151
|
-
var
|
|
152
|
-
function
|
|
150
|
+
var Mt = Symbol.for(ae);
|
|
151
|
+
function Nt(e, t) {
|
|
153
152
|
if (typeof window > "u" || window.parent === window) return null;
|
|
154
153
|
let n;
|
|
155
154
|
try {
|
|
156
|
-
n = window.parent[
|
|
155
|
+
n = window.parent[Mt];
|
|
157
156
|
} catch {
|
|
158
157
|
return null;
|
|
159
158
|
}
|
|
@@ -171,10 +170,10 @@ function kt(e, t) {
|
|
|
171
170
|
}
|
|
172
171
|
};
|
|
173
172
|
}
|
|
174
|
-
function
|
|
173
|
+
function Pt(e, t) {
|
|
175
174
|
if (typeof window > "u" || window.parent === window) return null;
|
|
176
175
|
let n = (t) => {
|
|
177
|
-
let n =
|
|
176
|
+
let n = T(t.data);
|
|
178
177
|
n && t.source === window.parent && e(n, {
|
|
179
178
|
link: "parent",
|
|
180
179
|
origin: t.origin
|
|
@@ -184,7 +183,7 @@ function At(e, t) {
|
|
|
184
183
|
kind: "parent",
|
|
185
184
|
post(e) {
|
|
186
185
|
t.guard("bus.send_failed", "postMessage to parent", () => {
|
|
187
|
-
window.parent.postMessage(
|
|
186
|
+
window.parent.postMessage(w(e), "*");
|
|
188
187
|
});
|
|
189
188
|
},
|
|
190
189
|
close() {
|
|
@@ -192,10 +191,10 @@ function At(e, t) {
|
|
|
192
191
|
}
|
|
193
192
|
};
|
|
194
193
|
}
|
|
195
|
-
function
|
|
194
|
+
function Ft(e, t, n) {
|
|
196
195
|
if (typeof window > "u") return null;
|
|
197
196
|
let r = /* @__PURE__ */ new Set([window.location.origin, ...t]), i = /* @__PURE__ */ new Set(), a = (t) => {
|
|
198
|
-
let a =
|
|
197
|
+
let a = T(t.data);
|
|
199
198
|
if (a) {
|
|
200
199
|
if (!r.has(t.origin)) {
|
|
201
200
|
n.report("bus.untrusted_origin", `ignored a bus message from ${t.origin}. Add it to bus.trustedOrigins if it is yours.`, {
|
|
@@ -220,7 +219,7 @@ function jt(e, t, n) {
|
|
|
220
219
|
continue;
|
|
221
220
|
}
|
|
222
221
|
n.guard("bus.send_failed", "postMessage to child", () => {
|
|
223
|
-
r.postMessage(
|
|
222
|
+
r.postMessage(w(e), "*");
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
},
|
|
@@ -229,12 +228,12 @@ function jt(e, t, n) {
|
|
|
229
228
|
}
|
|
230
229
|
};
|
|
231
230
|
}
|
|
232
|
-
function
|
|
231
|
+
function It(e, t, n) {
|
|
233
232
|
let r = globalThis.BroadcastChannel;
|
|
234
233
|
if (r === void 0) return null;
|
|
235
234
|
let i = n.guard("bus.send_failed", "opening BroadcastChannel", () => new r(e));
|
|
236
235
|
return i ? (i.onmessage = (e) => {
|
|
237
|
-
let n =
|
|
236
|
+
let n = T(e.data);
|
|
238
237
|
n && t(n, {
|
|
239
238
|
link: "broadcast",
|
|
240
239
|
origin: "same-origin"
|
|
@@ -243,7 +242,7 @@ function Mt(e, t, n) {
|
|
|
243
242
|
kind: "broadcast",
|
|
244
243
|
post(e) {
|
|
245
244
|
n.guard("bus.send_failed", "BroadcastChannel.postMessage", () => {
|
|
246
|
-
i.postMessage(
|
|
245
|
+
i.postMessage(w(e));
|
|
247
246
|
});
|
|
248
247
|
},
|
|
249
248
|
close() {
|
|
@@ -253,10 +252,10 @@ function Mt(e, t, n) {
|
|
|
253
252
|
}
|
|
254
253
|
}) : null;
|
|
255
254
|
}
|
|
256
|
-
function
|
|
255
|
+
function Lt(e, t, n) {
|
|
257
256
|
let r = globalThis.fin?.InterApplicationBus;
|
|
258
257
|
return r ? (n.guardAsync("bus.send_failed", "InterApplicationBus.subscribe", () => r.subscribe({ uuid: "*" }, e, (e) => {
|
|
259
|
-
let n =
|
|
258
|
+
let n = T(e);
|
|
260
259
|
n && t(n, {
|
|
261
260
|
link: "openfin",
|
|
262
261
|
origin: "openfin"
|
|
@@ -264,15 +263,15 @@ function Nt(e, t, n) {
|
|
|
264
263
|
})), {
|
|
265
264
|
kind: "openfin",
|
|
266
265
|
post(t) {
|
|
267
|
-
n.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => r.publish(e,
|
|
266
|
+
n.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => r.publish(e, w(t)));
|
|
268
267
|
},
|
|
269
268
|
close() {}
|
|
270
269
|
}) : null;
|
|
271
270
|
}
|
|
272
|
-
function
|
|
271
|
+
function Rt(e, t) {
|
|
273
272
|
let n = globalThis, r = n.postMessage;
|
|
274
273
|
return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
|
|
275
|
-
let n =
|
|
274
|
+
let n = T(t.data);
|
|
276
275
|
n && e(n, {
|
|
277
276
|
link: "owner",
|
|
278
277
|
origin: "same-origin"
|
|
@@ -281,15 +280,15 @@ function Pt(e, t) {
|
|
|
281
280
|
kind: "owner",
|
|
282
281
|
post(e) {
|
|
283
282
|
t.guard("bus.send_failed", "worker postMessage", () => {
|
|
284
|
-
r(
|
|
283
|
+
r(w(e));
|
|
285
284
|
});
|
|
286
285
|
},
|
|
287
286
|
close() {}
|
|
288
287
|
});
|
|
289
288
|
}
|
|
290
|
-
function
|
|
289
|
+
function zt(e, t, n) {
|
|
291
290
|
let r = (e) => {
|
|
292
|
-
let n =
|
|
291
|
+
let n = T(e.data);
|
|
293
292
|
n && t(n, {
|
|
294
293
|
link: "worker",
|
|
295
294
|
origin: "same-origin"
|
|
@@ -299,7 +298,7 @@ function Ft(e, t, n) {
|
|
|
299
298
|
kind: "worker",
|
|
300
299
|
post(t) {
|
|
301
300
|
n.guard("bus.send_failed", "postMessage to a worker", () => {
|
|
302
|
-
e.postMessage(
|
|
301
|
+
e.postMessage(w(t));
|
|
303
302
|
});
|
|
304
303
|
},
|
|
305
304
|
close() {
|
|
@@ -309,17 +308,21 @@ function Ft(e, t, n) {
|
|
|
309
308
|
}
|
|
310
309
|
//#endregion
|
|
311
310
|
//#region src/bus/bus.ts
|
|
312
|
-
var
|
|
311
|
+
var Bt = {
|
|
312
|
+
timeoutMs: vt,
|
|
313
|
+
maxAttempts: 3
|
|
314
|
+
}, Vt = [
|
|
313
315
|
"children",
|
|
314
316
|
"direct",
|
|
315
317
|
"worker"
|
|
316
|
-
],
|
|
318
|
+
], Ht = class {
|
|
317
319
|
config;
|
|
318
320
|
diagnostics;
|
|
319
321
|
platform;
|
|
320
322
|
contextId;
|
|
321
323
|
tabId;
|
|
322
324
|
handlers;
|
|
325
|
+
handshakeOptions;
|
|
323
326
|
role = "sender";
|
|
324
327
|
upstream = null;
|
|
325
328
|
links = [];
|
|
@@ -327,8 +330,8 @@ var It = [
|
|
|
327
330
|
isOpenFinProvider = !1;
|
|
328
331
|
resolved = !1;
|
|
329
332
|
awaitingWelcome = null;
|
|
330
|
-
constructor(e, t, n, r, i, a) {
|
|
331
|
-
this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a;
|
|
333
|
+
constructor(e, t, n, r, i, a, o = Bt) {
|
|
334
|
+
this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
|
|
332
335
|
}
|
|
333
336
|
getRole() {
|
|
334
337
|
return this.role;
|
|
@@ -341,16 +344,16 @@ var It = [
|
|
|
341
344
|
if (e.mode === "off") return this.role = "sender", this.resolved = !0, this.role;
|
|
342
345
|
if (this.isOpenFinProvider = this.resolveOpenFinProvider(), e.mode === "sender" || e.mode === "forwarder") return this.role = e.mode, this.openControlLinks(), this.role === "forwarder" && (this.upstream = this.candidateUpstream(), this.upstream || this.diagnostics.report("bus.no_owner", "bus.mode is \"forwarder\" but there is no owner to forward to. Records will be dropped.")), this.resolved = !0, this.announce(), this.role;
|
|
343
346
|
this.openControlLinks();
|
|
344
|
-
let t =
|
|
347
|
+
let t = Nt(this.receive, this.diagnostics);
|
|
345
348
|
if (t) return this.role = "forwarder", this.upstream = t, this.resolved = !0, this.diagnostics.report("bus.role_resolved", "attached directly to the same-origin parent runtime", {
|
|
346
349
|
role: "forwarder",
|
|
347
350
|
via: "direct"
|
|
348
351
|
}), this.announce(), this.role;
|
|
349
352
|
let n = this.candidateUpstream();
|
|
350
353
|
if (!n) return this.role = "sender", this.resolved = !0, this.diagnostics.report("bus.role_resolved", "no owner to forward to, sending directly", { role: "sender" }), this.announce(), this.role;
|
|
351
|
-
let r = this.orphanPolicy() === "retry" ? this.
|
|
354
|
+
let r = this.orphanPolicy() === "retry" ? this.handshakeOptions.maxAttempts : 1, i = !1;
|
|
352
355
|
for (let e = 0; e < r && !i; e++) i = await this.handshake(n);
|
|
353
|
-
return this.role = i ? "forwarder" : "sender", this.upstream = i ? n : null, i || (n !== this.openFinLink && n.close(), this.diagnostics.report("bus.handshake_timeout", `no owner answered after ${String(r)} attempt(s) of ${String(this.
|
|
356
|
+
return this.role = i ? "forwarder" : "sender", this.upstream = i ? n : null, i || (n !== this.openFinLink && n.close(), this.diagnostics.report("bus.handshake_timeout", `no owner answered after ${String(r)} attempt(s) of ${String(this.handshakeOptions.timeoutMs)}ms, promoting to sender`, {
|
|
354
357
|
via: n.kind,
|
|
355
358
|
crossOrigin: this.isCrossOriginFrame()
|
|
356
359
|
})), this.diagnostics.report("bus.role_resolved", `role is ${this.role}`, {
|
|
@@ -392,7 +395,7 @@ var It = [
|
|
|
392
395
|
this.receive(e, n);
|
|
393
396
|
}
|
|
394
397
|
attachWorker(e) {
|
|
395
|
-
this.links.push(
|
|
398
|
+
this.links.push(zt(e, this.receive, this.diagnostics));
|
|
396
399
|
}
|
|
397
400
|
broadcastJourney(e) {
|
|
398
401
|
this.post({
|
|
@@ -447,7 +450,7 @@ var It = [
|
|
|
447
450
|
}
|
|
448
451
|
};
|
|
449
452
|
canOwn(e) {
|
|
450
|
-
return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider :
|
|
453
|
+
return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider : Vt.includes(e) : !1;
|
|
451
454
|
}
|
|
452
455
|
resolveOpenFinProvider() {
|
|
453
456
|
let e = this.config.bus.openFinRole;
|
|
@@ -457,8 +460,7 @@ var It = [
|
|
|
457
460
|
return !t?.identity || t.isView ? !1 : !!(t.identity.name && t.identity.name === t.identity.uuid);
|
|
458
461
|
}
|
|
459
462
|
orphanPolicy() {
|
|
460
|
-
|
|
461
|
-
return e === "auto" ? this.isCrossOriginFrame() ? "retry" : "promote" : e;
|
|
463
|
+
return this.isCrossOriginFrame() ? "retry" : "promote";
|
|
462
464
|
}
|
|
463
465
|
isCrossOriginFrame() {
|
|
464
466
|
if (typeof window > "u" || window.parent === window) return !1;
|
|
@@ -469,16 +471,16 @@ var It = [
|
|
|
469
471
|
}
|
|
470
472
|
}
|
|
471
473
|
candidateUpstream() {
|
|
472
|
-
return this.platform.isWorker ?
|
|
474
|
+
return this.platform.isWorker ? Rt(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : Pt(this.receive, this.diagnostics);
|
|
473
475
|
}
|
|
474
476
|
openControlLinks() {
|
|
475
477
|
let e = (e) => {
|
|
476
478
|
e && this.links.push(e);
|
|
477
479
|
};
|
|
478
|
-
this.platform.isTopLevelDocument && (e(
|
|
480
|
+
this.platform.isTopLevelDocument && (e(Ft(this.receive, this.config.bus.trustedOrigins, this.diagnostics)), e(It(je, this.receive, this.diagnostics))), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
|
|
479
481
|
}
|
|
480
482
|
ensureOpenFinLink() {
|
|
481
|
-
return this.openFinLink ??=
|
|
483
|
+
return this.openFinLink ??= Lt(je, this.receive, this.diagnostics), this.openFinLink;
|
|
482
484
|
}
|
|
483
485
|
handshake(e) {
|
|
484
486
|
return new Promise((t) => {
|
|
@@ -491,8 +493,8 @@ var It = [
|
|
|
491
493
|
};
|
|
492
494
|
let i = setTimeout(() => {
|
|
493
495
|
r(!1);
|
|
494
|
-
}, this.
|
|
495
|
-
|
|
496
|
+
}, this.handshakeOptions.timeoutMs);
|
|
497
|
+
C(i), e.post({
|
|
496
498
|
t: "hello",
|
|
497
499
|
from: this.contextId,
|
|
498
500
|
tabId: this.tabId
|
|
@@ -509,7 +511,7 @@ var It = [
|
|
|
509
511
|
from: this.contextId
|
|
510
512
|
});
|
|
511
513
|
}
|
|
512
|
-
},
|
|
514
|
+
}, Ut = class {
|
|
513
515
|
ctx;
|
|
514
516
|
name = "errors";
|
|
515
517
|
installed = !1;
|
|
@@ -554,32 +556,32 @@ var It = [
|
|
|
554
556
|
report(e, t, n) {
|
|
555
557
|
let r = Date.now();
|
|
556
558
|
if (r - this.windowStart > 1e4 && (this.windowStart = r, this.windowCount = 0), this.windowCount++, this.windowCount > 20) {
|
|
557
|
-
this.ctx.diagnostics.report("capture.rate_limited", `more than 20 errors in ${String(
|
|
559
|
+
this.ctx.diagnostics.report("capture.rate_limited", `more than 20 errors in ${String(i)}ms, suppressing the rest of this window`);
|
|
558
560
|
return;
|
|
559
561
|
}
|
|
560
|
-
let
|
|
561
|
-
if (
|
|
562
|
-
|
|
562
|
+
let a = t instanceof Error ? t : Error(String(t)), o = (a.stack ?? "").split("\n")[1] ?? "", s = `${a.name}|${a.message}|${o}`, c = this.seen.get(s);
|
|
563
|
+
if (c && r - c.at < 5e3) {
|
|
564
|
+
c.count++, c.at = r;
|
|
563
565
|
return;
|
|
564
566
|
}
|
|
565
|
-
let
|
|
566
|
-
if (this.seen.delete(
|
|
567
|
+
let l = c ? c.count - 1 : 0;
|
|
568
|
+
if (this.seen.delete(s), this.seen.set(s, {
|
|
567
569
|
at: r,
|
|
568
570
|
count: 1
|
|
569
571
|
}), this.seen.size > 200) {
|
|
570
572
|
let [e] = this.seen.keys();
|
|
571
573
|
this.seen.delete(e);
|
|
572
574
|
}
|
|
573
|
-
this.ctx.logger.error(
|
|
575
|
+
this.ctx.logger.error(a.message === "" ? e : a.message, a, {
|
|
574
576
|
...n,
|
|
575
577
|
"error.captured_by": e,
|
|
576
|
-
"error.suppressed_count":
|
|
578
|
+
"error.suppressed_count": l
|
|
577
579
|
});
|
|
578
580
|
}
|
|
579
581
|
};
|
|
580
582
|
//#endregion
|
|
581
583
|
//#region src/capture/interactions.ts
|
|
582
|
-
function
|
|
584
|
+
function Wt(e) {
|
|
583
585
|
if (e === null) return "unknown";
|
|
584
586
|
let t = e.tagName.toLowerCase(), n = e.getAttribute("data-testid") ?? e.getAttribute("data-test-id");
|
|
585
587
|
if (n !== null) return `[data-testid="${n}"]`;
|
|
@@ -589,10 +591,10 @@ function zt(e) {
|
|
|
589
591
|
let i = e.getAttribute("class")?.trim() ?? "";
|
|
590
592
|
return i === "" ? t : `${t}.${i.split(/\s+/).slice(0, 2).join(".")}`;
|
|
591
593
|
}
|
|
592
|
-
function
|
|
594
|
+
function E() {
|
|
593
595
|
return history;
|
|
594
596
|
}
|
|
595
|
-
var
|
|
597
|
+
var Gt = class {
|
|
596
598
|
ctx;
|
|
597
599
|
name = "interactions";
|
|
598
600
|
installed = !1;
|
|
@@ -606,10 +608,10 @@ var Bt = class {
|
|
|
606
608
|
this.installed || typeof document > "u" || (this.installed = !0, this.lastUrl = location.href, this.ctx.config.capture.interactions && addEventListener("click", this.onClick, !0), this.ctx.config.capture.navigation && (this.installHistory(), addEventListener("popstate", this.onNavigate), addEventListener("hashchange", this.onNavigate)));
|
|
607
609
|
}
|
|
608
610
|
uninstall() {
|
|
609
|
-
this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (
|
|
611
|
+
this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (E().pushState = this.originalPushState), this.originalReplaceState && (E().replaceState = this.originalReplaceState), this.originalPushState = null, this.originalReplaceState = null);
|
|
610
612
|
}
|
|
611
613
|
onClick = (e) => {
|
|
612
|
-
let t = e.target, n =
|
|
614
|
+
let t = e.target, n = Wt(t instanceof Element ? t : null), r = t instanceof HTMLElement ? t.innerText.trim().slice(0, 50) : "";
|
|
613
615
|
this.ctx.tracing.rotate("interaction"), this.ctx.breadcrumbs.push({
|
|
614
616
|
t: Date.now(),
|
|
615
617
|
category: "click",
|
|
@@ -627,7 +629,7 @@ var Bt = class {
|
|
|
627
629
|
};
|
|
628
630
|
installHistory() {
|
|
629
631
|
if (typeof history > "u" || this.originalPushState) return;
|
|
630
|
-
let e =
|
|
632
|
+
let e = E(), t = e.pushState, n = e.replaceState;
|
|
631
633
|
this.originalPushState = t, this.originalReplaceState = n;
|
|
632
634
|
let r = this.onNavigate;
|
|
633
635
|
e.pushState = function(...e) {
|
|
@@ -639,15 +641,15 @@ var Bt = class {
|
|
|
639
641
|
};
|
|
640
642
|
//#endregion
|
|
641
643
|
//#region src/capture/types.ts
|
|
642
|
-
function
|
|
644
|
+
function Kt(e, t) {
|
|
643
645
|
return t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
|
|
644
646
|
}
|
|
645
647
|
//#endregion
|
|
646
648
|
//#region src/capture/network.ts
|
|
647
|
-
function
|
|
649
|
+
function D() {
|
|
648
650
|
return XMLHttpRequest.prototype;
|
|
649
651
|
}
|
|
650
|
-
var
|
|
652
|
+
var qt = class {
|
|
651
653
|
ctx;
|
|
652
654
|
name = "network";
|
|
653
655
|
originalFetch = null;
|
|
@@ -660,10 +662,10 @@ var Ht = class {
|
|
|
660
662
|
this.ctx.config.capture.fetch && this.installFetch(), this.ctx.config.capture.xhr && this.installXhr();
|
|
661
663
|
}
|
|
662
664
|
uninstall() {
|
|
663
|
-
this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (
|
|
665
|
+
this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (D().open = this.originalOpen, null), this.originalSend &&= (D().send = this.originalSend, null);
|
|
664
666
|
}
|
|
665
667
|
ignored(e) {
|
|
666
|
-
return
|
|
668
|
+
return Kt(e, this.ctx.config.capture.ignoreUrls);
|
|
667
669
|
}
|
|
668
670
|
installFetch() {
|
|
669
671
|
if (typeof globalThis.fetch != "function" || this.originalFetch) return;
|
|
@@ -676,7 +678,7 @@ var Ht = class {
|
|
|
676
678
|
let o = typeof i == "string" ? i : i instanceof URL ? i.href : i.url, s = (a?.method ?? (i instanceof Request ? i.method : "GET")).toUpperCase();
|
|
677
679
|
if (n(o)) return e(i, a);
|
|
678
680
|
let c = i, l = a;
|
|
679
|
-
if (
|
|
681
|
+
if (Kt(o, t.config.capture.propagateTraceHeaderTo)) try {
|
|
680
682
|
let e = Object.entries(t.tracing.headers());
|
|
681
683
|
if (i instanceof Request) {
|
|
682
684
|
let t = new Headers(i.headers);
|
|
@@ -706,7 +708,7 @@ var Ht = class {
|
|
|
706
708
|
if (typeof XMLHttpRequest > "u" || this.originalOpen) return;
|
|
707
709
|
let e = (e) => this.ignored(e), t = (e, t, n, r) => {
|
|
708
710
|
this.record(e, t, n, r, void 0);
|
|
709
|
-
}, n =
|
|
711
|
+
}, n = D(), r = n.open, i = n.send;
|
|
710
712
|
this.originalOpen = r, this.originalSend = i, n.open = function(e, t, ...n) {
|
|
711
713
|
this.__uiobs = {
|
|
712
714
|
method: e.toUpperCase(),
|
|
@@ -753,13 +755,13 @@ var Ht = class {
|
|
|
753
755
|
};
|
|
754
756
|
//#endregion
|
|
755
757
|
//#region src/capture/web-vitals.ts
|
|
756
|
-
function
|
|
758
|
+
function Jt() {
|
|
757
759
|
return import(
|
|
758
760
|
/* @vite-ignore */
|
|
759
761
|
"web-vitals"
|
|
760
762
|
);
|
|
761
763
|
}
|
|
762
|
-
var
|
|
764
|
+
var Yt = class {
|
|
763
765
|
ctx;
|
|
764
766
|
name = "web-vitals";
|
|
765
767
|
installed = !1;
|
|
@@ -773,7 +775,7 @@ var Wt = class {
|
|
|
773
775
|
this.installed = !1;
|
|
774
776
|
}
|
|
775
777
|
async loadWebVitals() {
|
|
776
|
-
let e = this.ctx.config.capture.webVitalsLoader ??
|
|
778
|
+
let e = this.ctx.config.capture.webVitalsLoader ?? Jt, t = await this.ctx.diagnostics.guardAsync("capture.install_failed", "loading web-vitals", e);
|
|
777
779
|
if (!t) {
|
|
778
780
|
this.ctx.diagnostics.report("capture.install_failed", "web-vitals is not available, so LCP, CLS and INP are unavailable. Navigation timing still works.");
|
|
779
781
|
return;
|
|
@@ -805,38 +807,38 @@ var Wt = class {
|
|
|
805
807
|
};
|
|
806
808
|
//#endregion
|
|
807
809
|
//#region src/models/log-record.ts
|
|
808
|
-
function
|
|
810
|
+
function O() {
|
|
809
811
|
return `${String(Date.now())}000000`;
|
|
810
812
|
}
|
|
811
|
-
function
|
|
813
|
+
function k(e) {
|
|
812
814
|
if (typeof e != "object" || !e) return !1;
|
|
813
815
|
let t = e;
|
|
814
816
|
return typeof t.body == "string" && typeof t.severityText == "string" && typeof t.timeUnixNano == "string" && typeof t.attributes == "object" && t.attributes !== null && typeof t.resource == "object" && t.resource !== null;
|
|
815
817
|
}
|
|
816
818
|
//#endregion
|
|
817
819
|
//#region src/utils/identity.ts
|
|
818
|
-
function
|
|
820
|
+
function A(e) {
|
|
819
821
|
let t = new Uint8Array(e);
|
|
820
822
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") crypto.getRandomValues(t);
|
|
821
823
|
else for (let n = 0; n < e; n++) t[n] = Math.floor(Math.random() * 256);
|
|
822
824
|
return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
823
825
|
}
|
|
824
|
-
function
|
|
826
|
+
function j() {
|
|
825
827
|
try {
|
|
826
828
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
827
829
|
} catch {}
|
|
828
|
-
return
|
|
830
|
+
return A(16);
|
|
829
831
|
}
|
|
830
|
-
function
|
|
832
|
+
function Xt(e, t, n) {
|
|
831
833
|
return n.guard("storage.unavailable", `reading ${e}Storage`, () => (e === "local" ? localStorage : sessionStorage).getItem(t)) ?? null;
|
|
832
834
|
}
|
|
833
|
-
function
|
|
835
|
+
function M(e, t, n, r) {
|
|
834
836
|
r.guard("storage.unavailable", `writing ${e}Storage`, () => {
|
|
835
837
|
(e === "local" ? localStorage : sessionStorage).setItem(t, n);
|
|
836
838
|
});
|
|
837
839
|
}
|
|
838
|
-
function
|
|
839
|
-
let t =
|
|
840
|
+
function Zt(e) {
|
|
841
|
+
let t = j(), n = Date.now(), r = j(), i = Xt("local", _, e);
|
|
840
842
|
if (i) try {
|
|
841
843
|
let e = JSON.parse(i);
|
|
842
844
|
e.id && n - (e.lastSeenAt ?? 0) < 18e5 && (r = e.id);
|
|
@@ -847,36 +849,36 @@ function qt(e) {
|
|
|
847
849
|
id: r,
|
|
848
850
|
lastSeenAt: n
|
|
849
851
|
});
|
|
850
|
-
|
|
851
|
-
let o =
|
|
852
|
-
return o || (o =
|
|
852
|
+
M("local", _, a, e);
|
|
853
|
+
let o = Xt("session", "ui-observability.tab", e) ?? "";
|
|
854
|
+
return o || (o = j(), M("session", pe, o, e)), {
|
|
853
855
|
sessionId: r,
|
|
854
856
|
tabId: o,
|
|
855
857
|
contextId: t
|
|
856
858
|
};
|
|
857
859
|
}
|
|
858
|
-
var
|
|
859
|
-
function
|
|
860
|
+
var Qt = 0;
|
|
861
|
+
function $t(e, t) {
|
|
860
862
|
let n = Date.now();
|
|
861
|
-
if (n -
|
|
862
|
-
|
|
863
|
+
if (n - Qt < 6e4) return;
|
|
864
|
+
Qt = n;
|
|
863
865
|
let r = JSON.stringify({
|
|
864
866
|
id: e,
|
|
865
867
|
lastSeenAt: n
|
|
866
868
|
});
|
|
867
|
-
|
|
869
|
+
M("local", _, r, t);
|
|
868
870
|
}
|
|
869
871
|
//#endregion
|
|
870
872
|
//#region src/models/batch.ts
|
|
871
|
-
function
|
|
873
|
+
function en(e) {
|
|
872
874
|
if (typeof e != "object" || !e) return !1;
|
|
873
875
|
let t = Reflect.get(e, "id"), n = Reflect.get(e, "createdAt"), r = Reflect.get(e, "attempts"), i = Reflect.get(e, "records");
|
|
874
876
|
return typeof t == "string" && typeof n == "number" && typeof r == "number" && Array.isArray(i);
|
|
875
877
|
}
|
|
876
|
-
function
|
|
878
|
+
function tn(e) {
|
|
877
879
|
if (e.records.length < 2) return null;
|
|
878
880
|
let t = Math.floor(e.records.length / 2), n = (t) => ({
|
|
879
|
-
id:
|
|
881
|
+
id: j(),
|
|
880
882
|
records: t,
|
|
881
883
|
createdAt: e.createdAt,
|
|
882
884
|
attempts: e.attempts
|
|
@@ -885,13 +887,13 @@ function Zt(e) {
|
|
|
885
887
|
}
|
|
886
888
|
//#endregion
|
|
887
889
|
//#region src/utils/lock.ts
|
|
888
|
-
function
|
|
890
|
+
function nn(e, t, n, { skipIfBusy: r = !0 } = {}) {
|
|
889
891
|
let i = globalThis.navigator?.locks;
|
|
890
892
|
return i?.request ? t.guardAsync("storage.degraded", `acquiring lock ${e}`, () => i.request(e, { ifAvailable: r }, (e) => e ? n() : Promise.resolve(void 0))) : n();
|
|
891
893
|
}
|
|
892
894
|
//#endregion
|
|
893
895
|
//#region src/storage/keys.ts
|
|
894
|
-
function
|
|
896
|
+
function N(e, t) {
|
|
895
897
|
let n = [];
|
|
896
898
|
return t.guard("storage.unavailable", "enumerating localStorage", () => {
|
|
897
899
|
for (let t = 0; t < localStorage.length; t++) {
|
|
@@ -902,23 +904,23 @@ function P(e, t) {
|
|
|
902
904
|
}
|
|
903
905
|
//#endregion
|
|
904
906
|
//#region src/storage/emergency-queue.ts
|
|
905
|
-
function
|
|
907
|
+
function rn(e) {
|
|
906
908
|
let t = String(e.createdAt).padStart(14, "0");
|
|
907
|
-
return `${
|
|
909
|
+
return `${g}${t}.${e.id}`;
|
|
908
910
|
}
|
|
909
|
-
function
|
|
911
|
+
function an(e, t) {
|
|
910
912
|
let n = t.guard("storage.degraded", "an emergency entry was not JSON and was dropped", () => JSON.parse(e));
|
|
911
|
-
return n === void 0 ? null :
|
|
913
|
+
return n === void 0 ? null : en(n) ? n : (t.report("storage.degraded", "an emergency entry was not a batch and was dropped"), null);
|
|
912
914
|
}
|
|
913
|
-
async function
|
|
915
|
+
async function on(e, t) {
|
|
914
916
|
let n = 0;
|
|
915
|
-
for (let r of
|
|
917
|
+
for (let r of N(g, t)) {
|
|
916
918
|
let i = t.guard("storage.unavailable", "reading the emergency queue", () => {
|
|
917
919
|
let e = localStorage.getItem(r);
|
|
918
920
|
return localStorage.removeItem(r), e;
|
|
919
921
|
});
|
|
920
922
|
if (!i) continue;
|
|
921
|
-
let a =
|
|
923
|
+
let a = an(i, t);
|
|
922
924
|
if (a !== null) try {
|
|
923
925
|
await e.save(a), n++;
|
|
924
926
|
} catch (e) {
|
|
@@ -927,33 +929,33 @@ async function tn(e, t) {
|
|
|
927
929
|
}
|
|
928
930
|
return n;
|
|
929
931
|
}
|
|
930
|
-
function
|
|
932
|
+
function sn(e, t) {
|
|
931
933
|
let n = `writing the emergency queue, ${String(e.records.length)} records`;
|
|
932
934
|
t.guard("storage.quota_exceeded", n, () => {
|
|
933
|
-
let n =
|
|
935
|
+
let n = N(g, t);
|
|
934
936
|
for (let e of n.slice(0, Math.max(0, n.length - 20 + 1))) localStorage.removeItem(e);
|
|
935
|
-
localStorage.setItem(
|
|
937
|
+
localStorage.setItem(rn(e), JSON.stringify(e));
|
|
936
938
|
});
|
|
937
939
|
}
|
|
938
|
-
async function
|
|
939
|
-
return await
|
|
940
|
+
async function cn(e, t) {
|
|
941
|
+
return await nn("ui-observability.emergency", t, () => on(e, t), { skipIfBusy: !1 }) ?? 0;
|
|
940
942
|
}
|
|
941
943
|
//#endregion
|
|
942
944
|
//#region src/storage/local-storage.ts
|
|
943
|
-
function
|
|
945
|
+
function ln(e) {
|
|
944
946
|
let t = String(e.createdAt).padStart(14, "0");
|
|
945
|
-
return `${
|
|
947
|
+
return `${gt}${t}.${e.id}`;
|
|
946
948
|
}
|
|
947
|
-
var
|
|
949
|
+
var un = class {
|
|
948
950
|
limits;
|
|
949
951
|
diagnostics;
|
|
950
952
|
onGap;
|
|
951
|
-
name =
|
|
953
|
+
name = ne;
|
|
952
954
|
constructor(e, t, n) {
|
|
953
955
|
this.limits = e, this.diagnostics = t, this.onGap = n;
|
|
954
956
|
}
|
|
955
957
|
async save(e) {
|
|
956
|
-
if (this.diagnostics.guard("storage.quota_exceeded", "localStorage refused a batch, evicting the oldest", () => (localStorage.setItem(
|
|
958
|
+
if (this.diagnostics.guard("storage.quota_exceeded", "localStorage refused a batch, evicting the oldest", () => (localStorage.setItem(ln(e), JSON.stringify(e)), !0)) !== !0) {
|
|
957
959
|
let e = this.keys();
|
|
958
960
|
this.evict(e.slice(0, Math.ceil(e.length / 4)));
|
|
959
961
|
return;
|
|
@@ -1027,7 +1029,7 @@ var on = class {
|
|
|
1027
1029
|
let t = this.diagnostics.guard("storage.unavailable", "reading a stored batch", () => localStorage.getItem(e));
|
|
1028
1030
|
if (!t) return null;
|
|
1029
1031
|
let n = this.diagnostics.guard("storage.degraded", "a stored batch was corrupt and was removed", () => JSON.parse(t));
|
|
1030
|
-
return n === void 0 ? null :
|
|
1032
|
+
return n === void 0 ? null : en(n) ? n : (this.diagnostics.report("storage.degraded", "a stored entry was not a batch and was dropped"), null);
|
|
1031
1033
|
}
|
|
1032
1034
|
keyOf(e) {
|
|
1033
1035
|
return this.keys().find((t) => t.endsWith(`.${e}`)) ?? null;
|
|
@@ -1041,18 +1043,18 @@ var on = class {
|
|
|
1041
1043
|
});
|
|
1042
1044
|
}
|
|
1043
1045
|
keys() {
|
|
1044
|
-
return
|
|
1046
|
+
return N(gt, this.diagnostics);
|
|
1045
1047
|
}
|
|
1046
1048
|
};
|
|
1047
1049
|
//#endregion
|
|
1048
1050
|
//#region src/storage/memory-storage.ts
|
|
1049
|
-
function
|
|
1051
|
+
function P(e) {
|
|
1050
1052
|
return e.reduce((e, t) => e + t.records.length, 0);
|
|
1051
1053
|
}
|
|
1052
1054
|
var F = class {
|
|
1053
1055
|
limits;
|
|
1054
1056
|
onGap;
|
|
1055
|
-
name =
|
|
1057
|
+
name = we;
|
|
1056
1058
|
batches = [];
|
|
1057
1059
|
constructor(e, t) {
|
|
1058
1060
|
this.limits = e, this.onGap = t;
|
|
@@ -1076,12 +1078,12 @@ var F = class {
|
|
|
1076
1078
|
records: 0,
|
|
1077
1079
|
reason: "expired"
|
|
1078
1080
|
}, n = this.batches.filter((t) => t.createdAt < e);
|
|
1079
|
-
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records +=
|
|
1081
|
+
this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records += P(n);
|
|
1080
1082
|
let r = this.batches.length - this.limits.maxBatches;
|
|
1081
1083
|
if (r > 0) {
|
|
1082
1084
|
t.reason = "over_capacity";
|
|
1083
1085
|
let e = this.batches.slice(0, r);
|
|
1084
|
-
this.batches = this.batches.slice(r), t.batches += e.length, t.records +=
|
|
1086
|
+
this.batches = this.batches.slice(r), t.batches += e.length, t.records += P(e);
|
|
1085
1087
|
}
|
|
1086
1088
|
return t.batches > 0 && this.onGap?.(t), Promise.resolve(t);
|
|
1087
1089
|
}
|
|
@@ -1094,8 +1096,8 @@ var F = class {
|
|
|
1094
1096
|
close() {
|
|
1095
1097
|
return this.batches = [], Promise.resolve();
|
|
1096
1098
|
}
|
|
1097
|
-
},
|
|
1098
|
-
name:
|
|
1099
|
+
}, dn = {
|
|
1100
|
+
name: Ce,
|
|
1099
1101
|
save: () => Promise.resolve(),
|
|
1100
1102
|
take: () => Promise.resolve([]),
|
|
1101
1103
|
remove: () => Promise.resolve(),
|
|
@@ -1109,38 +1111,38 @@ var F = class {
|
|
|
1109
1111
|
clear: () => Promise.resolve(),
|
|
1110
1112
|
close: () => Promise.resolve()
|
|
1111
1113
|
};
|
|
1112
|
-
function
|
|
1114
|
+
function fn(e) {
|
|
1113
1115
|
return e.guard("storage.unavailable", "reading indexedDB", () => globalThis.indexedDB != null) === !0;
|
|
1114
1116
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(
|
|
1117
|
+
function pn(e) {
|
|
1118
|
+
return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(Te, "1"), localStorage.removeItem(Te), !0)) === !0;
|
|
1117
1119
|
}
|
|
1118
|
-
async function
|
|
1119
|
-
if (e === "none") return
|
|
1120
|
+
async function mn(e, t, n, r, i) {
|
|
1121
|
+
if (e === "none") return dn;
|
|
1120
1122
|
if (e === "memory") return new F(n, i);
|
|
1121
1123
|
if (e === "indexeddb" || e === "auto") {
|
|
1122
|
-
if (
|
|
1124
|
+
if (fn(r)) {
|
|
1123
1125
|
let e = await r.guardAsync("storage.unavailable", "opening IndexedDB", async () => {
|
|
1124
|
-
let { IndexedDbStorage: e } = await import("./indexeddb-storage-
|
|
1126
|
+
let { IndexedDbStorage: e } = await import("./indexeddb-storage-DAoHV_oL.js");
|
|
1125
1127
|
return new e(t, n, r, i);
|
|
1126
1128
|
});
|
|
1127
1129
|
if (e) return e;
|
|
1128
1130
|
}
|
|
1129
1131
|
if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB was asked for by name and is unavailable, using memory"), new F(n, i);
|
|
1130
1132
|
}
|
|
1131
|
-
return
|
|
1133
|
+
return pn(r) ? new un(n, r, i) : (r.report("storage.degraded", "no persistent storage available, offline logs are memory only"), new F(n, i));
|
|
1132
1134
|
}
|
|
1133
1135
|
//#endregion
|
|
1134
1136
|
//#region src/utils/sanitize.ts
|
|
1135
1137
|
function I(e, t) {
|
|
1136
1138
|
if (e.length <= t) return e;
|
|
1137
|
-
let n =
|
|
1139
|
+
let n = hn(e.charCodeAt(t - 1)) ? t - 1 : t;
|
|
1138
1140
|
return `${e.slice(0, n)}… [truncated ${String(e.length - n)} chars]`;
|
|
1139
1141
|
}
|
|
1140
|
-
function
|
|
1142
|
+
function hn(e) {
|
|
1141
1143
|
return e >= 55296 && e <= 56319;
|
|
1142
1144
|
}
|
|
1143
|
-
function
|
|
1145
|
+
function gn(e) {
|
|
1144
1146
|
return `[Element ${(e.nodeName ?? "NODE").toLowerCase()}${e.id ? `#${e.id}` : ""}${typeof e.className == "string" && e.className ? `.${e.className.trim().split(/\s+/).slice(0, 3).join(".")}` : ""}]`;
|
|
1145
1147
|
}
|
|
1146
1148
|
function L(e, t) {
|
|
@@ -1192,7 +1194,7 @@ function z(e, t, n, r, i) {
|
|
|
1192
1194
|
return R(`[${e.constructor.name}(${String(t)})]`, i);
|
|
1193
1195
|
}
|
|
1194
1196
|
if (e instanceof Promise) return R("[Promise]", i);
|
|
1195
|
-
if (typeof Node < "u" && e instanceof Node) return R(
|
|
1197
|
+
if (typeof Node < "u" && e instanceof Node) return R(gn(e), i);
|
|
1196
1198
|
if (Array.isArray(e)) {
|
|
1197
1199
|
let a = e, o = a.slice(0, t.maxArrayLength).map((e) => z(e, t, n, r + 1, i));
|
|
1198
1200
|
return a.length > t.maxArrayLength && o.push(R(`[${String(a.length - t.maxArrayLength)} more items]`, i)), o;
|
|
@@ -1224,7 +1226,7 @@ function B(e) {
|
|
|
1224
1226
|
}
|
|
1225
1227
|
//#endregion
|
|
1226
1228
|
//#region src/transport/exit-flush.ts
|
|
1227
|
-
var
|
|
1229
|
+
var _n = class {
|
|
1228
1230
|
deps;
|
|
1229
1231
|
installed = !1;
|
|
1230
1232
|
onVisibility = () => {
|
|
@@ -1266,10 +1268,10 @@ var mn = class {
|
|
|
1266
1268
|
let i = t.guard("transport.serialize_failed", `the ${e} exit flush could not serialize its batch`, () => this.deps.config.serializer.serialize(r.records));
|
|
1267
1269
|
if (!i) return;
|
|
1268
1270
|
if (B(i.body) > 6e4) {
|
|
1269
|
-
|
|
1271
|
+
sn(r, t);
|
|
1270
1272
|
return;
|
|
1271
1273
|
}
|
|
1272
|
-
n.searchParams.set(
|
|
1274
|
+
n.searchParams.set(Ve, r.id), n.searchParams.set(De, e);
|
|
1273
1275
|
let a = n.toString();
|
|
1274
1276
|
this.beacon(a, i.body) || this.keepaliveFetch(a, i.body, e);
|
|
1275
1277
|
}
|
|
@@ -1279,31 +1281,31 @@ var mn = class {
|
|
|
1279
1281
|
}
|
|
1280
1282
|
beacon(e, t) {
|
|
1281
1283
|
return this.deps.diagnostics.guard("transport.http_error", "sendBeacon", () => {
|
|
1282
|
-
let
|
|
1283
|
-
return
|
|
1284
|
+
let r = globalThis.navigator;
|
|
1285
|
+
return r?.sendBeacon ? r.sendBeacon(e, new Blob([t], { type: n })) : !1;
|
|
1284
1286
|
}) === !0;
|
|
1285
1287
|
}
|
|
1286
|
-
keepaliveFetch(e, t,
|
|
1287
|
-
let { config:
|
|
1288
|
-
|
|
1288
|
+
keepaliveFetch(e, t, r) {
|
|
1289
|
+
let { config: i, diagnostics: a } = this.deps;
|
|
1290
|
+
a.guard("transport.http_error", "the keepalive fetch fallback", () => {
|
|
1289
1291
|
fetch(e, {
|
|
1290
1292
|
method: "POST",
|
|
1291
1293
|
body: t,
|
|
1292
|
-
headers: { [
|
|
1293
|
-
credentials:
|
|
1294
|
+
headers: { [st]: n },
|
|
1295
|
+
credentials: i.credentials,
|
|
1294
1296
|
keepalive: !0
|
|
1295
1297
|
}).catch((e) => {
|
|
1296
|
-
|
|
1298
|
+
a.report("transport.http_error", "the exit flush failed", { reason: r }, e);
|
|
1297
1299
|
});
|
|
1298
1300
|
});
|
|
1299
1301
|
}
|
|
1300
1302
|
};
|
|
1301
1303
|
//#endregion
|
|
1302
1304
|
//#region src/transport/compression.ts
|
|
1303
|
-
async function
|
|
1305
|
+
async function vn(e) {
|
|
1304
1306
|
let t = globalThis.CompressionStream;
|
|
1305
1307
|
if (t === void 0) return null;
|
|
1306
|
-
let n = new Blob([e]).stream().pipeThrough(new t(
|
|
1308
|
+
let n = new Blob([e]).stream().pipeThrough(new t(me)), r = await new Response(n).arrayBuffer();
|
|
1307
1309
|
return new Uint8Array(r);
|
|
1308
1310
|
}
|
|
1309
1311
|
//#endregion
|
|
@@ -1317,16 +1319,16 @@ var V = class extends Error {
|
|
|
1317
1319
|
super(t), this.kind = e, this.status = n, this.retryAfterMs = r, this.maxBytes = i, this.name = "TransportError";
|
|
1318
1320
|
}
|
|
1319
1321
|
};
|
|
1320
|
-
function
|
|
1322
|
+
function yn(e) {
|
|
1321
1323
|
if (!e) return;
|
|
1322
1324
|
let t = Number(e);
|
|
1323
|
-
if (Number.isFinite(t)) return Math.max(0, t *
|
|
1325
|
+
if (Number.isFinite(t)) return Math.max(0, t * Ze);
|
|
1324
1326
|
let n = Date.parse(e);
|
|
1325
1327
|
return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
|
|
1326
1328
|
}
|
|
1327
1329
|
//#endregion
|
|
1328
1330
|
//#region src/transport/http-transport.ts
|
|
1329
|
-
var
|
|
1331
|
+
var bn = class {
|
|
1330
1332
|
config;
|
|
1331
1333
|
diagnostics;
|
|
1332
1334
|
throttledUntil = 0;
|
|
@@ -1340,33 +1342,33 @@ var _n = class {
|
|
|
1340
1342
|
return Math.max(0, this.throttledUntil - Date.now());
|
|
1341
1343
|
}
|
|
1342
1344
|
async post(e) {
|
|
1343
|
-
let { config: t } = this,
|
|
1345
|
+
let { config: t } = this, n;
|
|
1344
1346
|
try {
|
|
1345
|
-
|
|
1347
|
+
n = t.serializer.serialize(e.records);
|
|
1346
1348
|
} catch (t) {
|
|
1347
1349
|
this.diagnostics.report("transport.serialize_failed", "serializer threw, dropping the batch", { batchId: e.id }, t);
|
|
1348
1350
|
return;
|
|
1349
1351
|
}
|
|
1350
|
-
let
|
|
1351
|
-
|
|
1352
|
-
let
|
|
1353
|
-
typeof
|
|
1354
|
-
let
|
|
1355
|
-
if (
|
|
1352
|
+
let r = new Headers(await this.resolveHeaders());
|
|
1353
|
+
r.set(st, n.contentType), r.set(p, e.id), r.set(xe, String(e.attempts));
|
|
1354
|
+
let i = await this.encodeBody(n.body);
|
|
1355
|
+
typeof i != "string" && r.set(re, me);
|
|
1356
|
+
let a = await this.dispatch(r, i);
|
|
1357
|
+
if (a.ok) {
|
|
1356
1358
|
this.throttledUntil = 0;
|
|
1357
1359
|
return;
|
|
1358
1360
|
}
|
|
1359
|
-
throw await this.classify(
|
|
1361
|
+
throw await this.classify(a, e.id);
|
|
1360
1362
|
}
|
|
1361
1363
|
async encodeBody(e) {
|
|
1362
1364
|
let { config: t } = this;
|
|
1363
|
-
return t.compression !== "gzip" || B(e) <
|
|
1365
|
+
return t.compression !== "gzip" || B(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "gzipping the payload", () => vn(e)) ?? e;
|
|
1364
1366
|
}
|
|
1365
1367
|
async dispatch(e, t) {
|
|
1366
1368
|
let { config: n } = this, r = new AbortController(), i = setTimeout(() => {
|
|
1367
1369
|
r.abort();
|
|
1368
|
-
},
|
|
1369
|
-
|
|
1370
|
+
}, Me);
|
|
1371
|
+
C(i);
|
|
1370
1372
|
try {
|
|
1371
1373
|
return await fetch(n.endpoint, {
|
|
1372
1374
|
method: "POST",
|
|
@@ -1377,7 +1379,7 @@ var _n = class {
|
|
|
1377
1379
|
cache: "no-store"
|
|
1378
1380
|
});
|
|
1379
1381
|
} catch {
|
|
1380
|
-
if (r.signal.aborted) throw new V("timeout", `request exceeded ${String(
|
|
1382
|
+
if (r.signal.aborted) throw new V("timeout", `request exceeded ${String(Me)}ms`);
|
|
1381
1383
|
let e = globalThis.navigator?.onLine;
|
|
1382
1384
|
throw new V(e === !1 ? "offline" : "transient", "network error");
|
|
1383
1385
|
} finally {
|
|
@@ -1385,7 +1387,7 @@ var _n = class {
|
|
|
1385
1387
|
}
|
|
1386
1388
|
}
|
|
1387
1389
|
async classify(e, t) {
|
|
1388
|
-
let n = e.status, r =
|
|
1390
|
+
let n = e.status, r = yn(e.headers.get(te));
|
|
1389
1391
|
if (n === 401 || n === 403) return this.diagnostics.report("transport.rejected_credentials", `server returned ${String(n)}. In a cross-origin iframe the session cookie is a third-party cookie and is very likely blocked. Forward to the platform document instead of promoting to sender, or issue the cookie with the Partitioned attribute.`, {
|
|
1390
1392
|
status: n,
|
|
1391
1393
|
endpoint: this.config.endpoint
|
|
@@ -1393,7 +1395,7 @@ var _n = class {
|
|
|
1393
1395
|
if (n === 413) return new V("too_large", "payload too large", n, void 0, await this.readMaxBytes(e));
|
|
1394
1396
|
if (n === 429 || n === 503) {
|
|
1395
1397
|
let e = n === 429;
|
|
1396
|
-
return this.throttledUntil = Date.now() + (r ??
|
|
1398
|
+
return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "server throttled us", { retryAfterMs: r }), new V("throttled", e ? "throttled" : "service unavailable", n, r);
|
|
1397
1399
|
}
|
|
1398
1400
|
return n === 408 || n >= 500 ? new V("transient", `server error ${String(n)}`, n) : (this.diagnostics.report("transport.dropped_permanent", `server rejected the batch with ${String(n)}, dropping it`, {
|
|
1399
1401
|
batchId: t,
|
|
@@ -1410,7 +1412,7 @@ var _n = class {
|
|
|
1410
1412
|
let { headers: e } = this.config;
|
|
1411
1413
|
return e ? typeof e == "function" ? await this.diagnostics.guardAsync("transport.http_error", "headers() threw", () => Promise.resolve(e())) ?? {} : e : {};
|
|
1412
1414
|
}
|
|
1413
|
-
},
|
|
1415
|
+
}, xn = class {
|
|
1414
1416
|
storage;
|
|
1415
1417
|
transport;
|
|
1416
1418
|
diagnostics;
|
|
@@ -1427,10 +1429,10 @@ var _n = class {
|
|
|
1427
1429
|
this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i;
|
|
1428
1430
|
}
|
|
1429
1431
|
start() {
|
|
1430
|
-
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(
|
|
1432
|
+
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(f);
|
|
1431
1433
|
}
|
|
1432
1434
|
nudge() {
|
|
1433
|
-
this.draining || this.schedule(
|
|
1435
|
+
this.draining || this.schedule(fe);
|
|
1434
1436
|
}
|
|
1435
1437
|
stop() {
|
|
1436
1438
|
this.stopped = !0, typeof removeEventListener < "u" && removeEventListener("online", this.onOnline), this.clearTimer();
|
|
@@ -1441,20 +1443,20 @@ var _n = class {
|
|
|
1441
1443
|
let t = setTimeout(() => {
|
|
1442
1444
|
this.drain();
|
|
1443
1445
|
}, e);
|
|
1444
|
-
this.timer = t,
|
|
1446
|
+
this.timer = t, C(t);
|
|
1445
1447
|
}
|
|
1446
1448
|
clearTimer() {
|
|
1447
1449
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1448
1450
|
}
|
|
1449
1451
|
backoffMs() {
|
|
1450
|
-
let e = Math.min(
|
|
1452
|
+
let e = Math.min(fe * 2 ** this.attempt, ee);
|
|
1451
1453
|
return Math.random() * e;
|
|
1452
1454
|
}
|
|
1453
1455
|
async drain() {
|
|
1454
1456
|
if (!this.draining) {
|
|
1455
1457
|
this.draining = !0;
|
|
1456
1458
|
try {
|
|
1457
|
-
await
|
|
1459
|
+
await nn("ui-observability.drain", this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(f);
|
|
1458
1460
|
} finally {
|
|
1459
1461
|
this.draining = !1;
|
|
1460
1462
|
}
|
|
@@ -1462,17 +1464,17 @@ var _n = class {
|
|
|
1462
1464
|
}
|
|
1463
1465
|
async drainLocked() {
|
|
1464
1466
|
try {
|
|
1465
|
-
if (globalThis.navigator?.onLine === !1) return this.schedule(
|
|
1467
|
+
if (globalThis.navigator?.onLine === !1) return this.schedule(f), !0;
|
|
1466
1468
|
let e = await this.storage.take(this.batchesPerDrain);
|
|
1467
|
-
if (e.length === 0) return this.schedule(
|
|
1469
|
+
if (e.length === 0) return this.schedule(f), !0;
|
|
1468
1470
|
for (let t of e) if (this.stopped || !await this.deliver(t)) return !0;
|
|
1469
|
-
return this.schedule(e.length === this.batchesPerDrain ? 0 :
|
|
1471
|
+
return this.schedule(e.length === this.batchesPerDrain ? 0 : f), !0;
|
|
1470
1472
|
} catch (e) {
|
|
1471
1473
|
return this.diagnostics.report("storage.degraded", "the drain loop threw", void 0, e), this.attempt++, this.schedule(this.backoffMs()), !0;
|
|
1472
1474
|
}
|
|
1473
1475
|
}
|
|
1474
1476
|
async deliver(e) {
|
|
1475
|
-
if (e.attempts >=
|
|
1477
|
+
if (e.attempts >= m.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `giving up on a batch after ${e.attempts.toString()} attempts`, {
|
|
1476
1478
|
batchId: e.id,
|
|
1477
1479
|
records: e.records.length
|
|
1478
1480
|
}), await this.storage.remove(e.id), !0;
|
|
@@ -1480,11 +1482,11 @@ var _n = class {
|
|
|
1480
1482
|
return await this.transport.send(e), await this.storage.remove(e.id), this.attempt = 0, !0;
|
|
1481
1483
|
} catch (t) {
|
|
1482
1484
|
let n = t instanceof V ? t : void 0;
|
|
1483
|
-
return n?.kind === "permanent" ? (await this.storage.remove(e.id), !0) : n?.kind === "too_large" ? (await this.splitStored(e, n.maxBytes), !0) : n?.kind === "offline" ? (this.schedule(
|
|
1485
|
+
return n?.kind === "permanent" ? (await this.storage.remove(e.id), !0) : n?.kind === "too_large" ? (await this.splitStored(e, n.maxBytes), !0) : n?.kind === "offline" ? (this.schedule(f), !1) : (await this.storage.bumpAttempts(e.id, e.attempts + 1), this.attempt++, this.schedule(n?.retryAfterMs ?? this.backoffMs()), !1);
|
|
1484
1486
|
}
|
|
1485
1487
|
}
|
|
1486
1488
|
async splitStored(e, t) {
|
|
1487
|
-
let n =
|
|
1489
|
+
let n = tn(e);
|
|
1488
1490
|
if (await this.storage.remove(e.id), !n) {
|
|
1489
1491
|
this.diagnostics.report("transport.dropped_permanent", "a single record exceeds the server limit and was dropped", {
|
|
1490
1492
|
batchId: e.id,
|
|
@@ -1499,40 +1501,39 @@ var _n = class {
|
|
|
1499
1501
|
});
|
|
1500
1502
|
for (let e of n) await this.storage.save(e);
|
|
1501
1503
|
}
|
|
1502
|
-
},
|
|
1504
|
+
}, Sn = {
|
|
1503
1505
|
TRACE: "debug",
|
|
1504
1506
|
DEBUG: "debug",
|
|
1505
1507
|
INFO: "info",
|
|
1506
1508
|
WARN: "warn",
|
|
1507
1509
|
ERROR: "error",
|
|
1508
1510
|
FATAL: "error"
|
|
1509
|
-
},
|
|
1510
|
-
enabled;
|
|
1511
|
+
}, Cn = class {
|
|
1511
1512
|
minLevel;
|
|
1512
|
-
constructor(e
|
|
1513
|
-
this.
|
|
1513
|
+
constructor(e) {
|
|
1514
|
+
this.minLevel = e;
|
|
1514
1515
|
}
|
|
1515
|
-
update(e
|
|
1516
|
-
this.
|
|
1516
|
+
update(e) {
|
|
1517
|
+
this.minLevel = e;
|
|
1517
1518
|
}
|
|
1518
1519
|
write(e, t, n) {
|
|
1519
|
-
if (
|
|
1520
|
-
let r = `%c${
|
|
1520
|
+
if (this.minLevel === null || b[e] < b[this.minLevel] || typeof console > "u") return;
|
|
1521
|
+
let r = `%c${Ke}%c ${e}`;
|
|
1521
1522
|
if (n === void 0) {
|
|
1522
|
-
console[
|
|
1523
|
+
console[Sn[e]](r, s, "", t);
|
|
1523
1524
|
return;
|
|
1524
1525
|
}
|
|
1525
|
-
console[
|
|
1526
|
+
console[Sn[e]](r, s, "", t, n);
|
|
1526
1527
|
}
|
|
1527
1528
|
}, H = null;
|
|
1528
1529
|
function U(e, t) {
|
|
1529
1530
|
let n = e[t];
|
|
1530
1531
|
return n !== void 0 && e instanceof n;
|
|
1531
1532
|
}
|
|
1532
|
-
function
|
|
1533
|
+
function wn(e) {
|
|
1533
1534
|
if (H) return H;
|
|
1534
1535
|
let t = globalThis, n = t.navigator?.userAgent ?? "", r = "browser", i, a, o = !1, s = t.fin?.me;
|
|
1535
|
-
return U(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : U(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : U(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 ||
|
|
1536
|
+
return U(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : U(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : U(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || Tn(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = Ue.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "reading fin.me.identity", () => {
|
|
1536
1537
|
let e = s.identity;
|
|
1537
1538
|
i = e?.uuid, a = e?.name;
|
|
1538
1539
|
})), H = {
|
|
@@ -1541,13 +1542,13 @@ function xn(e) {
|
|
|
1541
1542
|
openfinName: a,
|
|
1542
1543
|
userAgent: n,
|
|
1543
1544
|
isWorker: o,
|
|
1544
|
-
isTopLevelDocument:
|
|
1545
|
+
isTopLevelDocument: En()
|
|
1545
1546
|
}, H;
|
|
1546
1547
|
}
|
|
1547
|
-
function
|
|
1548
|
-
return
|
|
1548
|
+
function Tn(t) {
|
|
1549
|
+
return ft.test(t) ? !0 : (e.test(t) || dt.test(t) && ht.test(t)) && t.includes("AppleWebKit") && !t.includes("Safari/");
|
|
1549
1550
|
}
|
|
1550
|
-
function
|
|
1551
|
+
function En() {
|
|
1551
1552
|
if (typeof window > "u") return !1;
|
|
1552
1553
|
try {
|
|
1553
1554
|
return window.self === window.top;
|
|
@@ -1555,7 +1556,7 @@ function Cn() {
|
|
|
1555
1556
|
return !1;
|
|
1556
1557
|
}
|
|
1557
1558
|
}
|
|
1558
|
-
function
|
|
1559
|
+
function Dn() {
|
|
1559
1560
|
try {
|
|
1560
1561
|
return typeof location < "u" ? location.href : "";
|
|
1561
1562
|
} catch {
|
|
@@ -1564,7 +1565,7 @@ function wn() {
|
|
|
1564
1565
|
}
|
|
1565
1566
|
//#endregion
|
|
1566
1567
|
//#region src/utils/sequence.ts
|
|
1567
|
-
var
|
|
1568
|
+
var On = class {
|
|
1568
1569
|
value = 0;
|
|
1569
1570
|
next() {
|
|
1570
1571
|
return ++this.value;
|
|
@@ -1575,61 +1576,61 @@ var Tn = class {
|
|
|
1575
1576
|
};
|
|
1576
1577
|
//#endregion
|
|
1577
1578
|
//#region src/utils/tracing.ts
|
|
1578
|
-
function
|
|
1579
|
-
return
|
|
1579
|
+
function kn() {
|
|
1580
|
+
return A(16);
|
|
1580
1581
|
}
|
|
1581
|
-
function
|
|
1582
|
-
return
|
|
1582
|
+
function An() {
|
|
1583
|
+
return A(8);
|
|
1583
1584
|
}
|
|
1584
|
-
function
|
|
1585
|
+
function jn() {
|
|
1585
1586
|
return {
|
|
1586
|
-
traceId:
|
|
1587
|
-
spanId:
|
|
1587
|
+
traceId: kn(),
|
|
1588
|
+
spanId: An(),
|
|
1588
1589
|
traceFlags: 1,
|
|
1589
1590
|
startedAt: Date.now()
|
|
1590
1591
|
};
|
|
1591
1592
|
}
|
|
1592
|
-
function
|
|
1593
|
+
function Mn(e) {
|
|
1593
1594
|
return {
|
|
1594
1595
|
traceId: e.traceId,
|
|
1595
1596
|
spanId: e.spanId,
|
|
1596
1597
|
traceFlags: e.traceFlags
|
|
1597
1598
|
};
|
|
1598
1599
|
}
|
|
1599
|
-
var
|
|
1600
|
+
var Nn = class {
|
|
1600
1601
|
diagnostics;
|
|
1601
1602
|
maxAgeMs;
|
|
1602
|
-
ambient =
|
|
1603
|
-
constructor(e, t =
|
|
1603
|
+
ambient = jn();
|
|
1604
|
+
constructor(e, t = lt) {
|
|
1604
1605
|
this.diagnostics = e, this.maxAgeMs = t;
|
|
1605
1606
|
}
|
|
1606
1607
|
resolve() {
|
|
1607
1608
|
let e = this.diagnostics.guard("trace.otel_failed", "reading the active OpenTelemetry span", () => {
|
|
1608
|
-
let e =
|
|
1609
|
+
let e = Tt.getActiveSpan();
|
|
1609
1610
|
if (e === void 0) return;
|
|
1610
1611
|
let t = e.spanContext();
|
|
1611
|
-
if (
|
|
1612
|
+
if (Ct(t)) return {
|
|
1612
1613
|
traceId: t.traceId,
|
|
1613
1614
|
spanId: t.spanId,
|
|
1614
1615
|
traceFlags: t.traceFlags
|
|
1615
1616
|
};
|
|
1616
1617
|
});
|
|
1617
|
-
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"),
|
|
1618
|
+
return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Mn(this.ambient)) : e;
|
|
1618
1619
|
}
|
|
1619
1620
|
rotate(e) {
|
|
1620
|
-
return this.ambient =
|
|
1621
|
+
return this.ambient = jn(), Mn(this.ambient);
|
|
1621
1622
|
}
|
|
1622
1623
|
headers() {
|
|
1623
1624
|
let e = {};
|
|
1624
1625
|
if (this.diagnostics.guard("trace.otel_failed", "injecting OpenTelemetry headers", () => {
|
|
1625
|
-
|
|
1626
|
+
wt.inject(St.active(), e);
|
|
1626
1627
|
}), !e.traceparent) {
|
|
1627
1628
|
let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
|
|
1628
|
-
e
|
|
1629
|
+
e[et] = `00-${t.traceId}-${t.spanId}-${n}`;
|
|
1629
1630
|
}
|
|
1630
1631
|
return e;
|
|
1631
1632
|
}
|
|
1632
|
-
},
|
|
1633
|
+
}, Pn = class {
|
|
1633
1634
|
buffer;
|
|
1634
1635
|
pointer = 0;
|
|
1635
1636
|
filled = !1;
|
|
@@ -1637,13 +1638,6 @@ var An = class {
|
|
|
1637
1638
|
constructor(e) {
|
|
1638
1639
|
this.capacity = Math.max(e, 1), this.buffer = Array(this.capacity);
|
|
1639
1640
|
}
|
|
1640
|
-
resize(e) {
|
|
1641
|
-
let t = Math.max(e, 1);
|
|
1642
|
-
if (t === this.capacity) return;
|
|
1643
|
-
let n = this.snapshot().slice(-t);
|
|
1644
|
-
this.capacity = t, this.clear();
|
|
1645
|
-
for (let e of n) this.push(e);
|
|
1646
|
-
}
|
|
1647
1641
|
push(e) {
|
|
1648
1642
|
this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0);
|
|
1649
1643
|
}
|
|
@@ -1656,15 +1650,15 @@ var An = class {
|
|
|
1656
1650
|
};
|
|
1657
1651
|
//#endregion
|
|
1658
1652
|
//#region src/transport/serializers/ecs.ts
|
|
1659
|
-
function
|
|
1660
|
-
return
|
|
1653
|
+
function Fn(e) {
|
|
1654
|
+
return Ie.test(e) ? Number(BigInt(e) / ze) : Date.now();
|
|
1661
1655
|
}
|
|
1662
|
-
var
|
|
1656
|
+
var In = {
|
|
1663
1657
|
name: "ecs",
|
|
1664
1658
|
serialize(e) {
|
|
1665
1659
|
return {
|
|
1666
1660
|
body: `${e.map((e) => {
|
|
1667
|
-
let t =
|
|
1661
|
+
let t = Fn(e.timeUnixNano);
|
|
1668
1662
|
return JSON.stringify({
|
|
1669
1663
|
"@timestamp": new Date(t).toISOString(),
|
|
1670
1664
|
message: e.body,
|
|
@@ -1672,11 +1666,11 @@ var Nn = {
|
|
|
1672
1666
|
trace: { id: e.traceId },
|
|
1673
1667
|
span: { id: e.spanId },
|
|
1674
1668
|
service: {
|
|
1675
|
-
name: e.resource[
|
|
1676
|
-
version: e.resource[
|
|
1677
|
-
environment: e.resource[
|
|
1669
|
+
name: e.resource[c],
|
|
1670
|
+
version: e.resource[de],
|
|
1671
|
+
environment: e.resource[o]
|
|
1678
1672
|
},
|
|
1679
|
-
user_agent: { original: e.resource[
|
|
1673
|
+
user_agent: { original: e.resource[yt] },
|
|
1680
1674
|
url: { full: e.attributes["url.full"] ?? e.attributes["page.url"] },
|
|
1681
1675
|
labels: {
|
|
1682
1676
|
...e.resource,
|
|
@@ -1684,19 +1678,19 @@ var Nn = {
|
|
|
1684
1678
|
}
|
|
1685
1679
|
});
|
|
1686
1680
|
}).join("\n")}\n`,
|
|
1687
|
-
contentType:
|
|
1681
|
+
contentType: Ye
|
|
1688
1682
|
};
|
|
1689
1683
|
}
|
|
1690
1684
|
};
|
|
1691
1685
|
//#endregion
|
|
1692
1686
|
//#region src/transport/serializers/otlp.ts
|
|
1693
|
-
function
|
|
1694
|
-
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(
|
|
1687
|
+
function Ln(e) {
|
|
1688
|
+
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(Ln).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: W(e) } } : null;
|
|
1695
1689
|
}
|
|
1696
1690
|
function W(e) {
|
|
1697
1691
|
let t = [];
|
|
1698
1692
|
for (let [n, r] of Object.entries(e)) {
|
|
1699
|
-
let e =
|
|
1693
|
+
let e = Ln(r);
|
|
1700
1694
|
e && t.push({
|
|
1701
1695
|
key: n,
|
|
1702
1696
|
value: e
|
|
@@ -1704,19 +1698,19 @@ function W(e) {
|
|
|
1704
1698
|
}
|
|
1705
1699
|
return t;
|
|
1706
1700
|
}
|
|
1707
|
-
var
|
|
1708
|
-
function
|
|
1709
|
-
let t =
|
|
1701
|
+
var Rn = /* @__PURE__ */ new WeakMap();
|
|
1702
|
+
function zn(e) {
|
|
1703
|
+
let t = Rn.get(e);
|
|
1710
1704
|
if (t !== void 0) return t;
|
|
1711
1705
|
let n = JSON.stringify(e);
|
|
1712
|
-
return
|
|
1706
|
+
return Rn.set(e, n), n;
|
|
1713
1707
|
}
|
|
1714
1708
|
var G = {
|
|
1715
|
-
name:
|
|
1709
|
+
name: xt,
|
|
1716
1710
|
serialize(e) {
|
|
1717
1711
|
let t = /* @__PURE__ */ new Map();
|
|
1718
1712
|
for (let n of e) {
|
|
1719
|
-
let e =
|
|
1713
|
+
let e = zn(n.resource), r = t.get(e);
|
|
1720
1714
|
if (r) {
|
|
1721
1715
|
r.records.push(n);
|
|
1722
1716
|
continue;
|
|
@@ -1730,8 +1724,8 @@ var G = {
|
|
|
1730
1724
|
resource: { attributes: W(e.resource) },
|
|
1731
1725
|
scopeLogs: [{
|
|
1732
1726
|
scope: {
|
|
1733
|
-
name:
|
|
1734
|
-
version:
|
|
1727
|
+
name: Le,
|
|
1728
|
+
version: pt
|
|
1735
1729
|
},
|
|
1736
1730
|
logRecords: e.records.map((e) => ({
|
|
1737
1731
|
timeUnixNano: e.timeUnixNano,
|
|
@@ -1748,93 +1742,67 @@ var G = {
|
|
|
1748
1742
|
}));
|
|
1749
1743
|
return {
|
|
1750
1744
|
body: JSON.stringify({ resourceLogs: n }),
|
|
1751
|
-
contentType:
|
|
1745
|
+
contentType: ue
|
|
1752
1746
|
};
|
|
1753
1747
|
}
|
|
1754
1748
|
};
|
|
1755
1749
|
//#endregion
|
|
1756
1750
|
//#region src/core/config.ts
|
|
1757
|
-
function
|
|
1751
|
+
function Bn(e) {
|
|
1758
1752
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
1759
1753
|
}
|
|
1760
|
-
function
|
|
1761
|
-
return e === void 0 ? t ?? G : e === "otlp" ? G : e === "ecs" ?
|
|
1754
|
+
function Vn(e, t, n) {
|
|
1755
|
+
return e === void 0 ? t ?? G : e === "otlp" ? G : e === "ecs" ? In : Bn(e) ? e : (n.report("config.invalid", `serializer must be "${xt}", "ecs" or an implementation`), G);
|
|
1756
|
+
}
|
|
1757
|
+
function Hn(e, t) {
|
|
1758
|
+
return e === void 0 ? t : e === !1 ? null : e === !0 ? l : e;
|
|
1762
1759
|
}
|
|
1763
|
-
function
|
|
1764
|
-
let
|
|
1765
|
-
...
|
|
1760
|
+
function Un(e, t, n) {
|
|
1761
|
+
let r = n ?? qe, i = {
|
|
1762
|
+
...r,
|
|
1766
1763
|
...e,
|
|
1767
|
-
serializer:
|
|
1768
|
-
|
|
1769
|
-
logs: {
|
|
1770
|
-
...i.streams.logs,
|
|
1771
|
-
...e.streams?.logs
|
|
1772
|
-
},
|
|
1773
|
-
metrics: {
|
|
1774
|
-
...i.streams.metrics,
|
|
1775
|
-
...e.streams?.metrics
|
|
1776
|
-
}
|
|
1777
|
-
},
|
|
1778
|
-
storage: {
|
|
1779
|
-
...i.storage,
|
|
1780
|
-
...e.storage
|
|
1781
|
-
},
|
|
1782
|
-
retry: {
|
|
1783
|
-
...i.retry,
|
|
1784
|
-
...e.retry
|
|
1785
|
-
},
|
|
1764
|
+
serializer: Vn(e.serializer, n?.serializer, t),
|
|
1765
|
+
console: Hn(e.console, r.console),
|
|
1786
1766
|
sampling: {
|
|
1787
|
-
...
|
|
1767
|
+
...r.sampling,
|
|
1788
1768
|
...e.sampling,
|
|
1789
1769
|
rates: {
|
|
1790
|
-
...
|
|
1770
|
+
...r.sampling.rates,
|
|
1791
1771
|
...e.sampling?.rates
|
|
1792
1772
|
}
|
|
1793
1773
|
},
|
|
1794
|
-
journey: {
|
|
1795
|
-
...i.journey,
|
|
1796
|
-
...e.journey
|
|
1797
|
-
},
|
|
1798
1774
|
bus: {
|
|
1799
|
-
...
|
|
1775
|
+
...r.bus,
|
|
1800
1776
|
...e.bus
|
|
1801
1777
|
},
|
|
1802
1778
|
capture: {
|
|
1803
|
-
...
|
|
1779
|
+
...r.capture,
|
|
1804
1780
|
...e.capture
|
|
1805
|
-
},
|
|
1806
|
-
limits: {
|
|
1807
|
-
...i.limits,
|
|
1808
|
-
...e.limits
|
|
1809
|
-
},
|
|
1810
|
-
console: {
|
|
1811
|
-
...i.console,
|
|
1812
|
-
...e.console
|
|
1813
1781
|
}
|
|
1814
1782
|
};
|
|
1815
|
-
if (!
|
|
1783
|
+
if (!i.endpoint) t.report("config.invalid", "endpoint is missing. Records will be built and dropped, never sent.");
|
|
1816
1784
|
else try {
|
|
1817
|
-
new URL(
|
|
1785
|
+
new URL(i.endpoint);
|
|
1818
1786
|
} catch (e) {
|
|
1819
|
-
t.report("config.invalid", `endpoint is not a valid absolute URL: ${
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
let
|
|
1823
|
-
(typeof
|
|
1824
|
-
let
|
|
1825
|
-
for (let [e, n] of
|
|
1826
|
-
|
|
1827
|
-
let
|
|
1828
|
-
for (let n of Object.keys(e))
|
|
1829
|
-
return
|
|
1830
|
-
}
|
|
1831
|
-
function
|
|
1832
|
-
for (let n of Object.keys(t))
|
|
1833
|
-
for (let n of
|
|
1787
|
+
t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}`, void 0, e);
|
|
1788
|
+
}
|
|
1789
|
+
i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record will report service.name as '${rt}'.`), rt);
|
|
1790
|
+
let a = i.sampling.defaultRate;
|
|
1791
|
+
(typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1, got ${String(a)}`), i.sampling.defaultRate = 1);
|
|
1792
|
+
let o = Object.entries(i.sampling.rates);
|
|
1793
|
+
for (let [e, n] of o) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1, got ${String(n)}`), i.sampling.rates[e] = 1);
|
|
1794
|
+
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]);
|
|
1795
|
+
let s = /* @__PURE__ */ new Set([...Object.keys(qe), ...ke]);
|
|
1796
|
+
for (let n of Object.keys(e)) s.has(n) || t.report("config.invalid", `unknown config key "${n}", ignored. Typo?`);
|
|
1797
|
+
return i;
|
|
1798
|
+
}
|
|
1799
|
+
function Wn(e, t) {
|
|
1800
|
+
for (let n of Object.keys(t)) _e.includes(n) || Object.assign(e, { [n]: t[n] });
|
|
1801
|
+
for (let n of _e) Object.assign(e[n], t[n]);
|
|
1834
1802
|
}
|
|
1835
1803
|
//#endregion
|
|
1836
1804
|
//#region src/core/context.ts
|
|
1837
|
-
var
|
|
1805
|
+
var Gn = class {
|
|
1838
1806
|
map = /* @__PURE__ */ new Map();
|
|
1839
1807
|
set(e, t) {
|
|
1840
1808
|
this.map.set(e, t);
|
|
@@ -1854,12 +1822,12 @@ var Vn = class {
|
|
|
1854
1822
|
getAll() {
|
|
1855
1823
|
return Object.fromEntries(this.map);
|
|
1856
1824
|
}
|
|
1857
|
-
},
|
|
1825
|
+
}, Kn = class {
|
|
1858
1826
|
handler;
|
|
1859
1827
|
throttleMs;
|
|
1860
1828
|
counters = /* @__PURE__ */ new Map();
|
|
1861
1829
|
lastEmitted = /* @__PURE__ */ new Map();
|
|
1862
|
-
constructor(e, t =
|
|
1830
|
+
constructor(e, t = ce) {
|
|
1863
1831
|
this.handler = e, this.throttleMs = t;
|
|
1864
1832
|
}
|
|
1865
1833
|
setHandler(e) {
|
|
@@ -1884,7 +1852,7 @@ var Vn = class {
|
|
|
1884
1852
|
if (this.handler) try {
|
|
1885
1853
|
this.handler(o);
|
|
1886
1854
|
} catch (e) {
|
|
1887
|
-
this.count("handler.threw"), typeof console < "u" && console.warn(`${
|
|
1855
|
+
this.count("handler.threw"), typeof console < "u" && console.warn(`${Ke} onDiagnostic handler threw`, e);
|
|
1888
1856
|
}
|
|
1889
1857
|
}
|
|
1890
1858
|
guard(e, t, n) {
|
|
@@ -1909,20 +1877,22 @@ var Vn = class {
|
|
|
1909
1877
|
reset() {
|
|
1910
1878
|
this.counters.clear(), this.lastEmitted.clear();
|
|
1911
1879
|
}
|
|
1880
|
+
}, qn = {
|
|
1881
|
+
maxAgeMs: Re,
|
|
1882
|
+
endOnOwnerClose: !1,
|
|
1883
|
+
urlParam: tt
|
|
1912
1884
|
};
|
|
1913
|
-
//#endregion
|
|
1914
|
-
//#region src/core/journey.ts
|
|
1915
1885
|
function K(e, t) {
|
|
1916
1886
|
let n = Reflect.get(e, t);
|
|
1917
1887
|
return typeof n == "string" && n !== "" ? n : void 0;
|
|
1918
1888
|
}
|
|
1919
|
-
function
|
|
1889
|
+
function Jn(e, t) {
|
|
1920
1890
|
let n = Reflect.get(e, t);
|
|
1921
1891
|
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
1922
1892
|
}
|
|
1923
|
-
function
|
|
1893
|
+
function Yn(e) {
|
|
1924
1894
|
if (typeof e != "object" || !e) return null;
|
|
1925
|
-
let t = K(e, "id"), n = K(e, "name"), r =
|
|
1895
|
+
let t = K(e, "id"), n = K(e, "name"), r = Jn(e, "startedAt");
|
|
1926
1896
|
return t === void 0 || n === void 0 || r === void 0 ? null : {
|
|
1927
1897
|
id: t,
|
|
1928
1898
|
name: n,
|
|
@@ -1931,35 +1901,35 @@ function Wn(e) {
|
|
|
1931
1901
|
ownerContextId: K(e, "ownerContextId") ?? ""
|
|
1932
1902
|
};
|
|
1933
1903
|
}
|
|
1934
|
-
function
|
|
1904
|
+
function Xn(e) {
|
|
1935
1905
|
if (typeof e != "object" || !e) return null;
|
|
1936
1906
|
let t = K(e, "i"), n = K(e, "n");
|
|
1937
1907
|
return t === void 0 || n === void 0 ? null : {
|
|
1938
1908
|
id: t,
|
|
1939
1909
|
name: n,
|
|
1940
|
-
startedAt:
|
|
1910
|
+
startedAt: Jn(e, "s") ?? Date.now(),
|
|
1941
1911
|
parentId: void 0,
|
|
1942
1912
|
ownerContextId: ""
|
|
1943
1913
|
};
|
|
1944
1914
|
}
|
|
1945
|
-
function
|
|
1915
|
+
function Zn(e) {
|
|
1946
1916
|
let t = JSON.stringify({
|
|
1947
1917
|
i: e.id,
|
|
1948
1918
|
n: e.name.slice(0, 64),
|
|
1949
1919
|
s: e.startedAt
|
|
1950
1920
|
}), n = new TextEncoder().encode(t), r = "";
|
|
1951
1921
|
for (let e of n) r += String.fromCharCode(e);
|
|
1952
|
-
return btoa(r).replace(
|
|
1922
|
+
return btoa(r).replace(Be, "-").replace(Ee, "_").replace(He, "");
|
|
1953
1923
|
}
|
|
1954
|
-
function
|
|
1924
|
+
function Qn(e, t) {
|
|
1955
1925
|
let n = new Promise((e, n) => {
|
|
1956
|
-
|
|
1926
|
+
C(setTimeout(() => {
|
|
1957
1927
|
n(/* @__PURE__ */ Error(`timed out after ${String(t)}ms`));
|
|
1958
1928
|
}, t));
|
|
1959
1929
|
});
|
|
1960
1930
|
return Promise.race([e, n]);
|
|
1961
1931
|
}
|
|
1962
|
-
var
|
|
1932
|
+
var $n = class {
|
|
1963
1933
|
options;
|
|
1964
1934
|
diagnostics;
|
|
1965
1935
|
contextId;
|
|
@@ -1982,7 +1952,7 @@ var Jn = class {
|
|
|
1982
1952
|
}
|
|
1983
1953
|
start(e, t = {}) {
|
|
1984
1954
|
let n = {
|
|
1985
|
-
id: t.id ??
|
|
1955
|
+
id: t.id ?? j(),
|
|
1986
1956
|
name: e,
|
|
1987
1957
|
startedAt: Date.now(),
|
|
1988
1958
|
parentId: t.parent ? this.journey?.id : void 0,
|
|
@@ -2000,7 +1970,7 @@ var Jn = class {
|
|
|
2000
1970
|
getToken() {
|
|
2001
1971
|
let e = this.journey;
|
|
2002
1972
|
if (e === null) return;
|
|
2003
|
-
let t =
|
|
1973
|
+
let t = Zn(e);
|
|
2004
1974
|
if (t.length > 256) {
|
|
2005
1975
|
this.diagnostics.report("journey.token_too_large", "journey token exceeded the size cap and was not issued", { length: t.length });
|
|
2006
1976
|
return;
|
|
@@ -2024,7 +1994,7 @@ var Jn = class {
|
|
|
2024
1994
|
this.clearTimer();
|
|
2025
1995
|
}
|
|
2026
1996
|
restore(e) {
|
|
2027
|
-
let t =
|
|
1997
|
+
let t = Yn(this.diagnostics.guard("storage.degraded", "parsing the persisted journey", () => JSON.parse(e)));
|
|
2028
1998
|
return t === null ? !1 : Date.now() - t.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "discarded a persisted journey older than maxAgeMs", { name: t.name }), this.clearStored(), !1) : (this.setJourney(t), this.diagnostics.report("journey.adopted", `resumed journey "${t.name}"`, {
|
|
2029
1999
|
source: "sessionStorage",
|
|
2030
2000
|
journeyId: t.id
|
|
@@ -2032,8 +2002,8 @@ var Jn = class {
|
|
|
2032
2002
|
}
|
|
2033
2003
|
decodeToken(e) {
|
|
2034
2004
|
return this.diagnostics.guard("config.invalid", "decoding a seeded journey token", () => {
|
|
2035
|
-
let t = e.replace(
|
|
2036
|
-
return
|
|
2005
|
+
let t = e.replace(at, "+").replace(Qe, "/"), n = (4 - t.length % 4) % 4, r = "=".repeat(n), i = Uint8Array.from(atob(t + r), (e) => e.charCodeAt(0));
|
|
2006
|
+
return Xn(JSON.parse(new TextDecoder().decode(i)));
|
|
2037
2007
|
}) ?? null;
|
|
2038
2008
|
}
|
|
2039
2009
|
setJourney(e) {
|
|
@@ -2043,7 +2013,7 @@ var Jn = class {
|
|
|
2043
2013
|
let t = Math.max(this.options.maxAgeMs - (Date.now() - e.startedAt), 0), n = setTimeout(() => {
|
|
2044
2014
|
this.diagnostics.report("journey.expired", `journey "${e.name}" hit maxAgeMs and was ended automatically`, { journeyId: e.id }), this.journey = null, this.expiryTimer = null, this.clearStored();
|
|
2045
2015
|
}, t);
|
|
2046
|
-
this.expiryTimer = n,
|
|
2016
|
+
this.expiryTimer = n, C(n);
|
|
2047
2017
|
}
|
|
2048
2018
|
clearStored() {
|
|
2049
2019
|
this.diagnostics.guard("storage.unavailable", "clearing the persisted journey", () => {
|
|
@@ -2059,76 +2029,102 @@ var Jn = class {
|
|
|
2059
2029
|
async readOpenFinToken() {
|
|
2060
2030
|
let e = globalThis.fin?.me, t = e?.getOptions;
|
|
2061
2031
|
if (t === void 0) return null;
|
|
2062
|
-
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () =>
|
|
2032
|
+
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () => Qn(t.call(e), $e)))?.customData?.[ot];
|
|
2063
2033
|
return typeof n == "string" ? n : null;
|
|
2064
2034
|
}
|
|
2065
2035
|
};
|
|
2066
2036
|
//#endregion
|
|
2067
2037
|
//#region src/core/sampling.ts
|
|
2068
|
-
function
|
|
2069
|
-
let t =
|
|
2070
|
-
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t,
|
|
2038
|
+
function er(e) {
|
|
2039
|
+
let t = be;
|
|
2040
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, h);
|
|
2071
2041
|
return t >>> 0;
|
|
2072
2042
|
}
|
|
2073
2043
|
function q(e, t) {
|
|
2074
2044
|
let n = e.attributes[t];
|
|
2075
2045
|
return typeof n == "string" ? n : "";
|
|
2076
2046
|
}
|
|
2077
|
-
function
|
|
2047
|
+
function tr(e, t) {
|
|
2078
2048
|
let { rates: n, defaultRate: r } = t.sampling, i, a = -1;
|
|
2079
2049
|
for (let [t, r] of Object.entries(n)) (e === t || e.startsWith(`${t}.`)) && t.length > a && (i = r, a = t.length);
|
|
2080
2050
|
return i ?? r;
|
|
2081
2051
|
}
|
|
2082
|
-
function
|
|
2052
|
+
function nr(e, t) {
|
|
2083
2053
|
if (e.severityText === "ERROR" || e.severityText === "FATAL" || t.sampling.alwaysSampleTypes.includes(q(e, "log.type"))) return !0;
|
|
2084
|
-
let n =
|
|
2085
|
-
return n >= 1 ? !0 : n <= 0 ? !1 :
|
|
2054
|
+
let n = tr(q(e, y), t);
|
|
2055
|
+
return n >= 1 ? !0 : n <= 0 ? !1 : er(q(e, "journey.id") || e.traceId) / Ge < n;
|
|
2086
2056
|
}
|
|
2087
2057
|
//#endregion
|
|
2088
2058
|
//#region src/core/pipeline.ts
|
|
2089
|
-
function
|
|
2090
|
-
return e.attributes[
|
|
2091
|
-
}
|
|
2092
|
-
var
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2059
|
+
function rr(e) {
|
|
2060
|
+
return e.attributes[v] === it;
|
|
2061
|
+
}
|
|
2062
|
+
var ir = {
|
|
2063
|
+
logs: {
|
|
2064
|
+
flushIntervalMs: Ae,
|
|
2065
|
+
batchSize: 100
|
|
2066
|
+
},
|
|
2067
|
+
metrics: {
|
|
2068
|
+
flushIntervalMs: Pe,
|
|
2069
|
+
batchSize: 500
|
|
2070
|
+
}
|
|
2071
|
+
}, ar = class {
|
|
2072
|
+
options;
|
|
2073
|
+
onFlush;
|
|
2096
2074
|
pending = [];
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
get options() {
|
|
2101
|
-
return this.config.streams[this.name];
|
|
2102
|
-
}
|
|
2103
|
-
get capacity() {
|
|
2104
|
-
return Math.max(this.options.batchSize, 1) * 10;
|
|
2075
|
+
timer = null;
|
|
2076
|
+
constructor(e, t) {
|
|
2077
|
+
this.options = e, this.onFlush = t;
|
|
2105
2078
|
}
|
|
2106
2079
|
add(e) {
|
|
2107
|
-
|
|
2080
|
+
if (this.pending.push(e), this.pending.length >= this.options.batchSize) {
|
|
2081
|
+
this.onFlush(this);
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
this.arm();
|
|
2108
2085
|
}
|
|
2109
2086
|
take() {
|
|
2087
|
+
this.clearTimer();
|
|
2110
2088
|
let e = this.pending;
|
|
2111
2089
|
return this.pending = [], e;
|
|
2112
2090
|
}
|
|
2113
|
-
|
|
2091
|
+
stop() {
|
|
2092
|
+
this.clearTimer();
|
|
2093
|
+
}
|
|
2094
|
+
arm() {
|
|
2095
|
+
if (this.timer !== null) return;
|
|
2096
|
+
let e = setTimeout(() => {
|
|
2097
|
+
this.timer = null, this.onFlush(this);
|
|
2098
|
+
}, this.options.flushIntervalMs);
|
|
2099
|
+
this.timer = e, C(e);
|
|
2100
|
+
}
|
|
2101
|
+
clearTimer() {
|
|
2102
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
2103
|
+
}
|
|
2104
|
+
}, or = class {
|
|
2114
2105
|
config;
|
|
2115
2106
|
transport;
|
|
2116
2107
|
storage;
|
|
2117
2108
|
retry;
|
|
2118
2109
|
diagnostics;
|
|
2119
|
-
records$ = new ft();
|
|
2120
2110
|
streams;
|
|
2121
|
-
subscription = null;
|
|
2122
2111
|
unconfirmed = /* @__PURE__ */ new Map();
|
|
2112
|
+
queue = [];
|
|
2113
|
+
inFlight = 0;
|
|
2114
|
+
pumpScheduled = !1;
|
|
2123
2115
|
stopped = !1;
|
|
2124
|
-
constructor(e, t, n, r, i) {
|
|
2125
|
-
this.config = e, this.transport = t, this.storage = n, this.retry = r, this.diagnostics = i
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
}
|
|
2116
|
+
constructor(e, t, n, r, i, a = ir) {
|
|
2117
|
+
this.config = e, this.transport = t, this.storage = n, this.retry = r, this.diagnostics = i;
|
|
2118
|
+
let o = (e) => {
|
|
2119
|
+
this.claim(e);
|
|
2120
|
+
};
|
|
2121
|
+
this.streams = {
|
|
2122
|
+
logs: new ar(a.logs, o),
|
|
2123
|
+
metrics: new ar(a.metrics, o)
|
|
2124
|
+
};
|
|
2129
2125
|
}
|
|
2130
2126
|
push(e) {
|
|
2131
|
-
this.stopped || (e.observedTimeUnixNano =
|
|
2127
|
+
this.stopped || (e.observedTimeUnixNano = O(), this.route(e));
|
|
2132
2128
|
}
|
|
2133
2129
|
drainPending() {
|
|
2134
2130
|
let e = [
|
|
@@ -2137,38 +2133,56 @@ var $n = class {
|
|
|
2137
2133
|
...this.streams.logs.take()
|
|
2138
2134
|
];
|
|
2139
2135
|
return this.unconfirmed.clear(), e.length === 0 ? null : {
|
|
2140
|
-
id:
|
|
2136
|
+
id: j(),
|
|
2141
2137
|
records: e,
|
|
2142
2138
|
createdAt: Date.now(),
|
|
2143
2139
|
attempts: 0
|
|
2144
2140
|
};
|
|
2145
2141
|
}
|
|
2146
|
-
refresh() {
|
|
2147
|
-
this.subscription?.unsubscribe(), this.subscribe();
|
|
2148
|
-
}
|
|
2149
2142
|
destroy() {
|
|
2150
|
-
this.stopped = !0, this.
|
|
2143
|
+
this.stopped = !0, this.streams.logs.stop(), this.streams.metrics.stop(), this.queue.length = 0;
|
|
2151
2144
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2145
|
+
route(e) {
|
|
2146
|
+
try {
|
|
2147
|
+
let t = rr(e) ? this.streams.metrics : this.streams.logs;
|
|
2148
|
+
if (!nr(e, this.config)) {
|
|
2149
|
+
this.diagnostics.count("record.dropped_by_sampling");
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2159
2152
|
t.add(e);
|
|
2160
|
-
}
|
|
2153
|
+
} catch (e) {
|
|
2154
|
+
this.diagnostics.report("pipeline.crashed", "a record was dropped on its way into a stream", void 0, e);
|
|
2155
|
+
}
|
|
2161
2156
|
}
|
|
2162
2157
|
claim(e) {
|
|
2163
|
-
let t = e.take()
|
|
2164
|
-
|
|
2165
|
-
let n = {
|
|
2166
|
-
id: M(),
|
|
2158
|
+
let t = e.take(), n = {
|
|
2159
|
+
id: j(),
|
|
2167
2160
|
records: t,
|
|
2168
2161
|
createdAt: Date.now(),
|
|
2169
2162
|
attempts: 0
|
|
2170
2163
|
};
|
|
2171
|
-
|
|
2164
|
+
this.unconfirmed.set(n.id, n), this.enqueue(n);
|
|
2165
|
+
}
|
|
2166
|
+
enqueue(e) {
|
|
2167
|
+
this.queue.push(e), !this.pumpScheduled && (this.pumpScheduled = !0, queueMicrotask(() => {
|
|
2168
|
+
this.pumpScheduled = !1, this.pump();
|
|
2169
|
+
}));
|
|
2170
|
+
}
|
|
2171
|
+
pump() {
|
|
2172
|
+
for (; this.inFlight < 2;) {
|
|
2173
|
+
let e = this.queue.shift();
|
|
2174
|
+
if (!e) return;
|
|
2175
|
+
this.inFlight++, this.run(e);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
async run(e) {
|
|
2179
|
+
try {
|
|
2180
|
+
await this.dispatch(e);
|
|
2181
|
+
} catch (t) {
|
|
2182
|
+
this.diagnostics.report("pipeline.crashed", "dispatch rejected, which it is written never to do", { batchId: e.id }, t);
|
|
2183
|
+
} finally {
|
|
2184
|
+
this.inFlight--, this.pump();
|
|
2185
|
+
}
|
|
2172
2186
|
}
|
|
2173
2187
|
async dispatch(e) {
|
|
2174
2188
|
try {
|
|
@@ -2207,7 +2221,7 @@ var $n = class {
|
|
|
2207
2221
|
function J(e) {
|
|
2208
2222
|
return e;
|
|
2209
2223
|
}
|
|
2210
|
-
var
|
|
2224
|
+
var sr = class {
|
|
2211
2225
|
deps;
|
|
2212
2226
|
resourceCache = null;
|
|
2213
2227
|
constructor(e) {
|
|
@@ -2218,94 +2232,94 @@ var tr = class {
|
|
|
2218
2232
|
}
|
|
2219
2233
|
isEnabled(e) {
|
|
2220
2234
|
let { config: t } = this.deps;
|
|
2221
|
-
return t.enabled ?
|
|
2235
|
+
return t.enabled ? b[e] >= b[t.minLevel] : !1;
|
|
2222
2236
|
}
|
|
2223
2237
|
build(e) {
|
|
2224
|
-
let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a } = this.deps;
|
|
2238
|
+
let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o } = this.deps;
|
|
2225
2239
|
if (!this.isEnabled(e.level)) return n.count("record.dropped_by_level"), null;
|
|
2226
|
-
let
|
|
2240
|
+
let s = r.resolve(), c = i.current(), l = a.next(), u = Dn(), d, f = 0;
|
|
2227
2241
|
try {
|
|
2228
2242
|
let t = L(this.deps.context.getAll(), o), n = L(e.scoped ?? {}, o), r = L(e.payload ?? {}, o);
|
|
2229
|
-
|
|
2243
|
+
f = t.bytes + n.bytes + r.bytes, d = {
|
|
2230
2244
|
...J(t.value),
|
|
2231
2245
|
...J(n.value),
|
|
2232
2246
|
...J(r.value)
|
|
2233
2247
|
};
|
|
2234
2248
|
} catch (e) {
|
|
2235
|
-
n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e),
|
|
2249
|
+
n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e), d = { [Fe]: !0 };
|
|
2236
2250
|
}
|
|
2237
|
-
|
|
2238
|
-
let
|
|
2239
|
-
|
|
2240
|
-
let
|
|
2241
|
-
timeUnixNano:
|
|
2242
|
-
traceId:
|
|
2243
|
-
spanId:
|
|
2244
|
-
traceFlags:
|
|
2245
|
-
severityNumber:
|
|
2251
|
+
d[v] = e.type, d[Ne] = l, d[y] = e.namespace, d[mt] = u, c && (d[Oe] = c.id, d[nt] = c.name, c.parentId !== void 0 && (d[ut] = c.parentId));
|
|
2252
|
+
let p = I(e.body, o.maxBodyChars);
|
|
2253
|
+
p !== e.body && n.count("record.truncated");
|
|
2254
|
+
let m = {
|
|
2255
|
+
timeUnixNano: O(),
|
|
2256
|
+
traceId: s.traceId,
|
|
2257
|
+
spanId: s.spanId,
|
|
2258
|
+
traceFlags: s.traceFlags,
|
|
2259
|
+
severityNumber: ye[e.level],
|
|
2246
2260
|
severityText: e.level,
|
|
2247
|
-
body:
|
|
2248
|
-
attributes:
|
|
2261
|
+
body: p,
|
|
2262
|
+
attributes: d,
|
|
2249
2263
|
resource: this.resource()
|
|
2250
|
-
},
|
|
2251
|
-
if (
|
|
2252
|
-
let e = n.guard("record.sanitize_failed", "redact hook threw", () =>
|
|
2264
|
+
}, h = t.redact;
|
|
2265
|
+
if (h) {
|
|
2266
|
+
let e = n.guard("record.sanitize_failed", "redact hook threw", () => h(m));
|
|
2253
2267
|
if (e === null) return n.count("record.dropped_by_redact"), null;
|
|
2254
|
-
if (e !== void 0 && e !==
|
|
2255
|
-
if (
|
|
2268
|
+
if (e !== void 0 && e !== m) {
|
|
2269
|
+
if (k(e)) {
|
|
2256
2270
|
let t = L(e.attributes, o);
|
|
2257
|
-
|
|
2271
|
+
m = {
|
|
2258
2272
|
...e,
|
|
2259
2273
|
attributes: J(t.value)
|
|
2260
|
-
},
|
|
2274
|
+
}, f = t.bytes;
|
|
2261
2275
|
} else n.report("record.sanitize_failed", "redact hook returned something that is not a record, keeping the original");
|
|
2262
2276
|
}
|
|
2263
2277
|
}
|
|
2264
|
-
if (
|
|
2278
|
+
if (f > o.maxRecordBytes) {
|
|
2265
2279
|
n.report("record.truncated", "attributes exceeded the size budget and were dropped", {
|
|
2266
|
-
bytes:
|
|
2267
|
-
body:
|
|
2280
|
+
bytes: f,
|
|
2281
|
+
body: m.body
|
|
2268
2282
|
});
|
|
2269
2283
|
let t = {
|
|
2270
|
-
[
|
|
2271
|
-
[
|
|
2272
|
-
[
|
|
2273
|
-
[
|
|
2274
|
-
[
|
|
2275
|
-
[
|
|
2284
|
+
[v]: e.type,
|
|
2285
|
+
[Ne]: l,
|
|
2286
|
+
[y]: e.namespace,
|
|
2287
|
+
[mt]: u,
|
|
2288
|
+
[We]: !0,
|
|
2289
|
+
[ct]: f
|
|
2276
2290
|
};
|
|
2277
|
-
|
|
2291
|
+
c && (t[Oe] = c.id, t[nt] = c.name), m.attributes = t;
|
|
2278
2292
|
}
|
|
2279
|
-
return
|
|
2293
|
+
return m;
|
|
2280
2294
|
}
|
|
2281
2295
|
resource() {
|
|
2282
2296
|
if (this.resourceCache) return this.resourceCache;
|
|
2283
|
-
let { config: e, identity:
|
|
2297
|
+
let { config: e, identity: n, platform: i } = this.deps;
|
|
2284
2298
|
return this.resourceCache = {
|
|
2285
|
-
[
|
|
2286
|
-
[
|
|
2287
|
-
[
|
|
2288
|
-
[
|
|
2289
|
-
[
|
|
2290
|
-
[
|
|
2291
|
-
[
|
|
2292
|
-
[
|
|
2293
|
-
[
|
|
2294
|
-
[
|
|
2295
|
-
[
|
|
2296
|
-
...
|
|
2297
|
-
...
|
|
2299
|
+
[c]: e.serviceName,
|
|
2300
|
+
[de]: e.serviceVersion,
|
|
2301
|
+
[o]: e.environment,
|
|
2302
|
+
[se]: Le,
|
|
2303
|
+
[le]: pt,
|
|
2304
|
+
[Je]: t,
|
|
2305
|
+
[_t]: i.platform,
|
|
2306
|
+
[Xe]: n.sessionId,
|
|
2307
|
+
[r]: n.tabId,
|
|
2308
|
+
[ge]: n.contextId,
|
|
2309
|
+
[yt]: i.userAgent,
|
|
2310
|
+
...i.openfinUuid === void 0 ? {} : { [u]: i.openfinUuid },
|
|
2311
|
+
...i.openfinName === void 0 ? {} : { [ve]: i.openfinName }
|
|
2298
2312
|
}, this.resourceCache;
|
|
2299
2313
|
}
|
|
2300
|
-
}, Y = Symbol.for(
|
|
2314
|
+
}, Y = Symbol.for(ae), X = class e {
|
|
2301
2315
|
diagnostics;
|
|
2302
2316
|
config;
|
|
2303
2317
|
platform;
|
|
2304
2318
|
identity;
|
|
2305
|
-
context = new
|
|
2319
|
+
context = new Gn();
|
|
2306
2320
|
breadcrumbs;
|
|
2307
2321
|
tracing;
|
|
2308
|
-
sequence = new
|
|
2322
|
+
sequence = new On();
|
|
2309
2323
|
journey;
|
|
2310
2324
|
builder;
|
|
2311
2325
|
console;
|
|
@@ -2323,10 +2337,11 @@ var tr = class {
|
|
|
2323
2337
|
destroyed = !1;
|
|
2324
2338
|
lastGapAt = 0;
|
|
2325
2339
|
constructor(e) {
|
|
2326
|
-
this.diagnostics = new
|
|
2340
|
+
this.diagnostics = new Kn(e.onDiagnostic), this.platform = wn(this.diagnostics), this.config = Un(e, this.diagnostics), this.identity = Zt(this.diagnostics), this.breadcrumbs = new Pn(50), this.tracing = new Nn(this.diagnostics), this.console = new Cn(this.config.console), this.journey = new $n(qn, this.diagnostics, this.identity.contextId, (e) => {
|
|
2327
2341
|
this.bus.broadcastJourney(e);
|
|
2328
|
-
}), this.builder = new
|
|
2342
|
+
}), this.builder = new sr({
|
|
2329
2343
|
config: this.config,
|
|
2344
|
+
limits: bt,
|
|
2330
2345
|
diagnostics: this.diagnostics,
|
|
2331
2346
|
context: this.context,
|
|
2332
2347
|
journey: this.journey,
|
|
@@ -2334,7 +2349,7 @@ var tr = class {
|
|
|
2334
2349
|
sequence: this.sequence,
|
|
2335
2350
|
identity: this.identity,
|
|
2336
2351
|
platform: this.platform
|
|
2337
|
-
}), this.bus = new
|
|
2352
|
+
}), this.bus = new Ht(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
2338
2353
|
onRecords: (e) => {
|
|
2339
2354
|
this.ingestForwarded(e);
|
|
2340
2355
|
},
|
|
@@ -2362,7 +2377,7 @@ var tr = class {
|
|
|
2362
2377
|
return globalThis[Y] = r, r.init(), r;
|
|
2363
2378
|
}
|
|
2364
2379
|
reconfigure(e) {
|
|
2365
|
-
|
|
2380
|
+
Wn(this.config, Un(e, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.ready && this.reinstallCaptures(), this.diagnostics.report("config.reconfigured", "configure() was called again, the existing runtime was updated");
|
|
2366
2381
|
}
|
|
2367
2382
|
async init() {
|
|
2368
2383
|
try {
|
|
@@ -2375,11 +2390,11 @@ var tr = class {
|
|
|
2375
2390
|
}
|
|
2376
2391
|
}
|
|
2377
2392
|
async becomeSender() {
|
|
2378
|
-
this.storage = await
|
|
2393
|
+
this.storage = await mn(this.config.storage, Se, m, this.diagnostics, this.reportGap), this.transport = new bn(this.config, this.diagnostics), this.retry = new xn(this.storage, this.transport, this.diagnostics, this.config), this.pipeline = new or(this.config, this.transport, this.storage, this.retry, this.diagnostics), this.exitFlush = new _n({
|
|
2379
2394
|
config: this.config,
|
|
2380
2395
|
diagnostics: this.diagnostics,
|
|
2381
2396
|
drainPending: () => this.pipeline?.drainPending() ?? null
|
|
2382
|
-
}), await
|
|
2397
|
+
}), await cn(this.storage, this.diagnostics), this.retry.start(), this.exitFlush.install();
|
|
2383
2398
|
}
|
|
2384
2399
|
installCaptures() {
|
|
2385
2400
|
let e = {
|
|
@@ -2387,9 +2402,9 @@ var tr = class {
|
|
|
2387
2402
|
diagnostics: this.diagnostics,
|
|
2388
2403
|
breadcrumbs: this.breadcrumbs,
|
|
2389
2404
|
tracing: this.tracing,
|
|
2390
|
-
logger: new
|
|
2405
|
+
logger: new S(this, a)
|
|
2391
2406
|
}, t = this.config.capture;
|
|
2392
|
-
(t.errors || t.rejections || t.resourceErrors) && this.captures.push(new
|
|
2407
|
+
(t.errors || t.rejections || t.resourceErrors) && this.captures.push(new Ut(e)), (t.fetch || t.xhr) && this.captures.push(new qt(e)), (t.interactions || t.navigation) && this.captures.push(new Gt(e)), t.webVitals && this.captures.push(new Yt(e));
|
|
2393
2408
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `installing ${e.name}`, () => {
|
|
2394
2409
|
e.install();
|
|
2395
2410
|
});
|
|
@@ -2414,8 +2429,8 @@ var tr = class {
|
|
|
2414
2429
|
}
|
|
2415
2430
|
emit(e) {
|
|
2416
2431
|
if (!(!e || this.destroyed)) {
|
|
2417
|
-
if (
|
|
2418
|
-
this.bootBuffer.length >=
|
|
2432
|
+
if ($t(this.identity.sessionId, this.diagnostics), !this.ready) {
|
|
2433
|
+
this.bootBuffer.length >= 500 && (this.bootBuffer.shift(), this.diagnostics.count("record.dropped_boot_buffer_full")), this.bootBuffer.push(e);
|
|
2419
2434
|
return;
|
|
2420
2435
|
}
|
|
2421
2436
|
this.route(e);
|
|
@@ -2441,7 +2456,7 @@ var tr = class {
|
|
|
2441
2456
|
return;
|
|
2442
2457
|
}
|
|
2443
2458
|
for (let t of e) {
|
|
2444
|
-
if (!
|
|
2459
|
+
if (!k(t)) {
|
|
2445
2460
|
this.diagnostics.count("record.dropped_malformed");
|
|
2446
2461
|
continue;
|
|
2447
2462
|
}
|
|
@@ -2456,19 +2471,19 @@ var tr = class {
|
|
|
2456
2471
|
}
|
|
2457
2472
|
reportGap = (e) => {
|
|
2458
2473
|
let t = Date.now();
|
|
2459
|
-
t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new
|
|
2474
|
+
t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new S(this, ie).warn("stored records were dropped before delivery", {
|
|
2460
2475
|
"gap.batches": e.batches,
|
|
2461
2476
|
"gap.records": e.records,
|
|
2462
2477
|
"gap.reason": e.reason
|
|
2463
2478
|
}));
|
|
2464
2479
|
};
|
|
2465
2480
|
regenerateTabId() {
|
|
2466
|
-
let e =
|
|
2481
|
+
let e = j();
|
|
2467
2482
|
this.diagnostics.report("bus.role_resolved", "another context claimed this tab id, most likely a duplicated tab. Regenerating.", {
|
|
2468
2483
|
was: this.identity.tabId,
|
|
2469
2484
|
now: e
|
|
2470
2485
|
}), this.identity.tabId = e, this.diagnostics.guard("storage.unavailable", "persisting the new tab id", () => {
|
|
2471
|
-
sessionStorage.setItem(
|
|
2486
|
+
sessionStorage.setItem(pe, e);
|
|
2472
2487
|
}), this.builder.invalidateResource();
|
|
2473
2488
|
}
|
|
2474
2489
|
async queueDepth() {
|
|
@@ -2499,93 +2514,93 @@ var tr = class {
|
|
|
2499
2514
|
function Q() {
|
|
2500
2515
|
return X.current() || X.configure({});
|
|
2501
2516
|
}
|
|
2502
|
-
function
|
|
2517
|
+
function cr(e) {
|
|
2503
2518
|
X.configure(e), Z.clear();
|
|
2504
2519
|
}
|
|
2505
|
-
function
|
|
2520
|
+
function lr(e, t) {
|
|
2506
2521
|
let n = t ? `${e}::${JSON.stringify(t)}` : e, r = Z.get(n);
|
|
2507
|
-
return r || (r = new
|
|
2522
|
+
return r || (r = new S(Q(), e, t), Z.set(n, r)), r;
|
|
2508
2523
|
}
|
|
2509
2524
|
function $() {
|
|
2510
|
-
return
|
|
2525
|
+
return lr("app");
|
|
2511
2526
|
}
|
|
2512
|
-
function
|
|
2527
|
+
function ur(e, t) {
|
|
2513
2528
|
$().trace(e, t);
|
|
2514
2529
|
}
|
|
2515
|
-
function
|
|
2530
|
+
function dr(e, t) {
|
|
2516
2531
|
$().debug(e, t);
|
|
2517
2532
|
}
|
|
2518
|
-
function
|
|
2533
|
+
function fr(e, t) {
|
|
2519
2534
|
$().info(e, t);
|
|
2520
2535
|
}
|
|
2521
|
-
function
|
|
2536
|
+
function pr(e, t) {
|
|
2522
2537
|
$().warn(e, t);
|
|
2523
2538
|
}
|
|
2524
|
-
function
|
|
2539
|
+
function mr(e, t, n) {
|
|
2525
2540
|
$().error(e, t, n);
|
|
2526
2541
|
}
|
|
2527
|
-
function
|
|
2542
|
+
function hr(e, t) {
|
|
2528
2543
|
$().logAction(e, t);
|
|
2529
2544
|
}
|
|
2530
|
-
function
|
|
2545
|
+
function gr(e, t) {
|
|
2531
2546
|
$().logEvent(e, t);
|
|
2532
2547
|
}
|
|
2533
|
-
function
|
|
2548
|
+
function _r(e, t, n, r, i) {
|
|
2534
2549
|
$().logMetric(e, t, n, r, i);
|
|
2535
2550
|
}
|
|
2536
|
-
function
|
|
2551
|
+
function vr(e, t, n) {
|
|
2537
2552
|
return $().timeSync(e, t, n);
|
|
2538
2553
|
}
|
|
2539
|
-
function
|
|
2554
|
+
function yr(e, t, n) {
|
|
2540
2555
|
return $().timeAsync(e, t, n);
|
|
2541
2556
|
}
|
|
2542
|
-
function
|
|
2557
|
+
function br(e, t) {
|
|
2543
2558
|
Q().context.set(e, t);
|
|
2544
2559
|
}
|
|
2545
|
-
function
|
|
2560
|
+
function xr(e) {
|
|
2546
2561
|
Q().context.setMany(e);
|
|
2547
2562
|
}
|
|
2548
|
-
function
|
|
2563
|
+
function Sr(e) {
|
|
2549
2564
|
Q().context.remove(e);
|
|
2550
2565
|
}
|
|
2551
|
-
function
|
|
2566
|
+
function Cr(e, t) {
|
|
2552
2567
|
return Q().journey.start(e, t);
|
|
2553
2568
|
}
|
|
2554
|
-
function
|
|
2569
|
+
function wr() {
|
|
2555
2570
|
Q().journey.end();
|
|
2556
2571
|
}
|
|
2557
|
-
function
|
|
2572
|
+
function Tr() {
|
|
2558
2573
|
return Q().journey.current();
|
|
2559
2574
|
}
|
|
2560
|
-
function
|
|
2575
|
+
function Er() {
|
|
2561
2576
|
return Q().journey.getToken();
|
|
2562
2577
|
}
|
|
2563
|
-
function
|
|
2578
|
+
function Dr(e) {
|
|
2564
2579
|
return Q().journey.adopt(e, "manual", !0);
|
|
2565
2580
|
}
|
|
2566
|
-
function
|
|
2581
|
+
function Or(e) {
|
|
2567
2582
|
Q().registerWorker(e);
|
|
2568
2583
|
}
|
|
2569
|
-
function
|
|
2584
|
+
function kr() {
|
|
2570
2585
|
Q().tracing.rotate("explicit");
|
|
2571
2586
|
}
|
|
2572
|
-
function
|
|
2587
|
+
function Ar() {
|
|
2573
2588
|
return Q().tracing.headers();
|
|
2574
2589
|
}
|
|
2575
|
-
function
|
|
2590
|
+
function jr() {
|
|
2576
2591
|
return Q().flush();
|
|
2577
2592
|
}
|
|
2578
|
-
function
|
|
2593
|
+
function Mr() {
|
|
2579
2594
|
return Q().queueDepth();
|
|
2580
2595
|
}
|
|
2581
|
-
function
|
|
2596
|
+
function Nr() {
|
|
2582
2597
|
return Q().diagnostics.snapshot();
|
|
2583
2598
|
}
|
|
2584
|
-
async function
|
|
2599
|
+
async function Pr() {
|
|
2585
2600
|
let e = X.current();
|
|
2586
2601
|
Z.clear(), await e?.destroy();
|
|
2587
2602
|
}
|
|
2588
2603
|
//#endregion
|
|
2589
|
-
export {
|
|
2604
|
+
export { S as OneLogger, Dr as adoptJourney, cr as configure, Tr as currentJourney, dr as debug, wr as endJourney, mr as error, jr as flush, Nr as getDiagnosticCounters, Er as getJourneyToken, lr as getLogger, Mr as getQueueDepth, Ar as getTraceHeaders, fr as info, hr as logAction, gr as logEvent, _r as logMetric, Or as registerWorker, Sr as removeContext, br as setContext, xr as setContextMap, Pr as shutdown, Cr as startJourney, kr as startTrace, yr as timeAsync, vr as timeSync, ur as trace, pr as warn };
|
|
2590
2605
|
|
|
2591
2606
|
//# sourceMappingURL=index.js.map
|