@utk09/ui-observability 0.5.0 → 0.6.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 +16 -0
- package/README.md +77 -60
- package/dist/bus/bus.d.ts +10 -10
- package/dist/bus/links.d.ts +1 -1
- package/dist/{bus-D3OO0OcL.js → bus-BTMuVkDk.js} +19 -19
- package/dist/bus-BTMuVkDk.js.map +1 -0
- package/dist/bus-ChIXDAWD.cjs +2 -0
- package/dist/bus-ChIXDAWD.cjs.map +1 -0
- package/dist/capture/network.d.ts +2 -2
- package/dist/capture/types.d.ts +10 -10
- package/dist/capture/web-vitals.d.ts +3 -3
- package/dist/{constants-B6kdsCzF.js → constants-0-YchbAL.js} +2 -2
- package/dist/constants-0-YchbAL.js.map +1 -0
- package/dist/{constants-DZH04585.cjs → constants-TUFcy95w.cjs} +2 -2
- package/dist/constants-TUFcy95w.cjs.map +1 -0
- package/dist/constants.d.ts +53 -40
- package/dist/core/breadcrumbs.d.ts +14 -14
- package/dist/core/config.d.ts +5 -4
- package/dist/core/context.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +10 -9
- package/dist/core/journey.d.ts +23 -20
- package/dist/core/logger.d.ts +7 -7
- package/dist/core/pipeline.d.ts +34 -29
- package/dist/core/record.d.ts +6 -6
- package/dist/core/runtime.d.ts +20 -18
- package/dist/core/sampling.d.ts +15 -16
- package/dist/core/sender.d.ts +1 -1
- package/dist/{errors-DPju_xSI.cjs → errors-DRXBRqvm.cjs} +2 -2
- package/dist/errors-DRXBRqvm.cjs.map +1 -0
- package/dist/{errors-Dme9tz-6.js → errors-Dwm2SzBa.js} +4 -4
- package/dist/errors-Dwm2SzBa.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +61 -61
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-B5dwq4hW.cjs +2 -0
- package/dist/indexeddb-storage-B5dwq4hW.cjs.map +1 -0
- package/dist/{indexeddb-storage-nxs_rxGx.js → indexeddb-storage-DjY4Ml6t.js} +16 -16
- package/dist/indexeddb-storage-DjY4Ml6t.js.map +1 -0
- package/dist/{interactions-DP0-rIPJ.cjs → interactions-DVom6eYn.cjs} +2 -2
- package/dist/interactions-DVom6eYn.cjs.map +1 -0
- package/dist/{interactions-C1romMpE.js → interactions-DZmLu7l2.js} +2 -2
- package/dist/interactions-DZmLu7l2.js.map +1 -0
- package/dist/models/batch.d.ts +12 -9
- package/dist/models/bus.d.ts +12 -13
- package/dist/models/config.d.ts +58 -41
- package/dist/models/log-record.d.ts +12 -10
- package/dist/models/serializer.d.ts +3 -2
- package/dist/models/storage.d.ts +2 -2
- package/dist/{network-au-Tqt1n.js → network-C4d2uw2Z.js} +4 -4
- package/dist/network-C4d2uw2Z.js.map +1 -0
- package/dist/network-CuqWadNn.cjs +2 -0
- package/dist/network-CuqWadNn.cjs.map +1 -0
- package/dist/platform-CXio0W2n.cjs +2 -0
- package/dist/platform-CXio0W2n.cjs.map +1 -0
- package/dist/{platform-DMYo3AX3.js → platform-CY8S3hUs.js} +8 -8
- package/dist/platform-CY8S3hUs.js.map +1 -0
- package/dist/sampling-CEthcmEX.cjs +2 -0
- package/dist/sampling-CEthcmEX.cjs.map +1 -0
- package/dist/{sampling-ByI5H44E.js → sampling-CJsI_24L.js} +21 -18
- package/dist/sampling-CJsI_24L.js.map +1 -0
- package/dist/sender-ByFAkXVd.cjs +3 -0
- package/dist/sender-ByFAkXVd.cjs.map +1 -0
- package/dist/{sender-R7lOpyNc.js → sender-dpvR_bHM.js} +60 -60
- package/dist/sender-dpvR_bHM.js.map +1 -0
- package/dist/storage/emergency-queue.d.ts +2 -2
- package/dist/storage/factory.d.ts +2 -1
- package/dist/storage/idb-driver.d.ts +19 -19
- package/dist/storage/indexeddb-storage.d.ts +18 -17
- package/dist/storage/keys.d.ts +1 -1
- package/dist/storage/local-storage.d.ts +19 -18
- package/dist/storage/memory-storage.d.ts +12 -11
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +8 -7
- package/dist/transport/exit-flush.d.ts +27 -24
- package/dist/transport/http-transport.d.ts +18 -11
- package/dist/transport/retry-engine.d.ts +33 -28
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +1 -1
- package/dist/unref-16maCyKA.js.map +1 -1
- package/dist/unref-CU9Nyz_9.cjs.map +1 -1
- package/dist/utils/identity.d.ts +6 -5
- package/dist/utils/lock.d.ts +4 -4
- package/dist/utils/platform.d.ts +5 -3
- package/dist/utils/sanitize.d.ts +5 -2
- package/dist/utils/sequence.d.ts +2 -2
- package/dist/utils/tracing.d.ts +8 -7
- package/dist/web-vitals-B2FYsEAU.cjs +2 -0
- package/dist/web-vitals-B2FYsEAU.cjs.map +1 -0
- package/dist/{web-vitals-DwWdLBq6.js → web-vitals-DHZ0yA_H.js} +4 -4
- package/dist/web-vitals-DHZ0yA_H.js.map +1 -0
- package/package.json +1 -1
- package/dist/bus-D3OO0OcL.js.map +0 -1
- package/dist/bus-OdRJVUzr.cjs +0 -2
- package/dist/bus-OdRJVUzr.cjs.map +0 -1
- package/dist/constants-B6kdsCzF.js.map +0 -1
- package/dist/constants-DZH04585.cjs.map +0 -1
- package/dist/errors-DPju_xSI.cjs.map +0 -1
- package/dist/errors-Dme9tz-6.js.map +0 -1
- package/dist/indexeddb-storage-lGdoHGHy.cjs +0 -2
- package/dist/indexeddb-storage-lGdoHGHy.cjs.map +0 -1
- package/dist/indexeddb-storage-nxs_rxGx.js.map +0 -1
- package/dist/interactions-C1romMpE.js.map +0 -1
- package/dist/interactions-DP0-rIPJ.cjs.map +0 -1
- package/dist/network-DDVIJSHd.cjs +0 -2
- package/dist/network-DDVIJSHd.cjs.map +0 -1
- package/dist/network-au-Tqt1n.js.map +0 -1
- package/dist/platform-DMYo3AX3.js.map +0 -1
- package/dist/platform-g99Kn755.cjs +0 -2
- package/dist/platform-g99Kn755.cjs.map +0 -1
- package/dist/sampling-ByI5H44E.js.map +0 -1
- package/dist/sampling-Dui-Fp3u.cjs +0 -2
- package/dist/sampling-Dui-Fp3u.cjs.map +0 -1
- package/dist/sender-R7lOpyNc.js.map +0 -1
- package/dist/sender-vLcbQhiB.cjs +0 -3
- package/dist/sender-vLcbQhiB.cjs.map +0 -1
- package/dist/web-vitals-DM2nvcMJ.cjs +0 -2
- package/dist/web-vitals-DM2nvcMJ.cjs.map +0 -1
- package/dist/web-vitals-DwWdLBq6.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare function timeSync<T>(label: string, fn: () => T, attributes?: Rec
|
|
|
91
91
|
*/
|
|
92
92
|
export declare function timeAsync<T>(label: string, fn: () => Promise<T>, attributes?: Record<string, unknown>): Promise<T>;
|
|
93
93
|
/**
|
|
94
|
-
* Sets a key-value pair on ambient context
|
|
94
|
+
* Sets a key-value pair on the ambient context. All later records include it.
|
|
95
95
|
* @param key Attribute key.
|
|
96
96
|
* @param value Attribute value.
|
|
97
97
|
*/
|
|
@@ -130,7 +130,7 @@ export declare function getJourneyToken(): string | undefined;
|
|
|
130
130
|
/**
|
|
131
131
|
* Adopts a serialized journey token into this application realm.
|
|
132
132
|
* @param token Serialized journey token.
|
|
133
|
-
* @returns True if token
|
|
133
|
+
* @returns True if the token is valid and the runtime adopts it.
|
|
134
134
|
*/
|
|
135
135
|
export declare function adoptJourney(token: string): boolean;
|
|
136
136
|
/**
|
|
@@ -147,12 +147,13 @@ export declare function startTrace(): void;
|
|
|
147
147
|
export declare function getTraceHeaders(): Record<string, string>;
|
|
148
148
|
/**
|
|
149
149
|
* Flushes all pending log batches across pipeline streams.
|
|
150
|
-
* @returns Promise
|
|
150
|
+
* @returns Promise that resolves after the pipeline processes the queued batches.
|
|
151
151
|
*/
|
|
152
152
|
export declare function flush(): Promise<void>;
|
|
153
153
|
/**
|
|
154
154
|
* Counts the batches waiting in storage for delivery.
|
|
155
|
-
* @returns Promise resolving to the number of stored batches. A forwarder reports 0
|
|
155
|
+
* @returns Promise resolving to the number of stored batches. A forwarder reports 0.
|
|
156
|
+
* A forwarder does not store batches.
|
|
156
157
|
*/
|
|
157
158
|
export declare function getQueueDepth(): Promise<number>;
|
|
158
159
|
/**
|
|
@@ -161,7 +162,7 @@ export declare function getQueueDepth(): Promise<number>;
|
|
|
161
162
|
*/
|
|
162
163
|
export declare function getDiagnosticCounters(): Record<string, number>;
|
|
163
164
|
/**
|
|
164
|
-
* Flushes pending records and
|
|
165
|
+
* Flushes pending records and stops all runtime subsystems.
|
|
165
166
|
* @returns Promise resolving once shutdown completes.
|
|
166
167
|
*/
|
|
167
168
|
export declare function shutdown(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { At as e, C as t, Ct as n, D as r, Dt as i, E as a, Et as o, F as s, Gt as c, M as l, Mt as u, N as d, Nt as f, Ot as p, Pt as m, Rt as h, St as g, T as _, Tt as ee, Vt as v, Yt as te, _ as ne, a as y, an as re, at as ie, bt as b, c as x, cn as ae, d as oe, g as se, h as ce, ht as le, i as ue, in as de, it as S, j as C, jt as fe, kt as pe, l as w, ln as me, m as he, mt as ge, n as T, nn as _e, nt as E, o as D, on as ve, p as ye, r as be, rn as xe, rt as Se, s as Ce, tt as we, u as O, un as k, wt as Te, zt as Ee } from "./constants-
|
|
2
|
-
import { _ as De, a as A, c as j, d as Oe, g as M, h as ke, i as Ae, l as je, m as N, n as Me, o as Ne, p as Pe, r as Fe, s as Ie, u as P } from "./sampling-
|
|
3
|
-
import { n as Le, r as Re, t as ze } from "./platform-
|
|
1
|
+
import { At as e, C as t, Ct as n, D as r, Dt as i, E as a, Et as o, F as s, Gt as c, M as l, Mt as u, N as d, Nt as f, Ot as p, Pt as m, Rt as h, St as g, T as _, Tt as ee, Vt as v, Yt as te, _ as ne, a as y, an as re, at as ie, bt as b, c as x, cn as ae, d as oe, g as se, h as ce, ht as le, i as ue, in as de, it as S, j as C, jt as fe, kt as pe, l as w, ln as me, m as he, mt as ge, n as T, nn as _e, nt as E, o as D, on as ve, p as ye, r as be, rn as xe, rt as Se, s as Ce, tt as we, u as O, un as k, wt as Te, zt as Ee } from "./constants-0-YchbAL.js";
|
|
2
|
+
import { _ as De, a as A, c as j, d as Oe, g as M, h as ke, i as Ae, l as je, m as N, n as Me, o as Ne, p as Pe, r as Fe, s as Ie, u as P } from "./sampling-CJsI_24L.js";
|
|
3
|
+
import { n as Le, r as Re, t as ze } from "./platform-CY8S3hUs.js";
|
|
4
4
|
import { t as Be } from "./unref-16maCyKA.js";
|
|
5
5
|
//#region src/utils/timer.ts
|
|
6
6
|
function F(e) {
|
|
@@ -41,7 +41,7 @@ async function He(e, t, n, r) {
|
|
|
41
41
|
//#region src/core/logger.ts
|
|
42
42
|
function Ue(e, t) {
|
|
43
43
|
if (e instanceof Error) return e;
|
|
44
|
-
let n = t.guard("record.sanitize_failed", "
|
|
44
|
+
let n = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
|
|
45
45
|
return Error(n ?? typeof e);
|
|
46
46
|
}
|
|
47
47
|
function We(e) {
|
|
@@ -174,9 +174,9 @@ var R = class e {
|
|
|
174
174
|
write(e, t, n, i, a) {
|
|
175
175
|
if (!this.accepts(t) || typeof console > "u") return;
|
|
176
176
|
let o = `%c[%s]%c ${t}`, s = Ge[t];
|
|
177
|
-
this.diagnostics.guard("handler.threw", `
|
|
177
|
+
this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
|
|
178
178
|
let t = [];
|
|
179
|
-
a !== void 0 && t.push(a), i !== void 0 && t.push(Pe(i, b)), console[s](o, r, e, "", n, ...t);
|
|
179
|
+
a !== void 0 && t.push(a), i !== void 0 && t.push(Pe(i, b, this.diagnostics)), console[s](o, r, e, "", n, ...t);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}, qe = class {
|
|
@@ -225,7 +225,7 @@ var $e = class {
|
|
|
225
225
|
if (this.load) try {
|
|
226
226
|
this.otel = await this.load();
|
|
227
227
|
} catch (e) {
|
|
228
|
-
this.diagnostics.report("trace.otel_failed", "@opentelemetry/api
|
|
228
|
+
this.diagnostics.report("trace.otel_failed", "The library could not load @opentelemetry/api. Records use the trace ids of the library.", void 0, e);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
resolve() {
|
|
@@ -234,7 +234,7 @@ var $e = class {
|
|
|
234
234
|
}
|
|
235
235
|
activeSpanContext() {
|
|
236
236
|
let e = this.otel;
|
|
237
|
-
if (e) return this.diagnostics.guard("trace.otel_failed", "
|
|
237
|
+
if (e) return this.diagnostics.guard("trace.otel_failed", "The library could not read the active OpenTelemetry span.", () => {
|
|
238
238
|
let t = e.trace.getActiveSpan();
|
|
239
239
|
if (t === void 0) return;
|
|
240
240
|
let n = t.spanContext();
|
|
@@ -250,7 +250,7 @@ var $e = class {
|
|
|
250
250
|
}
|
|
251
251
|
headers() {
|
|
252
252
|
let e = {}, t = this.otel;
|
|
253
|
-
if (t && this.diagnostics.guard("trace.otel_failed", "
|
|
253
|
+
if (t && this.diagnostics.guard("trace.otel_failed", "The library could not add the OpenTelemetry headers.", () => {
|
|
254
254
|
t.propagation.inject(t.context.active(), e);
|
|
255
255
|
}), !e.traceparent) {
|
|
256
256
|
let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
|
|
@@ -282,7 +282,7 @@ function tt(e) {
|
|
|
282
282
|
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
283
283
|
}
|
|
284
284
|
function nt(e, t, n) {
|
|
285
|
-
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || tt(e) ? e : (n.report("config.invalid", `serializer must be "${v}", "ecs" or an implementation
|
|
285
|
+
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || tt(e) ? e : (n.report("config.invalid", `serializer must be "${v}", "ecs" or an implementation. The library uses "${v}".`), v);
|
|
286
286
|
}
|
|
287
287
|
function rt(e, t) {
|
|
288
288
|
return e === void 0 ? t : e === !1 ? null : e === !0 ? a : e;
|
|
@@ -311,27 +311,27 @@ function H(e, t, n) {
|
|
|
311
311
|
...e.capture
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
|
-
if (i.endpoint === "") t.report("config.invalid", "endpoint is missing. The library
|
|
314
|
+
if (i.endpoint === "") t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
|
|
315
315
|
else if (i.endpoint !== null) try {
|
|
316
316
|
new URL(i.endpoint);
|
|
317
317
|
} catch (e) {
|
|
318
|
-
t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}
|
|
318
|
+
t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}.`, void 0, e);
|
|
319
319
|
}
|
|
320
|
-
i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record
|
|
320
|
+
i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${k}'.`), k);
|
|
321
321
|
let a = i.sampling.defaultRate;
|
|
322
|
-
(typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1
|
|
322
|
+
(typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(a)}. The library uses 1.`), i.sampling.defaultRate = 1);
|
|
323
323
|
let o = Object.entries(i.sampling.rates);
|
|
324
|
-
for (let [e, n] of o) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1
|
|
324
|
+
for (let [e, n] of o) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), i.sampling.rates[e] = 1);
|
|
325
325
|
return i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]), it(e, t), i;
|
|
326
326
|
}
|
|
327
327
|
function it(e, t) {
|
|
328
328
|
let n = /* @__PURE__ */ new Set([...Object.keys(C), ...ae]);
|
|
329
|
-
for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `unknown config key "${r}"
|
|
329
|
+
for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `The library ignores the unknown config key "${r}". Check the spelling.`);
|
|
330
330
|
for (let n of _) {
|
|
331
331
|
let r = e[n];
|
|
332
332
|
if (typeof r != "object" || !r) continue;
|
|
333
333
|
let i = /* @__PURE__ */ new Set([...Object.keys(C[n]), ...me[n]]);
|
|
334
|
-
for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `unknown config key "${n}.${e}"
|
|
334
|
+
for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `The library ignores the unknown config key "${n}.${e}". Check the spelling.`);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
function at(e, t) {
|
|
@@ -390,7 +390,7 @@ var ot = class {
|
|
|
390
390
|
if (this.handler) try {
|
|
391
391
|
this.handler(o);
|
|
392
392
|
} catch (e) {
|
|
393
|
-
this.count("handler.threw"), typeof console < "u" && console.warn(`${ie} onDiagnostic handler threw
|
|
393
|
+
this.count("handler.threw"), typeof console < "u" && console.warn(`${ie} The onDiagnostic handler threw an error.`, e);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
guard(e, t, n) {
|
|
@@ -476,14 +476,14 @@ var ft = class {
|
|
|
476
476
|
async bootstrap() {
|
|
477
477
|
let e = this.readUrlToken();
|
|
478
478
|
if (e && this.adopt(e, "url")) return;
|
|
479
|
-
let t = this.diagnostics.guard("storage.unavailable", "
|
|
479
|
+
let t = this.diagnostics.guard("storage.unavailable", "The library could not read the persisted journey.", () => this.stores.session().getItem(E));
|
|
480
480
|
if (t && this.restore(t)) return;
|
|
481
481
|
let n = await this.readOpenFinToken();
|
|
482
482
|
n !== null && this.adopt(n, "openfin.customData");
|
|
483
483
|
}
|
|
484
484
|
start(e, t = {}) {
|
|
485
485
|
let n = {
|
|
486
|
-
id: t.id ?? j(),
|
|
486
|
+
id: t.id ?? j(this.diagnostics),
|
|
487
487
|
name: e,
|
|
488
488
|
startedAt: Date.now(),
|
|
489
489
|
parentId: t.parent ? this.journey?.id : void 0,
|
|
@@ -502,15 +502,15 @@ var ft = class {
|
|
|
502
502
|
let e = this.journey;
|
|
503
503
|
if (e === null) return;
|
|
504
504
|
let t = dt(e);
|
|
505
|
-
if (t.length > 256) this.diagnostics.report("journey.token_too_large", "journey token
|
|
505
|
+
if (t.length > 256) this.diagnostics.report("journey.token_too_large", "The journey token is larger than the size limit. The library does not issue it.", { length: t.length });
|
|
506
506
|
else return t;
|
|
507
507
|
}
|
|
508
508
|
adopt(e, t, n = !1) {
|
|
509
509
|
let r = this.decodeToken(e);
|
|
510
|
-
return r === null ? !1 : Date.now() - r.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "discarded a seeded journey older than maxAgeMs", {
|
|
510
|
+
return r === null ? !1 : Date.now() - r.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "The library discarded a seeded journey older than maxAgeMs.", {
|
|
511
511
|
source: t,
|
|
512
512
|
name: r.name
|
|
513
|
-
}), !1) : (this.setJourney(r), this.diagnostics.report("journey.adopted", `adopted journey "${r.name}"
|
|
513
|
+
}), !1) : (this.setJourney(r), this.diagnostics.report("journey.adopted", `The library adopted the journey "${r.name}".`, {
|
|
514
514
|
source: t,
|
|
515
515
|
journeyId: r.id
|
|
516
516
|
}), n && this.onLocalChange(r), !0);
|
|
@@ -522,29 +522,29 @@ var ft = class {
|
|
|
522
522
|
this.clearTimer();
|
|
523
523
|
}
|
|
524
524
|
restore(e) {
|
|
525
|
-
let t = lt(this.diagnostics.guard("storage.degraded", "
|
|
526
|
-
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}"
|
|
525
|
+
let t = lt(this.diagnostics.guard("storage.degraded", "The library could not parse the persisted journey.", () => JSON.parse(e)));
|
|
526
|
+
return t === null ? !1 : Date.now() - t.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "The library discarded a persisted journey older than maxAgeMs.", { name: t.name }), this.clearStored(), !1) : (this.setJourney(t), this.diagnostics.report("journey.adopted", `The library resumed the journey "${t.name}".`, {
|
|
527
527
|
source: "sessionStorage",
|
|
528
528
|
journeyId: t.id
|
|
529
529
|
}), !0);
|
|
530
530
|
}
|
|
531
531
|
decodeToken(e) {
|
|
532
|
-
return this.diagnostics.guard("config.invalid", "
|
|
532
|
+
return this.diagnostics.guard("config.invalid", "The library could not decode a seeded journey token.", () => {
|
|
533
533
|
let t = e.replace(ye, "+").replace(he, "/"), n = (4 - t.length % 4) % 4, r = "=".repeat(n), i = Uint8Array.from(atob(t + r), (e) => e.charCodeAt(0));
|
|
534
534
|
return ut(JSON.parse(new TextDecoder().decode(i)));
|
|
535
535
|
}) ?? null;
|
|
536
536
|
}
|
|
537
537
|
setJourney(e) {
|
|
538
|
-
if (this.journey = e, this.clearTimer(), this.diagnostics.guard("storage.unavailable", "
|
|
538
|
+
if (this.journey = e, this.clearTimer(), this.diagnostics.guard("storage.unavailable", "The library could not save the journey.", () => {
|
|
539
539
|
e === null ? this.stores.session().removeItem(E) : this.stores.session().setItem(E, JSON.stringify(e));
|
|
540
540
|
}), e === null) return;
|
|
541
541
|
let t = Math.max(this.options.maxAgeMs - (Date.now() - e.startedAt), 0), n = setTimeout(() => {
|
|
542
|
-
this.diagnostics.report("journey.expired", `journey "${e.name}"
|
|
542
|
+
this.diagnostics.report("journey.expired", `The journey "${e.name}" reached maxAgeMs. The library ended it.`, { journeyId: e.id }), this.journey = null, this.expiryTimer = null, this.clearStored();
|
|
543
543
|
}, t);
|
|
544
544
|
this.expiryTimer = n, Be(n);
|
|
545
545
|
}
|
|
546
546
|
clearStored() {
|
|
547
|
-
this.diagnostics.guard("storage.unavailable", "
|
|
547
|
+
this.diagnostics.guard("storage.unavailable", "The library could not clear the persisted journey.", () => {
|
|
548
548
|
this.stores.session().removeItem(E);
|
|
549
549
|
});
|
|
550
550
|
}
|
|
@@ -552,12 +552,12 @@ var ft = class {
|
|
|
552
552
|
this.expiryTimer !== null && (clearTimeout(this.expiryTimer), this.expiryTimer = null);
|
|
553
553
|
}
|
|
554
554
|
readUrlToken() {
|
|
555
|
-
return this.diagnostics.guard("config.invalid", "
|
|
555
|
+
return this.diagnostics.guard("config.invalid", "The library could not read the journey token from the URL.", () => typeof location > "u" ? null : new URL(location.href).searchParams.get(this.options.urlParam)) ?? null;
|
|
556
556
|
}
|
|
557
557
|
async readOpenFinToken() {
|
|
558
558
|
let e = globalThis.fin?.me, t = e?.getOptions;
|
|
559
559
|
if (t === void 0) return null;
|
|
560
|
-
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "
|
|
560
|
+
let n = (await this.diagnostics.guardAsync("openfin.unavailable", "The library could not read fin.me.getOptions().", () => Ae(t.call(e), le)))?.customData?.[ge];
|
|
561
561
|
return typeof n == "string" ? n : null;
|
|
562
562
|
}
|
|
563
563
|
};
|
|
@@ -596,16 +596,16 @@ var pt = class {
|
|
|
596
596
|
record: null,
|
|
597
597
|
dropped: "sampling"
|
|
598
598
|
};
|
|
599
|
-
let u = a.next(), d = ze(), f = t.capture.fullUrls ? d : Re(d), p, m = 0;
|
|
599
|
+
let u = a.next(), d = ze(n), f = t.capture.fullUrls ? d : Re(d), p, m = 0;
|
|
600
600
|
try {
|
|
601
|
-
let t = N(this.deps.context.getAll(), o
|
|
602
|
-
m = t.bytes +
|
|
601
|
+
let t = N(this.deps.context.getAll(), o, n), r = N(e.scoped ?? {}, o, n), i = N(e.payload ?? {}, o, n);
|
|
602
|
+
m = t.bytes + r.bytes + i.bytes, p = {
|
|
603
603
|
...G(t.value),
|
|
604
|
-
...G(
|
|
605
|
-
...G(
|
|
604
|
+
...G(r.value),
|
|
605
|
+
...G(i.value)
|
|
606
606
|
};
|
|
607
607
|
} catch (e) {
|
|
608
|
-
n.report("record.sanitize_failed", "
|
|
608
|
+
n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [oe]: !0 };
|
|
609
609
|
}
|
|
610
610
|
p[w] = e.type, p[x] = u, p[T] = e.namespace, p[O] = f, l && (p[y] = l.id, p[D] = l.name, l.parentId !== void 0 && (p[Ce] = l.parentId));
|
|
611
611
|
let h = ke(e.body, o.maxBodyChars);
|
|
@@ -622,23 +622,23 @@ var pt = class {
|
|
|
622
622
|
resource: this.resource()
|
|
623
623
|
}, _ = t.redact;
|
|
624
624
|
if (_) {
|
|
625
|
-
let e = n.guard("record.sanitize_failed", "redact hook threw", () => _(g));
|
|
625
|
+
let e = n.guard("record.sanitize_failed", "The redact hook threw an error.", () => _(g));
|
|
626
626
|
if (e === null) return n.count("record.dropped_by_redact"), {
|
|
627
627
|
record: null,
|
|
628
628
|
dropped: "redact"
|
|
629
629
|
};
|
|
630
630
|
if (e !== void 0 && e !== g) {
|
|
631
631
|
if (M(e)) {
|
|
632
|
-
let t = N(e.attributes, o);
|
|
632
|
+
let t = N(e.attributes, o, n);
|
|
633
633
|
g = {
|
|
634
634
|
...e,
|
|
635
635
|
attributes: G(t.value)
|
|
636
636
|
}, m = t.bytes;
|
|
637
|
-
} else n.report("record.sanitize_failed", "redact hook returned
|
|
637
|
+
} else n.report("record.sanitize_failed", "The redact hook returned a value that is not a record. The library keeps the original record.");
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
if (m > o.maxRecordBytes) {
|
|
641
|
-
n.report("record.truncated", "attributes
|
|
641
|
+
n.report("record.truncated", "The attributes are larger than the size limit. The library dropped them.", {
|
|
642
642
|
bytes: m,
|
|
643
643
|
body: g.body
|
|
644
644
|
});
|
|
@@ -674,10 +674,10 @@ var pt = class {
|
|
|
674
674
|
}, this.resourceCache;
|
|
675
675
|
}
|
|
676
676
|
}, mt = {
|
|
677
|
-
errors: async () => (await import("./errors-
|
|
678
|
-
network: async () => (await import("./network-
|
|
679
|
-
interactions: async () => (await import("./interactions-
|
|
680
|
-
webVitals: async () => (await import("./web-vitals-
|
|
677
|
+
errors: async () => (await import("./errors-Dwm2SzBa.js")).ErrorCapture,
|
|
678
|
+
network: async () => (await import("./network-C4d2uw2Z.js")).NetworkCapture,
|
|
679
|
+
interactions: async () => (await import("./interactions-DZmLu7l2.js")).InteractionCapture,
|
|
680
|
+
webVitals: async () => (await import("./web-vitals-DHZ0yA_H.js")).WebVitalsCapture
|
|
681
681
|
}, K = Symbol.for(h), q = Symbol.for(Ee), J = class e {
|
|
682
682
|
diagnostics;
|
|
683
683
|
config;
|
|
@@ -730,7 +730,7 @@ var pt = class {
|
|
|
730
730
|
}
|
|
731
731
|
busAccept = (e, t) => {
|
|
732
732
|
this.destroyed || this.ensureBus().then((n) => {
|
|
733
|
-
n && !this.destroyed && this.diagnostics.guard("bus.send_failed", "
|
|
733
|
+
n && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
|
|
734
734
|
n.acceptDirect(e, t);
|
|
735
735
|
});
|
|
736
736
|
});
|
|
@@ -752,14 +752,14 @@ var pt = class {
|
|
|
752
752
|
}
|
|
753
753
|
reconfigure(e) {
|
|
754
754
|
let t = this.keepEndpoint(e);
|
|
755
|
-
at(this.config, H(t, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "configure()
|
|
755
|
+
at(this.config, H(t, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
|
|
756
756
|
}
|
|
757
757
|
keepBuiltStorage() {
|
|
758
758
|
let e = this.storageBuiltAs;
|
|
759
|
-
e !== void 0 && this.config.storage !== e && (this.diagnostics.report("config.invalid", `storage cannot change after startup
|
|
759
|
+
e !== void 0 && this.config.storage !== e && (this.diagnostics.report("config.invalid", `storage cannot change after startup. It stays ${e}.`, { requested: this.config.storage }), this.config.storage = e);
|
|
760
760
|
}
|
|
761
761
|
keepEndpoint(e) {
|
|
762
|
-
return this.senderLoad === void 0 || e.endpoint !== null && e.endpoint !== "" ? e : (this.diagnostics.report("config.invalid", "
|
|
762
|
+
return this.senderLoad === void 0 || e.endpoint !== null && e.endpoint !== "" ? e : (this.diagnostics.report("config.invalid", "You cannot remove the endpoint after the delivery stack loads. The endpoint in force stays."), {
|
|
763
763
|
...e,
|
|
764
764
|
endpoint: void 0
|
|
765
765
|
});
|
|
@@ -774,7 +774,7 @@ var pt = class {
|
|
|
774
774
|
let e = this.journey.bootstrap();
|
|
775
775
|
this.config.bus.mode !== "off" && await this.ensureBus(), this.roleResolved = !0, await this.syncSender(), await e;
|
|
776
776
|
} catch (e) {
|
|
777
|
-
this.diagnostics.report("pipeline.crashed", "
|
|
777
|
+
this.diagnostics.report("pipeline.crashed", "Startup failed. The runtime continues with reduced function.", void 0, e);
|
|
778
778
|
} finally {
|
|
779
779
|
this.ready = !0, this.releaseBootBuffer();
|
|
780
780
|
}
|
|
@@ -792,12 +792,12 @@ var pt = class {
|
|
|
792
792
|
try {
|
|
793
793
|
return await e.start(), e;
|
|
794
794
|
} catch (e) {
|
|
795
|
-
return this.diagnostics.report("pipeline.crashed", "
|
|
795
|
+
return this.diagnostics.report("pipeline.crashed", "The bus did not start. This context sends its own records.", void 0, e), null;
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
async buildBus() {
|
|
799
799
|
try {
|
|
800
|
-
let { Bus: e } = await import("./bus-
|
|
800
|
+
let { Bus: e } = await import("./bus-BTMuVkDk.js");
|
|
801
801
|
if (this.destroyed) return null;
|
|
802
802
|
let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
803
803
|
onRecords: (e) => {
|
|
@@ -813,7 +813,7 @@ var pt = class {
|
|
|
813
813
|
});
|
|
814
814
|
return this.bus = t, t;
|
|
815
815
|
} catch (e) {
|
|
816
|
-
return this.diagnostics.report("pipeline.crashed", "
|
|
816
|
+
return this.diagnostics.report("pipeline.crashed", "The bus did not load. This context sends its own records.", void 0, e), null;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
role() {
|
|
@@ -828,7 +828,7 @@ var pt = class {
|
|
|
828
828
|
async buildSender() {
|
|
829
829
|
this.storageBuiltAs = this.config.storage;
|
|
830
830
|
try {
|
|
831
|
-
let { Sender: e } = await import("./sender-
|
|
831
|
+
let { Sender: e } = await import("./sender-dpvR_bHM.js"), t = this.destroyed ? null : await e.create({
|
|
832
832
|
config: this.config,
|
|
833
833
|
diagnostics: this.diagnostics,
|
|
834
834
|
onGap: this.reportGap
|
|
@@ -839,7 +839,7 @@ var pt = class {
|
|
|
839
839
|
}
|
|
840
840
|
this.sender = t;
|
|
841
841
|
} catch (e) {
|
|
842
|
-
this.senderLoad = void 0, this.diagnostics.report("pipeline.crashed", "
|
|
842
|
+
this.senderLoad = void 0, this.diagnostics.report("pipeline.crashed", "The delivery stack did not load. The library does not send records.", { held: this.pendingRecords.length }, e);
|
|
843
843
|
}
|
|
844
844
|
let e = this.pendingRecords;
|
|
845
845
|
this.pendingRecords = [];
|
|
@@ -860,22 +860,22 @@ var pt = class {
|
|
|
860
860
|
once: this.captureOnce
|
|
861
861
|
};
|
|
862
862
|
for (let e of i) e && this.captures.push(new e(a));
|
|
863
|
-
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `
|
|
863
|
+
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
|
|
864
864
|
e.install();
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
867
|
uninstallCaptures() {
|
|
868
|
-
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `
|
|
868
|
+
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not uninstall the ${e.name} capture.`, () => {
|
|
869
869
|
e.uninstall();
|
|
870
870
|
});
|
|
871
871
|
this.captures.length = 0;
|
|
872
872
|
}
|
|
873
873
|
loadCapture(e) {
|
|
874
|
-
return this.diagnostics.guardAsync("capture.install_failed", `
|
|
874
|
+
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, mt[e]);
|
|
875
875
|
}
|
|
876
876
|
registerWorker(e) {
|
|
877
877
|
this.destroyed || this.constructBus().then((t) => {
|
|
878
|
-
t && !this.destroyed && (this.diagnostics.guard("bus.send_failed", "
|
|
878
|
+
t && !this.destroyed && (this.diagnostics.guard("bus.send_failed", "The library could not register the worker.", () => {
|
|
879
879
|
t.attachWorker(e);
|
|
880
880
|
}), this.ensureBus());
|
|
881
881
|
});
|
|
@@ -924,8 +924,8 @@ var pt = class {
|
|
|
924
924
|
}));
|
|
925
925
|
};
|
|
926
926
|
regenerateTabId() {
|
|
927
|
-
let e = j();
|
|
928
|
-
this.diagnostics.report("bus.role_resolved", "
|
|
927
|
+
let e = j(this.diagnostics);
|
|
928
|
+
this.diagnostics.report("bus.role_resolved", "Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.", {
|
|
929
929
|
was: this.identity.tabId,
|
|
930
930
|
now: e
|
|
931
931
|
}), this.identity.tabId = e, je(e, this.diagnostics, this.stores), this.builder.invalidateResource();
|