@utk09/ui-observability 0.9.5 → 0.11.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 +52 -0
- package/README.md +315 -99
- package/bin/uiobs.mjs +8 -0
- package/dist/{batch-BQFtb3i5.cjs → batch-C8OcWR2L.cjs} +2 -2
- package/dist/{batch-BQFtb3i5.cjs.map → batch-C8OcWR2L.cjs.map} +1 -1
- package/dist/{batch-BUJh-1jZ.js → batch-CL9uWYY3.js} +5 -6
- package/dist/{batch-BUJh-1jZ.js.map → batch-CL9uWYY3.js.map} +1 -1
- package/dist/bus/bus.d.ts +15 -0
- package/dist/{bus-DeOPHWaD.js → bus-BZ0GldpT.js} +125 -112
- package/dist/bus-BZ0GldpT.js.map +1 -0
- package/dist/bus-VWlmM5xs.cjs +2 -0
- package/dist/bus-VWlmM5xs.cjs.map +1 -0
- package/dist/capture/interactions.d.ts +18 -0
- package/dist/capture/lifecycle.d.ts +20 -0
- package/dist/capture/reports.d.ts +17 -0
- package/dist/capture/resource-timing.d.ts +14 -0
- package/dist/capture/server-timing.d.ts +19 -0
- package/dist/capture/types.d.ts +13 -0
- package/dist/capture/unclean-exit.d.ts +31 -0
- package/dist/capture/user-timing.d.ts +22 -0
- package/dist/console-BPZCuSLc.cjs +2 -0
- package/dist/console-BPZCuSLc.cjs.map +1 -0
- package/dist/{console-DbAZYJuy.js → console-BeCF7n59.js} +20 -20
- package/dist/{console-DbAZYJuy.js.map → console-BeCF7n59.js.map} +1 -1
- package/dist/constants-DqKJH_MP.cjs +2 -0
- package/dist/constants-DqKJH_MP.cjs.map +1 -0
- package/dist/constants-zyrqveN4.js +304 -0
- package/dist/constants-zyrqveN4.js.map +1 -0
- package/dist/constants.d.ts +58 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
- package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
- package/dist/{context-storage-DxZf4Gfh.js.map → context-storage-BzkoHzkQ.js.map} +1 -1
- package/dist/core/debug-buffer.d.ts +34 -0
- package/dist/core/debug-bundle.d.ts +12 -0
- package/dist/core/deferred.d.ts +7 -0
- package/dist/core/logger.d.ts +7 -2
- package/dist/core/measure.d.ts +19 -0
- package/dist/core/pipeline.d.ts +6 -1
- package/dist/core/record.d.ts +20 -1
- package/dist/core/remote-sampling.d.ts +5 -1
- package/dist/core/runtime.d.ts +45 -2
- package/dist/core/sampling.d.ts +5 -4
- package/dist/core/sender.d.ts +3 -1
- package/dist/core/spans.d.ts +5 -0
- package/dist/{deadline-5_PecIl5.js → deadline-BOjOxNHj.js} +3 -5
- package/dist/{deadline-5_PecIl5.js.map → deadline-BOjOxNHj.js.map} +1 -1
- package/dist/deadline-XSnm95pg.cjs.map +1 -1
- package/dist/debug-bundle-BzJNpbF0.cjs +2 -0
- package/dist/debug-bundle-BzJNpbF0.cjs.map +1 -0
- package/dist/debug-bundle-C7UkHZ-q.js +25 -0
- package/dist/debug-bundle-C7UkHZ-q.js.map +1 -0
- package/dist/doctor.cjs +2 -0
- package/dist/doctor.cjs.map +1 -0
- package/dist/doctor.d.ts +23 -0
- package/dist/doctor.js +98 -0
- package/dist/doctor.js.map +1 -0
- package/dist/{emergency-queue-Cs1hrjsC.cjs → emergency-queue-CNTRui5t.cjs} +2 -2
- package/dist/{emergency-queue-Cs1hrjsC.cjs.map → emergency-queue-CNTRui5t.cjs.map} +1 -1
- package/dist/{emergency-queue-BYUyDHGD.js → emergency-queue-Zy6lNafo.js} +17 -19
- package/dist/{emergency-queue-BYUyDHGD.js.map → emergency-queue-Zy6lNafo.js.map} +1 -1
- package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
- package/dist/{error-like-Ywo5uRHo.js.map → error-like-B11pB4aL.js.map} +1 -1
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/{errors-BhC7HTSt.js → errors-Dh7kef0i.js} +5 -6
- package/dist/{errors-BhC7HTSt.js.map → errors-Dh7kef0i.js.map} +1 -1
- package/dist/{errors-CgY633cG.cjs → errors-tfEr48bS.cjs} +2 -2
- package/dist/{errors-CgY633cG.cjs.map → errors-tfEr48bS.cjs.map} +1 -1
- package/dist/{factory-C5TujXlU.js → factory-BonqI3NL.js} +16 -20
- package/dist/{factory-C5TujXlU.js.map → factory-BonqI3NL.js.map} +1 -1
- package/dist/{factory-CNj4DH3n.cjs → factory-CJXVYp0R.cjs} +2 -2
- package/dist/{factory-CNj4DH3n.cjs.map → factory-CJXVYp0R.cjs.map} +1 -1
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
- package/dist/{fixed-window-CtaFHanJ.js.map → fixed-window-Dq3MLUUv.js.map} +1 -1
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
- package/dist/{global-scope-dp2jADRl.js.map → global-scope-D9I8s-oN.js.map} +1 -1
- package/dist/guards-Cidk71ME.js +7 -0
- package/dist/guards-Cidk71ME.js.map +1 -0
- package/dist/guards-nJ70syPt.cjs +2 -0
- package/dist/guards-nJ70syPt.cjs.map +1 -0
- package/dist/{identity-Da9TkuKd.cjs → identity-Cxgj6pZX.cjs} +2 -2
- package/dist/{identity-Da9TkuKd.cjs.map → identity-Cxgj6pZX.cjs.map} +1 -1
- package/dist/{identity-8vKkyAWm.js → identity-DT5VmvXy.js} +15 -16
- package/dist/{identity-8vKkyAWm.js.map → identity-DT5VmvXy.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -7
- package/dist/index.js +980 -604
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-CCA1LvtO.js → indexeddb-storage-BJVtiQKm.js} +29 -30
- package/dist/{indexeddb-storage-CCA1LvtO.js.map → indexeddb-storage-BJVtiQKm.js.map} +1 -1
- package/dist/{indexeddb-storage-BTfIFRHF.cjs → indexeddb-storage-CIoW21Xd.cjs} +2 -2
- package/dist/{indexeddb-storage-BTfIFRHF.cjs.map → indexeddb-storage-CIoW21Xd.cjs.map} +1 -1
- package/dist/interactions-DTgKy_6K.js +119 -0
- package/dist/interactions-DTgKy_6K.js.map +1 -0
- package/dist/interactions-fEN6FbVo.cjs +2 -0
- package/dist/interactions-fEN6FbVo.cjs.map +1 -0
- package/dist/{journey-BUJ4WJxP.js → journey-CuJrHzEg.js} +18 -19
- package/dist/{journey-BUJ4WJxP.js.map → journey-CuJrHzEg.js.map} +1 -1
- package/dist/{journey-B_tTnvac.cjs → journey-pffMVMfa.cjs} +2 -2
- package/dist/{journey-B_tTnvac.cjs.map → journey-pffMVMfa.cjs.map} +1 -1
- package/dist/keys-BHhw_0Wh.cjs.map +1 -1
- package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
- package/dist/{keys-D5r_GH9q.js.map → keys-BU9j5YqW.js.map} +1 -1
- package/dist/library-console-C1m6g1BR.js +13 -0
- package/dist/library-console-C1m6g1BR.js.map +1 -0
- package/dist/library-console-D2GY9Or6.cjs +2 -0
- package/dist/library-console-D2GY9Or6.cjs.map +1 -0
- package/dist/{library-request-BaZOi4eg.cjs → library-request-1BX_UlaX.cjs} +2 -2
- package/dist/{library-request-BaZOi4eg.cjs.map → library-request-1BX_UlaX.cjs.map} +1 -1
- package/dist/library-request-BQBT9N9Q.js +24 -0
- package/dist/{library-request-BKOcaKtQ.js.map → library-request-BQBT9N9Q.js.map} +1 -1
- package/dist/lifecycle-2EtUaRpo.cjs +2 -0
- package/dist/lifecycle-2EtUaRpo.cjs.map +1 -0
- package/dist/lifecycle-BaKx_-32.js +55 -0
- package/dist/lifecycle-BaKx_-32.js.map +1 -0
- package/dist/log-record-CAoGBBf3.js +16 -0
- package/dist/log-record-CAoGBBf3.js.map +1 -0
- package/dist/log-record-i9zOTkpQ.cjs +2 -0
- package/dist/log-record-i9zOTkpQ.cjs.map +1 -0
- package/dist/{long-frames-CF3qiSAX.cjs → long-frames-BVg4i5SC.cjs} +2 -2
- package/dist/{long-frames-CF3qiSAX.cjs.map → long-frames-BVg4i5SC.cjs.map} +1 -1
- package/dist/{long-frames-DI5ypfAF.js → long-frames-Czk7IupC.js} +4 -5
- package/dist/{long-frames-DI5ypfAF.js.map → long-frames-Czk7IupC.js.map} +1 -1
- package/dist/models/config.d.ts +168 -4
- package/dist/models/health.d.ts +25 -0
- package/dist/models/metric.d.ts +13 -0
- package/dist/models/storage.d.ts +5 -0
- package/dist/{network-DdzXDI3J.js → network-DBNwApoF.js} +117 -70
- package/dist/network-DBNwApoF.js.map +1 -0
- package/dist/network-xbbuvG_6.cjs +2 -0
- package/dist/network-xbbuvG_6.cjs.map +1 -0
- package/dist/openfin-Bxelt0yg.js +7 -0
- package/dist/{openfin-BwEN0uj4.js.map → openfin-Bxelt0yg.js.map} +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-BDvFrLnc.cjs +2 -0
- package/dist/otlp-BDvFrLnc.cjs.map +1 -0
- package/dist/otlp-BTJdIa6F.js +81 -0
- package/dist/otlp-BTJdIa6F.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
- package/dist/{patch-CCWfuEY7.js.map → patch-UdPz1ea8.js.map} +1 -1
- package/dist/{platform-DBSKTvFn.cjs → platform-C2Ez5kDc.cjs} +2 -2
- package/dist/{platform-DBSKTvFn.cjs.map → platform-C2Ez5kDc.cjs.map} +1 -1
- package/dist/{platform-Bw1btWCT.js → platform-DkcuXwe-.js} +5 -6
- package/dist/{platform-Bw1btWCT.js.map → platform-DkcuXwe-.js.map} +1 -1
- package/dist/remote-rules-Cfb4K-Nl.js +98 -0
- package/dist/remote-rules-Cfb4K-Nl.js.map +1 -0
- package/dist/remote-rules-vzvk7aKf.cjs +2 -0
- package/dist/remote-rules-vzvk7aKf.cjs.map +1 -0
- package/dist/reports-Dk2YhKIh.cjs +2 -0
- package/dist/reports-Dk2YhKIh.cjs.map +1 -0
- package/dist/reports-TA-zInnq.js +70 -0
- package/dist/reports-TA-zInnq.js.map +1 -0
- package/dist/resource-timing-BLv3EA2A.js +76 -0
- package/dist/resource-timing-BLv3EA2A.js.map +1 -0
- package/dist/resource-timing-Cysw1S1f.cjs +2 -0
- package/dist/resource-timing-Cysw1S1f.cjs.map +1 -0
- package/dist/sampling-C4VV-1MS.js +60 -0
- package/dist/sampling-C4VV-1MS.js.map +1 -0
- package/dist/sampling-Ckh2yW9k.cjs +2 -0
- package/dist/sampling-Ckh2yW9k.cjs.map +1 -0
- package/dist/sanitize-6ymPlVvP.js +112 -0
- package/dist/sanitize-6ymPlVvP.js.map +1 -0
- package/dist/sanitize-BAWzkZt0.cjs +2 -0
- package/dist/sanitize-BAWzkZt0.cjs.map +1 -0
- package/dist/select-ZF4by-lF.cjs +3 -0
- package/dist/select-ZF4by-lF.cjs.map +1 -0
- package/dist/select-xtQaenIi.js +270 -0
- package/dist/select-xtQaenIi.js.map +1 -0
- package/dist/{sender-DUUmSglb.js → sender-CiMHC9YG.js} +202 -509
- package/dist/sender-CiMHC9YG.js.map +1 -0
- package/dist/sender-D5wBoXA8.cjs +2 -0
- package/dist/sender-D5wBoXA8.cjs.map +1 -0
- package/dist/storage/persistence.d.ts +8 -0
- package/dist/storage-BA9RqRO-.cjs.map +1 -1
- package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
- package/dist/storage-DZwed89z.js.map +1 -0
- package/dist/storm-CYi9Swpx.cjs +2 -0
- package/dist/{storm-CNZjsw4T.cjs.map → storm-CYi9Swpx.cjs.map} +1 -1
- package/dist/{storm-Daq2jGHU.js → storm-VR024_QN.js} +4 -5
- package/dist/{storm-Daq2jGHU.js.map → storm-VR024_QN.js.map} +1 -1
- package/dist/transport/headers.d.ts +8 -0
- package/dist/transport/http-transport.d.ts +2 -6
- package/dist/transport/serializers/otlp.d.ts +14 -0
- package/dist/transport/status-transport.d.ts +5 -2
- package/dist/transport/worker-client.d.ts +14 -0
- package/dist/transport/worker-entry.d.ts +5 -0
- package/dist/transport/worker-protocol.d.ts +36 -0
- package/dist/transport/worker-server.d.ts +3 -0
- package/dist/transport/worker-transport.d.ts +9 -0
- package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
- package/dist/types-BAerHgCq.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/unclean-exit-CwcUhFOn.js +62 -0
- package/dist/unclean-exit-CwcUhFOn.js.map +1 -0
- package/dist/unclean-exit-DFUN57wY.cjs +2 -0
- package/dist/unclean-exit-DFUN57wY.cjs.map +1 -0
- package/dist/user-timing-C9kfRq3J.cjs +2 -0
- package/dist/user-timing-C9kfRq3J.cjs.map +1 -0
- package/dist/user-timing-_jZIhDKI.js +63 -0
- package/dist/user-timing-_jZIhDKI.js.map +1 -0
- package/dist/{web-socket-BacvKOvD.cjs → web-socket-BWUoqBh8.cjs} +2 -2
- package/dist/{web-socket-BacvKOvD.cjs.map → web-socket-BWUoqBh8.cjs.map} +1 -1
- package/dist/{web-socket-CpsD8WAa.js → web-socket-CV7yIMnm.js} +7 -8
- package/dist/{web-socket-CpsD8WAa.js.map → web-socket-CV7yIMnm.js.map} +1 -1
- package/dist/{web-vitals-Bflr5jSA.js → web-vitals-Bq4WFHQo.js} +2 -3
- package/dist/{web-vitals-Bflr5jSA.js.map → web-vitals-Bq4WFHQo.js.map} +1 -1
- package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -1
- package/dist/worker-protocol-Bai7GAIA.cjs +2 -0
- package/dist/worker-protocol-Bai7GAIA.cjs.map +1 -0
- package/dist/worker-protocol-CrsdSDLn.js +49 -0
- package/dist/worker-protocol-CrsdSDLn.js.map +1 -0
- package/dist/worker-server-BrIYkfoa.cjs +2 -0
- package/dist/worker-server-BrIYkfoa.cjs.map +1 -0
- package/dist/worker-server-Dp5HYm4b.js +83 -0
- package/dist/worker-server-Dp5HYm4b.js.map +1 -0
- package/dist/worker-transport-Bwej4N2e.cjs +2 -0
- package/dist/worker-transport-Bwej4N2e.cjs.map +1 -0
- package/dist/worker-transport-D6jtgpqN.js +199 -0
- package/dist/worker-transport-D6jtgpqN.js.map +1 -0
- package/package.json +31 -41
- package/dist/bus-BW6N-pY8.cjs +0 -2
- package/dist/bus-BW6N-pY8.cjs.map +0 -1
- package/dist/bus-DeOPHWaD.js.map +0 -1
- package/dist/console-Ce6heqZZ.cjs +0 -2
- package/dist/console-Ce6heqZZ.cjs.map +0 -1
- package/dist/constants-CN7GE1Lt.js +0 -246
- package/dist/constants-CN7GE1Lt.js.map +0 -1
- package/dist/constants-CW-MlHdY.cjs +0 -2
- package/dist/constants-CW-MlHdY.cjs.map +0 -1
- package/dist/interactions-BUDLxbv1.js +0 -74
- package/dist/interactions-BUDLxbv1.js.map +0 -1
- package/dist/interactions-NHbLKrqe.cjs +0 -2
- package/dist/interactions-NHbLKrqe.cjs.map +0 -1
- package/dist/library-request-BKOcaKtQ.js +0 -25
- package/dist/network-CF8UO5PK.cjs +0 -2
- package/dist/network-CF8UO5PK.cjs.map +0 -1
- package/dist/network-DdzXDI3J.js.map +0 -1
- package/dist/openfin-BwEN0uj4.js +0 -8
- package/dist/remote-rules-DIcC5vVC.js +0 -91
- package/dist/remote-rules-DIcC5vVC.js.map +0 -1
- package/dist/remote-rules-DpFmOef2.cjs +0 -2
- package/dist/remote-rules-DpFmOef2.cjs.map +0 -1
- package/dist/sampling-BVjspJWu.cjs +0 -2
- package/dist/sampling-BVjspJWu.cjs.map +0 -1
- package/dist/sampling-Cm3WhI0a.js +0 -76
- package/dist/sampling-Cm3WhI0a.js.map +0 -1
- package/dist/sanitize-C-ahCFsG.js +0 -123
- package/dist/sanitize-C-ahCFsG.js.map +0 -1
- package/dist/sanitize-DHucKGdi.cjs +0 -2
- package/dist/sanitize-DHucKGdi.cjs.map +0 -1
- package/dist/sender-D3fRCR8d.cjs +0 -3
- package/dist/sender-D3fRCR8d.cjs.map +0 -1
- package/dist/sender-DUUmSglb.js.map +0 -1
- package/dist/storage-w7Tslvlq.js.map +0 -1
- package/dist/storm-CNZjsw4T.cjs +0 -2
- package/dist/types-BR9t_w28.js.map +0 -1
|
@@ -1,364 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
function Ce(e) {
|
|
26
|
-
if (!e) return;
|
|
27
|
-
let t = Number(e);
|
|
28
|
-
if (Number.isFinite(t)) return Math.max(0, t * h);
|
|
29
|
-
let n = Date.parse(e);
|
|
30
|
-
return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/transport/serializers/ecs.ts
|
|
34
|
-
var N = {
|
|
35
|
-
"error.type": "type",
|
|
36
|
-
"error.message": "message",
|
|
37
|
-
"error.stack_trace": "stack_trace"
|
|
38
|
-
}, we = /* @__PURE__ */ new Set([x, ...Object.keys(N)]);
|
|
39
|
-
function Te(e) {
|
|
40
|
-
return r.test(e) ? Number(BigInt(e) / f) : Date.now();
|
|
41
|
-
}
|
|
42
|
-
function Ee(e) {
|
|
43
|
-
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : typeof e == "bigint" ? e.toString() : null;
|
|
44
|
-
}
|
|
45
|
-
function De(e, t, n) {
|
|
46
|
-
let r = e[t];
|
|
47
|
-
r === void 0 ? e[t] = n : Array.isArray(r) ? r.push(n) : e[t] = [r, n];
|
|
48
|
-
}
|
|
49
|
-
function P(e, t, n, r) {
|
|
50
|
-
let i = Ee(n);
|
|
51
|
-
if (i !== null) De(e, t, i);
|
|
52
|
-
else if (typeof n == "object" && n && !r.has(n)) {
|
|
53
|
-
if (r.add(n), Array.isArray(n)) for (let i of n) P(e, t, i, r);
|
|
54
|
-
else for (let [i, a] of Object.entries(n)) P(e, `${t}.${i}`, a, r);
|
|
55
|
-
r.delete(n);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function F(e) {
|
|
59
|
-
let t = Object.create(null), n = /* @__PURE__ */ new WeakSet();
|
|
60
|
-
for (let [r, i] of Object.entries(e)) P(t, r, i, n);
|
|
61
|
-
return t;
|
|
62
|
-
}
|
|
63
|
-
function Oe(e) {
|
|
64
|
-
let t = [];
|
|
65
|
-
for (let [n, r] of Object.entries(N)) {
|
|
66
|
-
let i = e[n];
|
|
67
|
-
typeof i == "string" && t.push([r, i]);
|
|
68
|
-
}
|
|
69
|
-
return t.length > 0 ? Object.fromEntries(t) : void 0;
|
|
70
|
-
}
|
|
71
|
-
function ke(e) {
|
|
72
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => !(we.has(e) && typeof t == "string")));
|
|
73
|
-
}
|
|
74
|
-
var Ae = {
|
|
75
|
-
name: "ecs",
|
|
76
|
-
serialize(e) {
|
|
77
|
-
return {
|
|
78
|
-
body: `${e.map((e) => {
|
|
79
|
-
let t = Te(e.timeUnixNano), { attributes: n } = e, r = n[x];
|
|
80
|
-
return JSON.stringify({
|
|
81
|
-
"@timestamp": new Date(t).toISOString(),
|
|
82
|
-
message: e.body,
|
|
83
|
-
ecs: { version: ee },
|
|
84
|
-
log: {
|
|
85
|
-
level: o[e.severityText] ?? e.severityText.toLowerCase(),
|
|
86
|
-
logger: typeof r == "string" ? r : void 0
|
|
87
|
-
},
|
|
88
|
-
event: { kind: n["log.type"] === "metric" ? "metric" : "event" },
|
|
89
|
-
error: Oe(n),
|
|
90
|
-
trace: { id: e.traceId },
|
|
91
|
-
span: { id: e.spanId },
|
|
92
|
-
service: {
|
|
93
|
-
name: e.resource[a],
|
|
94
|
-
version: e.resource[l],
|
|
95
|
-
environment: e.resource[te]
|
|
96
|
-
},
|
|
97
|
-
user_agent: { original: e.resource[ae] },
|
|
98
|
-
url: { full: n["url.full"] ?? n["page.url"] },
|
|
99
|
-
labels: {
|
|
100
|
-
...F(e.resource),
|
|
101
|
-
...F(ke(n))
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}).join("\n")}\n`,
|
|
105
|
-
contentType: i
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/transport/serializers/otlp.ts
|
|
111
|
-
function I(e) {
|
|
112
|
-
return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isSafeInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(I).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: L(e) } } : null;
|
|
113
|
-
}
|
|
114
|
-
function L(e) {
|
|
115
|
-
let t = [];
|
|
116
|
-
for (let [n, r] of Object.entries(e)) {
|
|
117
|
-
let e = I(r);
|
|
118
|
-
e && t.push({
|
|
119
|
-
key: n,
|
|
120
|
-
value: e
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return t;
|
|
124
|
-
}
|
|
125
|
-
var R = /* @__PURE__ */ new WeakMap();
|
|
126
|
-
function je(e) {
|
|
127
|
-
let t = R.get(e);
|
|
128
|
-
if (t !== void 0) return t;
|
|
129
|
-
let n = JSON.stringify(e);
|
|
130
|
-
return R.set(e, n), n;
|
|
1
|
+
import { B as e, Cn as t, Ht as n, Ut as r, Y as i, ct as a, dt as o, ft as s, g as c, l, lt as u, ot as d, st as f, tt as p, ut as m } from "./constants-zyrqveN4.js";
|
|
2
|
+
import { storageLimits as h } from "./storage-DZwed89z.js";
|
|
3
|
+
import { clearEmergencyContext as g, drainEmergencyQueue as _, n as v, saveToEmergencyQueue as y, t as b } from "./emergency-queue-Zy6lNafo.js";
|
|
4
|
+
import { createStorage as ee, storageName as te } from "./factory-BonqI3NL.js";
|
|
5
|
+
import { ContextStorage as x } from "./context-storage-BzkoHzkQ.js";
|
|
6
|
+
import { n as S, r as C, t as w } from "./deadline-BOjOxNHj.js";
|
|
7
|
+
import { i as T, r as E } from "./library-request-BQBT9N9Q.js";
|
|
8
|
+
import { t as D } from "./openfin-Bxelt0yg.js";
|
|
9
|
+
import { t as O } from "./sanitize-6ymPlVvP.js";
|
|
10
|
+
import { n as k } from "./library-console-C1m6g1BR.js";
|
|
11
|
+
import { c as A, n as j, r as M, s as N, t as P } from "./select-xtQaenIi.js";
|
|
12
|
+
import { r as F } from "./platform-DkcuXwe-.js";
|
|
13
|
+
import { a as ne } from "./otlp-BTJdIa6F.js";
|
|
14
|
+
import { a as re } from "./batch-CL9uWYY3.js";
|
|
15
|
+
import { r as ie } from "./log-record-CAoGBBf3.js";
|
|
16
|
+
import { i as ae } from "./identity-DT5VmvXy.js";
|
|
17
|
+
import { t as oe } from "./sampling-C4VV-1MS.js";
|
|
18
|
+
import { n as I, t as L } from "./remote-rules-Cfb4K-Nl.js";
|
|
19
|
+
// src/storage/persistence.ts
|
|
20
|
+
async function R(e) {
|
|
21
|
+
let t = globalThis.navigator?.storage;
|
|
22
|
+
return typeof t?.persist == "function" ? await e.guardAsync("storage.unavailable", "The browser rejected the request for persistent storage.", () => t.persist()) === !0 ? "granted" : "denied" : "unsupported";
|
|
131
23
|
}
|
|
24
|
+
// src/transport/status-transport.ts
|
|
132
25
|
function z(e) {
|
|
133
|
-
let t =
|
|
134
|
-
|
|
135
|
-
let e = je(n.resource), r = t.get(e);
|
|
136
|
-
r ? r.records.push(n) : t.set(e, {
|
|
137
|
-
resource: n.resource,
|
|
138
|
-
records: [n]
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return [...t.values()];
|
|
142
|
-
}
|
|
143
|
-
var Me = {
|
|
144
|
-
name: S,
|
|
145
|
-
serialize(e) {
|
|
146
|
-
let t = z(e).map((e) => ({
|
|
147
|
-
resource: { attributes: L(e.resource) },
|
|
148
|
-
scopeLogs: [{
|
|
149
|
-
scope: {
|
|
150
|
-
name: g,
|
|
151
|
-
version: C
|
|
152
|
-
},
|
|
153
|
-
logRecords: e.records.map((e) => ({
|
|
154
|
-
timeUnixNano: e.timeUnixNano,
|
|
155
|
-
observedTimeUnixNano: e.observedTimeUnixNano ?? e.timeUnixNano,
|
|
156
|
-
severityNumber: e.severityNumber,
|
|
157
|
-
severityText: e.severityText,
|
|
158
|
-
body: { stringValue: e.body },
|
|
159
|
-
traceId: e.traceId,
|
|
160
|
-
spanId: e.spanId,
|
|
161
|
-
flags: e.traceFlags,
|
|
162
|
-
attributes: L(e.attributes)
|
|
163
|
-
}))
|
|
164
|
-
}]
|
|
165
|
-
}));
|
|
166
|
-
return {
|
|
167
|
-
body: JSON.stringify({ resourceLogs: t }),
|
|
168
|
-
contentType: p
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}, Ne = 1;
|
|
172
|
-
function B(e, t) {
|
|
173
|
-
let n = e.attributes[t];
|
|
174
|
-
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
175
|
-
}
|
|
176
|
-
function V(e) {
|
|
177
|
-
return Array.isArray(e) && e.every((e) => typeof e == "number" && Number.isFinite(e));
|
|
178
|
-
}
|
|
179
|
-
function H(e) {
|
|
180
|
-
let t = e.attributes[n.attributeKeys], r = {};
|
|
181
|
-
if (!Array.isArray(t)) return r;
|
|
182
|
-
for (let n of t) {
|
|
183
|
-
let t = typeof n == "string" && !n.startsWith("metric.") ? e.attributes[n] : void 0;
|
|
184
|
-
(typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (r[n] = t);
|
|
185
|
-
}
|
|
186
|
-
return r;
|
|
26
|
+
let t = typeof e == "string" ? Date.parse(e) : NaN;
|
|
27
|
+
return Number.isNaN(t) ? void 0 : Math.round(t + 500 - Date.now());
|
|
187
28
|
}
|
|
188
|
-
|
|
189
|
-
let t = B(e, n.count);
|
|
190
|
-
if (t === void 0) {
|
|
191
|
-
let t = B(e, "metric.value");
|
|
192
|
-
return t === void 0 ? null : {
|
|
193
|
-
count: "1",
|
|
194
|
-
sum: t < 0 ? void 0 : t,
|
|
195
|
-
min: t,
|
|
196
|
-
max: t,
|
|
197
|
-
bucketCounts: ["1"],
|
|
198
|
-
explicitBounds: []
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
let r = e.attributes[n.bounds], i = e.attributes[n.buckets];
|
|
202
|
-
if (!V(r) || !V(i) || i.length !== r.length + 1) return null;
|
|
203
|
-
let a = B(e, n.min);
|
|
204
|
-
return {
|
|
205
|
-
count: String(t),
|
|
206
|
-
sum: a !== void 0 && a < 0 ? void 0 : B(e, n.sum),
|
|
207
|
-
min: a,
|
|
208
|
-
max: B(e, n.max),
|
|
209
|
-
bucketCounts: i.map(String),
|
|
210
|
-
explicitBounds: r
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function Fe(e) {
|
|
214
|
-
let t = B(e, "metric.value");
|
|
215
|
-
return t === void 0 ? null : { asDouble: t };
|
|
216
|
-
}
|
|
217
|
-
function Ie(e, t) {
|
|
218
|
-
let r = e.attributes[n.start], i = t === "histogram" ? Pe(e) : Fe(e);
|
|
219
|
-
return i === null ? null : {
|
|
220
|
-
attributes: L(H(e)),
|
|
221
|
-
startTimeUnixNano: typeof r == "string" ? r : e.timeUnixNano,
|
|
222
|
-
timeUnixNano: e.timeUnixNano,
|
|
223
|
-
...i
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function Le({ name: e, unit: t, field: n, points: r }) {
|
|
227
|
-
if (n === "gauge") return {
|
|
228
|
-
name: e,
|
|
229
|
-
unit: t,
|
|
230
|
-
gauge: { dataPoints: r }
|
|
231
|
-
};
|
|
232
|
-
let i = {
|
|
233
|
-
aggregationTemporality: Ne,
|
|
234
|
-
dataPoints: r
|
|
235
|
-
};
|
|
236
|
-
return n === "sum" && (i.isMonotonic = r.every((e) => e.asDouble >= 0)), {
|
|
237
|
-
name: e,
|
|
238
|
-
unit: t,
|
|
239
|
-
[n]: i
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
var Re = {
|
|
243
|
-
name: S,
|
|
244
|
-
serialize(e) {
|
|
245
|
-
let t = z(e).map((e) => {
|
|
246
|
-
let t = /* @__PURE__ */ new Map();
|
|
247
|
-
for (let n of e.records) {
|
|
248
|
-
let e = n.attributes["metric.type"], r = e === "counter" ? "sum" : e === "histogram" ? "histogram" : "gauge", i = Ie(n, r);
|
|
249
|
-
if (i === null) continue;
|
|
250
|
-
let a = n.attributes["metric.name"], o = n.attributes["metric.unit"], s = {
|
|
251
|
-
name: typeof a == "string" ? a : n.body,
|
|
252
|
-
unit: typeof o == "string" ? o : "",
|
|
253
|
-
field: r,
|
|
254
|
-
points: []
|
|
255
|
-
}, c = JSON.stringify([
|
|
256
|
-
s.field,
|
|
257
|
-
s.name,
|
|
258
|
-
s.unit
|
|
259
|
-
]), l = t.get(c) ?? s;
|
|
260
|
-
l.points.push(i), t.set(c, l);
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
resource: { attributes: L(e.resource) },
|
|
264
|
-
scopeMetrics: [{
|
|
265
|
-
scope: {
|
|
266
|
-
name: g,
|
|
267
|
-
version: C
|
|
268
|
-
},
|
|
269
|
-
metrics: [...t.values()].map(Le)
|
|
270
|
-
}]
|
|
271
|
-
};
|
|
272
|
-
});
|
|
273
|
-
return {
|
|
274
|
-
body: JSON.stringify({ resourceMetrics: t }),
|
|
275
|
-
contentType: p
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
}, U = {
|
|
279
|
-
internal: 1,
|
|
280
|
-
client: 3
|
|
281
|
-
}, ze = 2, Be = 0, Ve = /* @__PURE__ */ new Set([y, ...Object.values(b)]);
|
|
282
|
-
function W(e, t) {
|
|
283
|
-
let n = e.attributes[t];
|
|
284
|
-
return typeof n == "string" ? n : void 0;
|
|
285
|
-
}
|
|
286
|
-
function He(e) {
|
|
287
|
-
let t = Object.fromEntries(Object.entries(e.attributes).filter(([e]) => !Ve.has(e))), n = W(e, b.parentId);
|
|
288
|
-
return {
|
|
289
|
-
traceId: e.traceId,
|
|
290
|
-
spanId: e.spanId,
|
|
291
|
-
...n ? { parentSpanId: n } : {},
|
|
292
|
-
name: e.body,
|
|
293
|
-
kind: W(e, b.kind) === "client" ? U.client : U.internal,
|
|
294
|
-
startTimeUnixNano: W(e, b.start) ?? e.timeUnixNano,
|
|
295
|
-
endTimeUnixNano: W(e, b.end) ?? e.timeUnixNano,
|
|
296
|
-
attributes: L(t),
|
|
297
|
-
status: { code: W(e, b.status) === "error" ? ze : Be }
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
var Ue = {
|
|
301
|
-
name: S,
|
|
302
|
-
serialize(e) {
|
|
303
|
-
let t = z(e).map((e) => ({
|
|
304
|
-
resource: { attributes: L(e.resource) },
|
|
305
|
-
scopeSpans: [{
|
|
306
|
-
scope: {
|
|
307
|
-
name: g,
|
|
308
|
-
version: C
|
|
309
|
-
},
|
|
310
|
-
spans: e.records.map(He)
|
|
311
|
-
}]
|
|
312
|
-
}));
|
|
313
|
-
return {
|
|
314
|
-
body: JSON.stringify({ resourceSpans: t }),
|
|
315
|
-
contentType: p
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region src/transport/serializers/select.ts
|
|
321
|
-
function We(e) {
|
|
322
|
-
return e === "otlp" ? Me : e === "ecs" ? Ae : e;
|
|
323
|
-
}
|
|
324
|
-
function G(e, t) {
|
|
325
|
-
let n = (t) => e.records.length > 0 && e.records.every((e) => pe(e, "log.type") === t);
|
|
326
|
-
return t.metricsEndpoint !== "" && n("metric") ? "metrics" : n("span") ? "traces" : "logs";
|
|
327
|
-
}
|
|
328
|
-
function K(e, t) {
|
|
329
|
-
return e === "metrics" ? t.metricsEndpoint : e === "traces" ? t.tracesEndpoint : t.endpoint;
|
|
330
|
-
}
|
|
331
|
-
var Ge = {
|
|
332
|
-
metrics: Re,
|
|
333
|
-
traces: Ue
|
|
334
|
-
};
|
|
335
|
-
function q(e, t, n, r) {
|
|
336
|
-
try {
|
|
337
|
-
return (Ge[G(t, e)] ?? We(e.serializer)).serialize(t.records);
|
|
338
|
-
} catch (e) {
|
|
339
|
-
n.report("transport.serialize_failed", r, { batchId: t.id }, e);
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
//#endregion
|
|
344
|
-
//#region src/transport/status-transport.ts
|
|
345
|
-
var J = class {
|
|
29
|
+
var B = class {
|
|
346
30
|
config;
|
|
347
31
|
diagnostics;
|
|
348
32
|
onSampling;
|
|
349
33
|
onLoss;
|
|
34
|
+
onClock;
|
|
350
35
|
cancellation = new AbortController();
|
|
351
36
|
stop() {
|
|
352
37
|
this.cancellation.abort();
|
|
353
38
|
}
|
|
354
39
|
assertContext(e) {
|
|
355
|
-
if (this.cancellation.signal.aborted || this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) throw this.diagnostics.count("security.context_mismatch"), new
|
|
40
|
+
if (this.cancellation.signal.aborted || this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) throw this.diagnostics.count("security.context_mismatch"), new N("permanent", "The delivery context is inactive or does not match the batch.");
|
|
356
41
|
}
|
|
357
42
|
async untilCancelled(e) {
|
|
358
|
-
if (this.cancellation.signal.aborted) throw new
|
|
43
|
+
if (this.cancellation.signal.aborted) throw new N("permanent", "The delivery context retired.");
|
|
359
44
|
let t, n = new Promise((e, n) => {
|
|
360
45
|
t = () => {
|
|
361
|
-
n(new
|
|
46
|
+
n(new N("permanent", "The delivery context retired."));
|
|
362
47
|
}, this.cancellation.signal.addEventListener("abort", t, { once: !0 });
|
|
363
48
|
});
|
|
364
49
|
try {
|
|
@@ -373,21 +58,23 @@ var J = class {
|
|
|
373
58
|
traces: 0
|
|
374
59
|
};
|
|
375
60
|
acceptedAt = null;
|
|
376
|
-
constructor(e, t, n = () => void 0, r = () => void 0) {
|
|
377
|
-
this.config = e, this.diagnostics = t, this.onSampling = n, this.onLoss = r;
|
|
61
|
+
constructor(e, t, n = () => void 0, r = () => void 0, i = () => void 0) {
|
|
62
|
+
this.config = e, this.diagnostics = t, this.onSampling = n, this.onLoss = r, this.onClock = i;
|
|
378
63
|
}
|
|
379
64
|
throttledForMs(e) {
|
|
380
|
-
return Math.max(0, this.throttledUntil[
|
|
65
|
+
return Math.max(0, this.throttledUntil[P(e, this.config)] - Date.now());
|
|
381
66
|
}
|
|
382
67
|
lastSendAt() {
|
|
383
68
|
return this.acceptedAt;
|
|
384
69
|
}
|
|
385
70
|
serialize(e) {
|
|
386
|
-
let t =
|
|
71
|
+
let t = M(this.config, e, this.diagnostics, "The serializer threw an error. The library dropped the batch.");
|
|
387
72
|
return t || this.onLoss("unserializable", e.records, [e.id]), t;
|
|
388
73
|
}
|
|
389
|
-
accept(e, t) {
|
|
74
|
+
accept(e, t, n) {
|
|
390
75
|
this.throttledUntil[e] = 0, this.acceptedAt = Date.now(), this.config.sampling.remote && t != null && this.onSampling(t);
|
|
76
|
+
let r = z(n);
|
|
77
|
+
r !== void 0 && this.onClock(r);
|
|
391
78
|
}
|
|
392
79
|
reject(e, t, n, r) {
|
|
393
80
|
let i = String(e);
|
|
@@ -395,23 +82,22 @@ var J = class {
|
|
|
395
82
|
let t = r.advice === void 0 ? "" : ` ${r.advice}`;
|
|
396
83
|
return this.diagnostics.report("transport.rejected_credentials", `The server returned ${i}.${t}`, {
|
|
397
84
|
status: e,
|
|
398
|
-
endpoint:
|
|
399
|
-
}), new
|
|
85
|
+
endpoint: j(n, this.config)
|
|
86
|
+
}), new N("permanent", `The server rejected the batch with ${i}.`, e);
|
|
400
87
|
}
|
|
401
|
-
if (e === 413) return new
|
|
88
|
+
if (e === 413) return new N("too_large", "The payload is too large.", e, void 0, r.maxBytes);
|
|
402
89
|
if (e === 429 || e === 503) {
|
|
403
90
|
let t = e === 429, i = r.retryAfterMs === void 0 ? void 0 : Math.min(r.retryAfterMs, this.config.delivery.retryMaxDelayMs);
|
|
404
|
-
return this.throttledUntil[n] = Date.now() + (i ?? this.config.delivery.retryBaseDelayMs), t && this.diagnostics.report("transport.throttled", "The server throttles the requests.", { retryAfterMs: i }), new
|
|
91
|
+
return this.throttledUntil[n] = Date.now() + (i ?? this.config.delivery.retryBaseDelayMs), t && this.diagnostics.report("transport.throttled", "The server throttles the requests.", { retryAfterMs: i }), new N("throttled", t ? "The server throttles the requests." : "The service is not available.", e, i);
|
|
405
92
|
}
|
|
406
|
-
return e === 408 || e >= 500 ? new
|
|
93
|
+
return e === 408 || e >= 500 ? new N("transient", `The server returned the error ${i}.`, e) : (this.diagnostics.report("transport.dropped_permanent", `The server rejected the batch with ${i}. The library dropped it.`, {
|
|
407
94
|
batchId: t,
|
|
408
95
|
status: e
|
|
409
|
-
}), new
|
|
96
|
+
}), new N("permanent", `The server rejected the batch with ${i}.`, e));
|
|
410
97
|
}
|
|
411
98
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
function Y(e, t, n) {
|
|
99
|
+
// src/transport/custom-transport.ts
|
|
100
|
+
function V(e, t, n) {
|
|
415
101
|
return {
|
|
416
102
|
kind: n,
|
|
417
103
|
body: t.body,
|
|
@@ -422,39 +108,39 @@ function Y(e, t, n) {
|
|
|
422
108
|
routingContextId: e.routingContextId
|
|
423
109
|
};
|
|
424
110
|
}
|
|
425
|
-
function
|
|
111
|
+
function H(e) {
|
|
426
112
|
if (typeof e != "object" || !e) return !1;
|
|
427
113
|
let t = Reflect.get(e, "status");
|
|
428
114
|
return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 599;
|
|
429
115
|
}
|
|
430
|
-
function
|
|
116
|
+
function U(e) {
|
|
431
117
|
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : void 0;
|
|
432
118
|
}
|
|
433
|
-
var
|
|
119
|
+
var W = class extends B {
|
|
434
120
|
async send(e) {
|
|
435
121
|
this.assertContext(e);
|
|
436
122
|
let { transport: t } = this.config;
|
|
437
123
|
if (!t || e.records.length === 0) return;
|
|
438
124
|
let n = this.serialize(e);
|
|
439
125
|
if (!n) return;
|
|
440
|
-
let r =
|
|
126
|
+
let r = P(e, this.config), i = V(e, n, r);
|
|
441
127
|
i.signal = this.cancellation.signal;
|
|
442
128
|
let a;
|
|
443
129
|
try {
|
|
444
|
-
a = await
|
|
130
|
+
a = await S(this.untilCancelled(T(() => E(() => k(() => t(i))))), this.config.delivery.requestTimeoutMs);
|
|
445
131
|
} catch (e) {
|
|
446
|
-
let t = e instanceof
|
|
447
|
-
throw new
|
|
132
|
+
let t = e instanceof w ? e : void 0, n = t ? "timeout" : "transient", r = t?.message ?? "The custom transport failed.";
|
|
133
|
+
throw new N(n, r, void 0, void 0, void 0, e);
|
|
448
134
|
}
|
|
449
|
-
if (this.assertContext(e), !
|
|
135
|
+
if (this.assertContext(e), !H(a)) throw this.diagnostics.report("transport.http_error", "The custom transport returned no valid status. The library sends the batch again later.", { batchId: e.id }), new N("transient", "The custom transport returned no valid status.");
|
|
450
136
|
let { status: o } = a;
|
|
451
|
-
if (o >= 200 && o < 300) this.accept(r, a.sampling);
|
|
137
|
+
if (o >= 200 && o < 300) this.accept(r, a.sampling, a.date);
|
|
452
138
|
else throw this.reject(o, e.id, r, {
|
|
453
|
-
retryAfterMs:
|
|
454
|
-
maxBytes:
|
|
139
|
+
retryAfterMs: U(a.retryAfterMs),
|
|
140
|
+
maxBytes: U(a.maxBytes)
|
|
455
141
|
});
|
|
456
142
|
}
|
|
457
|
-
},
|
|
143
|
+
}, G = class {
|
|
458
144
|
deps;
|
|
459
145
|
installed = !1;
|
|
460
146
|
keepaliveBytes = 0;
|
|
@@ -476,7 +162,7 @@ var qe = class extends J {
|
|
|
476
162
|
install() {
|
|
477
163
|
if (this.installed || typeof addEventListener > "u") return;
|
|
478
164
|
this.installed = !0, typeof document < "u" && (document.addEventListener("visibilitychange", this.onVisibility), document.addEventListener("freeze", this.onFreeze)), addEventListener("pagehide", this.onPageHide);
|
|
479
|
-
let e =
|
|
165
|
+
let e = D()?.me;
|
|
480
166
|
this.deps.diagnostics.guard("openfin.unavailable", "The library could not subscribe to close-requested.", () => {
|
|
481
167
|
e?.on?.("close-requested", this.onOpenFinClose);
|
|
482
168
|
});
|
|
@@ -484,7 +170,7 @@ var qe = class extends J {
|
|
|
484
170
|
uninstall() {
|
|
485
171
|
if (!this.installed) return;
|
|
486
172
|
this.installed = !1, typeof document < "u" && (document.removeEventListener("visibilitychange", this.onVisibility), document.removeEventListener("freeze", this.onFreeze)), removeEventListener("pagehide", this.onPageHide);
|
|
487
|
-
let e =
|
|
173
|
+
let e = D()?.me;
|
|
488
174
|
this.deps.diagnostics.guard("openfin.unavailable", "The library could not unsubscribe from close-requested.", () => {
|
|
489
175
|
e?.removeListener?.("close-requested", this.onOpenFinClose);
|
|
490
176
|
});
|
|
@@ -505,35 +191,35 @@ var qe = class extends J {
|
|
|
505
191
|
if (r !== null) {
|
|
506
192
|
this.keepaliveBytes = 0;
|
|
507
193
|
for (let i of this.deps.drainForExit()) {
|
|
508
|
-
let a =
|
|
194
|
+
let a = P(i, t), o = a === "logs" ? r.href : j(a, t);
|
|
509
195
|
o ? this.flushBatch(i, e, new URL(o)) : n.count("record.dropped_no_destination");
|
|
510
196
|
}
|
|
511
197
|
}
|
|
512
198
|
}
|
|
513
|
-
flushBatch(
|
|
514
|
-
let { config:
|
|
515
|
-
if (
|
|
516
|
-
let
|
|
517
|
-
if (!
|
|
518
|
-
if (
|
|
519
|
-
this.park(
|
|
199
|
+
flushBatch(t, i, a) {
|
|
200
|
+
let { config: o } = this.deps;
|
|
201
|
+
if (t.records.length === 0) return;
|
|
202
|
+
let s = this.serialize(t, i);
|
|
203
|
+
if (!s) return;
|
|
204
|
+
if (O(s.body) > 6e4) {
|
|
205
|
+
this.park(t);
|
|
520
206
|
return;
|
|
521
207
|
}
|
|
522
|
-
|
|
523
|
-
let
|
|
524
|
-
if (
|
|
525
|
-
this.keepaliveFetch(
|
|
526
|
-
let
|
|
527
|
-
return
|
|
208
|
+
a.searchParams.set(n, t.id), a.searchParams.set(r, i);
|
|
209
|
+
let c = a.toString(), l = this.deps.exitHeaders();
|
|
210
|
+
if (l) {
|
|
211
|
+
this.keepaliveFetch(c, t, s.body, i, () => {
|
|
212
|
+
let e = new Headers(l);
|
|
213
|
+
return e.set(u, s.contentType), e.set(f, t.id), e;
|
|
528
214
|
});
|
|
529
215
|
return;
|
|
530
216
|
}
|
|
531
|
-
if (
|
|
532
|
-
this.park(
|
|
217
|
+
if (o.headers) {
|
|
218
|
+
this.park(t);
|
|
533
219
|
return;
|
|
534
220
|
}
|
|
535
|
-
let
|
|
536
|
-
|
|
221
|
+
let d = this.beacon(c, s.body);
|
|
222
|
+
d !== "sent" && (d === "refused" ? this.park(t) : this.keepaliveFetch(c, t, s.body, i, () => new Headers({ [u]: e })));
|
|
537
223
|
}
|
|
538
224
|
flushAlive() {
|
|
539
225
|
let { diagnostics: e } = this.deps, t = "The flush of the hidden document failed.";
|
|
@@ -548,16 +234,16 @@ var qe = class extends J {
|
|
|
548
234
|
for (let i of this.deps.drainForExit()) {
|
|
549
235
|
let a = this.serialize(i, e);
|
|
550
236
|
if (!a) continue;
|
|
551
|
-
let o =
|
|
552
|
-
(t === void 0 || r.guard("transport.http_error", "The transportOnExit hook threw an error.", () =>
|
|
237
|
+
let o = V(i, a, P(i, n));
|
|
238
|
+
(t === void 0 || r.guard("transport.http_error", "The transportOnExit hook threw an error.", () => E(() => t(o))) !== !0) && this.park(i);
|
|
553
239
|
}
|
|
554
240
|
}
|
|
555
241
|
park(e) {
|
|
556
242
|
let { config: t, diagnostics: n, onLoss: r } = this.deps;
|
|
557
|
-
t.storage === "memory" || t.storage === "none" ? r?.("not_stored", e.records, [e.id]) :
|
|
243
|
+
t.storage === "memory" || t.storage === "none" ? r?.("not_stored", e.records, [e.id]) : y(e, n, r);
|
|
558
244
|
}
|
|
559
245
|
serialize(e, t) {
|
|
560
|
-
let n =
|
|
246
|
+
let n = M(this.deps.config, e, this.deps.diagnostics, `The ${t} exit flush could not serialize its batch.`);
|
|
561
247
|
return n || this.deps.onLoss?.("unserializable", e.records, [e.id]), n;
|
|
562
248
|
}
|
|
563
249
|
endpointUrl() {
|
|
@@ -573,7 +259,7 @@ var qe = class extends J {
|
|
|
573
259
|
keepaliveFetch(e, t, n, r, i) {
|
|
574
260
|
let { config: a, diagnostics: o } = this.deps, s = () => {
|
|
575
261
|
this.park(t);
|
|
576
|
-
}, c =
|
|
262
|
+
}, c = O(n);
|
|
577
263
|
this.keepaliveBytes + c > 6e4 ? s() : (this.keepaliveBytes += c, o.guard("transport.http_error", "The keepalive fetch failed.", () => (fetch(e, {
|
|
578
264
|
method: "POST",
|
|
579
265
|
body: n,
|
|
@@ -584,71 +270,81 @@ var qe = class extends J {
|
|
|
584
270
|
o.report("transport.http_error", "The exit flush failed.", { reason: r }, e), s();
|
|
585
271
|
}), !0)) !== !0 && s());
|
|
586
272
|
}
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return new Uint8Array(r);
|
|
273
|
+
}, K = /* @__PURE__ */ new WeakMap();
|
|
274
|
+
function se(e, t) {
|
|
275
|
+
let { headers: n } = t;
|
|
276
|
+
if (!n) return;
|
|
277
|
+
if (typeof n != "function") return n;
|
|
278
|
+
let r = K.get(e);
|
|
279
|
+
return r?.source === n && r.endpoint === t.endpoint && r.metricsEndpoint === t.metricsEndpoint && r.tracesEndpoint === t.tracesEndpoint ? r.headers : void 0;
|
|
595
280
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
281
|
+
async function q(e, t, n) {
|
|
282
|
+
let { headers: r } = t;
|
|
283
|
+
if (!r) return {};
|
|
284
|
+
if (typeof r != "function") return r;
|
|
285
|
+
let { endpoint: i, metricsEndpoint: a, tracesEndpoint: o } = t, s = await n.guardAsync("transport.http_error", "The headers() function threw an error.", () => Promise.resolve(r()));
|
|
286
|
+
return s && K.set(e, {
|
|
287
|
+
source: r,
|
|
288
|
+
endpoint: i,
|
|
289
|
+
metricsEndpoint: a,
|
|
290
|
+
tracesEndpoint: o,
|
|
291
|
+
headers: s
|
|
292
|
+
}), s ?? {};
|
|
293
|
+
}
|
|
294
|
+
function J(e) {
|
|
295
|
+
K.delete(e);
|
|
296
|
+
}
|
|
297
|
+
// src/transport/http-transport.ts
|
|
298
|
+
var Y = "In a cross-origin iframe, the session cookie is a third-party cookie. The browser often blocks it. Forward the records to the platform document. As an alternative, issue the cookie with the Partitioned attribute.", X = class extends B {
|
|
600
299
|
async send(e, t) {
|
|
601
300
|
this.assertContext(e);
|
|
602
|
-
let { config: n } = this, r =
|
|
301
|
+
let { config: n } = this, r = P(e, n), i = j(r, n);
|
|
603
302
|
i ? e.records.length !== 0 && await this.post(e, r, i, t) : this.diagnostics.count("record.dropped_no_destination");
|
|
604
303
|
}
|
|
605
304
|
lastHeaders() {
|
|
606
|
-
|
|
607
|
-
if (!e) return;
|
|
608
|
-
if (typeof e != "function") return e;
|
|
609
|
-
let t = this.cachedHeaders;
|
|
610
|
-
return t?.source === e && t.endpoint === this.config.endpoint && t.metricsEndpoint === this.config.metricsEndpoint && t.tracesEndpoint === this.config.tracesEndpoint ? t.headers : void 0;
|
|
305
|
+
return se(this, this.config);
|
|
611
306
|
}
|
|
612
307
|
async post(e, t, n, r) {
|
|
613
308
|
let i = this.serialize(e);
|
|
614
309
|
if (!i) return;
|
|
615
310
|
let a = await this.attempt(e, n, i, r);
|
|
616
|
-
if (this.assertContext(e), this.rejectsCredentials(a.status) && typeof this.config.headers == "function" && (this
|
|
617
|
-
|
|
311
|
+
if (this.assertContext(e), this.rejectsCredentials(a.status) && typeof this.config.headers == "function" && (J(this), a = await this.attempt(e, n, i, r), this.assertContext(e)), a.ok) {
|
|
312
|
+
let { headers: e } = a;
|
|
313
|
+
this.accept(t, e.get(s), e.get(m));
|
|
618
314
|
return;
|
|
619
315
|
}
|
|
620
|
-
let
|
|
621
|
-
throw this.reject(
|
|
622
|
-
retryAfterMs:
|
|
623
|
-
maxBytes:
|
|
624
|
-
advice:
|
|
316
|
+
let c = a.status, l = A(a.headers.get(o)), u = c === 413 ? await this.readMaxBytes(a) : void 0;
|
|
317
|
+
throw this.reject(c, e.id, t, {
|
|
318
|
+
retryAfterMs: l,
|
|
319
|
+
maxBytes: u,
|
|
320
|
+
advice: Y
|
|
625
321
|
});
|
|
626
322
|
}
|
|
627
323
|
rejectsCredentials(e) {
|
|
628
324
|
return e === 401 || e === 403;
|
|
629
325
|
}
|
|
630
|
-
async attempt(t, n, r
|
|
631
|
-
let
|
|
632
|
-
o.set(
|
|
633
|
-
let s = await this.before(this.encodeBody(
|
|
634
|
-
this.assertContext(
|
|
635
|
-
let
|
|
636
|
-
return
|
|
326
|
+
async attempt(e, t, n, r) {
|
|
327
|
+
let i = Date.now() + this.config.delivery.requestTimeoutMs, o = new Headers(await this.before(this.resolveHeaders(), i, t));
|
|
328
|
+
o.set(u, n.contentType), o.set(f, e.id), o.set(d, String(e.attempts));
|
|
329
|
+
let s = await this.before(this.encodeBody(n.body), i, t);
|
|
330
|
+
this.assertContext(e), typeof s != "string" && o.set(a, p);
|
|
331
|
+
let c = this.keepalive(s);
|
|
332
|
+
return c && r?.(), this.dispatch(t, o, s, i, c);
|
|
637
333
|
}
|
|
638
334
|
async before(e, t, n) {
|
|
639
335
|
try {
|
|
640
|
-
return await
|
|
336
|
+
return await S(this.untilCancelled(e), Math.max(0, t - Date.now()));
|
|
641
337
|
} catch {
|
|
642
|
-
throw this.cancellation.signal.aborted ? new
|
|
338
|
+
throw this.cancellation.signal.aborted ? new N("permanent", "The delivery context retired.") : this.timeout(n);
|
|
643
339
|
}
|
|
644
340
|
}
|
|
645
341
|
timeout(e) {
|
|
646
342
|
let t = `The request took longer than ${String(this.config.delivery.requestTimeoutMs)} ms.`;
|
|
647
|
-
return this.diagnostics.report("transport.timeout", t, { endpoint: e }), new
|
|
343
|
+
return this.diagnostics.report("transport.timeout", t, { endpoint: e }), new N("timeout", t);
|
|
648
344
|
}
|
|
649
345
|
async encodeBody(e) {
|
|
650
346
|
let { config: t } = this;
|
|
651
|
-
return t.compression !== "gzip" ||
|
|
347
|
+
return t.compression !== "gzip" || O(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "The library could not compress the payload.", () => ne(e)) ?? e;
|
|
652
348
|
}
|
|
653
349
|
async dispatch(e, t, n, r, i) {
|
|
654
350
|
let { config: a } = this, o = new AbortController(), s = () => {
|
|
@@ -658,25 +354,26 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
658
354
|
let c = setTimeout(() => {
|
|
659
355
|
o.abort();
|
|
660
356
|
}, Math.max(0, r - Date.now()));
|
|
661
|
-
|
|
357
|
+
C(c);
|
|
662
358
|
try {
|
|
663
|
-
return await
|
|
359
|
+
return await E(() => fetch(e, {
|
|
664
360
|
method: "POST",
|
|
665
361
|
headers: t,
|
|
666
362
|
body: n,
|
|
667
363
|
credentials: a.credentials,
|
|
668
364
|
signal: o.signal,
|
|
669
365
|
cache: "no-store",
|
|
670
|
-
keepalive: i
|
|
366
|
+
keepalive: i,
|
|
367
|
+
priority: i ? "auto" : a.delivery.priority
|
|
671
368
|
}));
|
|
672
369
|
} catch {
|
|
673
|
-
throw this.cancellation.signal.aborted ? new
|
|
370
|
+
throw this.cancellation.signal.aborted ? new N("permanent", "The delivery context retired.") : o.signal.aborted ? this.timeout(e) : new N(F() ? "transient" : "offline", "A network error occurred.");
|
|
674
371
|
} finally {
|
|
675
372
|
this.cancellation.signal.removeEventListener("abort", s), clearTimeout(c);
|
|
676
373
|
}
|
|
677
374
|
}
|
|
678
375
|
keepalive(e) {
|
|
679
|
-
let t = globalThis.document?.visibilityState === "hidden", n = typeof e == "string" ?
|
|
376
|
+
let t = globalThis.document?.visibilityState === "hidden", n = typeof e == "string" ? O(e) : e.byteLength;
|
|
680
377
|
return t && n <= 6e4;
|
|
681
378
|
}
|
|
682
379
|
async readMaxBytes(e) {
|
|
@@ -686,19 +383,9 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
686
383
|
});
|
|
687
384
|
}
|
|
688
385
|
async resolveHeaders() {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
let { endpoint: t, metricsEndpoint: n, tracesEndpoint: r } = this.config, i = await this.diagnostics.guardAsync("transport.http_error", "The headers() function threw an error.", () => Promise.resolve(e()));
|
|
693
|
-
return i && (this.cachedHeaders = {
|
|
694
|
-
source: e,
|
|
695
|
-
endpoint: t,
|
|
696
|
-
metricsEndpoint: n,
|
|
697
|
-
tracesEndpoint: r,
|
|
698
|
-
headers: i
|
|
699
|
-
}), i ?? {};
|
|
700
|
-
}
|
|
701
|
-
}, Qe = class {
|
|
386
|
+
return q(this, this.config, this.diagnostics);
|
|
387
|
+
}
|
|
388
|
+
}, ce = class {
|
|
702
389
|
storage;
|
|
703
390
|
transport;
|
|
704
391
|
diagnostics;
|
|
@@ -714,7 +401,7 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
714
401
|
this.attempt = 0, this.schedule(0);
|
|
715
402
|
};
|
|
716
403
|
constructor(e, t, n, r, i, a = () => void 0) {
|
|
717
|
-
this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i, this.onLoss = a, this.maxAttempts =
|
|
404
|
+
this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i, this.onLoss = a, this.maxAttempts = h(r.retention).maxAttempts;
|
|
718
405
|
}
|
|
719
406
|
start() {
|
|
720
407
|
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(this.config.delivery.retryIdleDelayMs);
|
|
@@ -744,10 +431,10 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
744
431
|
let t = setTimeout(() => {
|
|
745
432
|
this.drain();
|
|
746
433
|
}, e);
|
|
747
|
-
this.timer = t,
|
|
434
|
+
this.timer = t, C(t);
|
|
748
435
|
}
|
|
749
436
|
bounded(e) {
|
|
750
|
-
return
|
|
437
|
+
return S(e, t);
|
|
751
438
|
}
|
|
752
439
|
clearTimer() {
|
|
753
440
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
@@ -760,8 +447,8 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
760
447
|
if (!this.draining) {
|
|
761
448
|
this.draining = !0;
|
|
762
449
|
try {
|
|
763
|
-
let e =
|
|
764
|
-
await
|
|
450
|
+
let e = b(i, this.config.persistence.namespace);
|
|
451
|
+
await v(e, this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(this.config.delivery.retryIdleDelayMs);
|
|
765
452
|
} finally {
|
|
766
453
|
this.draining = !1;
|
|
767
454
|
}
|
|
@@ -769,13 +456,13 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
769
456
|
}
|
|
770
457
|
async drainLocked() {
|
|
771
458
|
try {
|
|
772
|
-
if (!
|
|
459
|
+
if (!F()) return this.schedule(this.config.delivery.retryIdleDelayMs), !0;
|
|
773
460
|
let e = await this.bounded(this.storage.take(this.batchesPerDrain ?? this.config.delivery.batchesPerDrain));
|
|
774
461
|
if (e.length === 0) return this.schedule(this.config.delivery.retryIdleDelayMs), !0;
|
|
775
462
|
let t = /* @__PURE__ */ new Set(), n = 0;
|
|
776
463
|
for (let r of e) {
|
|
777
464
|
if (this.stopped) return !0;
|
|
778
|
-
let e =
|
|
465
|
+
let e = P(r, this.config);
|
|
779
466
|
if (t.has(e)) continue;
|
|
780
467
|
let i = await this.deliver(r);
|
|
781
468
|
if (i === "stop") return !0;
|
|
@@ -795,7 +482,7 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
795
482
|
return await this.transport.send(e), await this.bounded(this.storage.remove(e.id)), this.attempt = 0, "next";
|
|
796
483
|
} catch (t) {
|
|
797
484
|
if (this.stopped) return "stop";
|
|
798
|
-
let n = t instanceof
|
|
485
|
+
let n = t instanceof N ? t : void 0;
|
|
799
486
|
return n?.kind === "permanent" || n?.kind === "too_large" ? (await this.replaceStored(e, t), "next") : n?.kind === "offline" ? (this.schedule(this.config.delivery.retryIdleDelayMs), "stop") : n?.kind === "throttled" ? (this.attempt++, n.retryAfterMs ?? this.backoffMs()) : (await this.bounded(this.storage.bumpAttempts(e.id, e.attempts + 1)), this.attempt++, n?.retryAfterMs ?? this.backoffMs());
|
|
800
487
|
}
|
|
801
488
|
}
|
|
@@ -805,10 +492,10 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
805
492
|
for (let e of n) await this.bounded(this.storage.save(e));
|
|
806
493
|
}
|
|
807
494
|
toStorable(e, t) {
|
|
808
|
-
let n = t instanceof
|
|
495
|
+
let n = t instanceof N ? t : void 0;
|
|
809
496
|
if (n?.kind === "permanent") return this.onLoss("rejected", e.records, [e.id]), [];
|
|
810
497
|
if (n?.kind !== "too_large") return [e];
|
|
811
|
-
let r =
|
|
498
|
+
let r = re(e, this.diagnostics);
|
|
812
499
|
return r ? (this.diagnostics.report("transport.batch_split", "The server refused the batch because it is too large.", {
|
|
813
500
|
from: e.records.length,
|
|
814
501
|
to: r[0].records.length,
|
|
@@ -824,7 +511,7 @@ var Xe = "In a cross-origin iframe, the session cookie is a third-party cookie.
|
|
|
824
511
|
"traces"
|
|
825
512
|
];
|
|
826
513
|
function Q(e) {
|
|
827
|
-
let t = e.attributes[
|
|
514
|
+
let t = e.attributes[c];
|
|
828
515
|
return t === "metric" ? "metrics" : t === "span" ? "traces" : "logs";
|
|
829
516
|
}
|
|
830
517
|
var $ = class {
|
|
@@ -854,12 +541,12 @@ var $ = class {
|
|
|
854
541
|
let e = setTimeout(() => {
|
|
855
542
|
this.timer = null, this.onFlush(this);
|
|
856
543
|
}, this.options.flushIntervalMs);
|
|
857
|
-
this.timer = e,
|
|
544
|
+
this.timer = e, C(e);
|
|
858
545
|
}
|
|
859
546
|
clearTimer() {
|
|
860
547
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
861
548
|
}
|
|
862
|
-
},
|
|
549
|
+
}, le = class {
|
|
863
550
|
transport;
|
|
864
551
|
storage;
|
|
865
552
|
retry;
|
|
@@ -867,11 +554,12 @@ var $ = class {
|
|
|
867
554
|
routingContextId;
|
|
868
555
|
policy;
|
|
869
556
|
onLoss;
|
|
557
|
+
clockOffset;
|
|
870
558
|
streams;
|
|
871
559
|
unconfirmed = /* @__PURE__ */ new Map();
|
|
872
560
|
queue = [];
|
|
873
561
|
open = /* @__PURE__ */ new Set();
|
|
874
|
-
ceiling = new
|
|
562
|
+
ceiling = new oe();
|
|
875
563
|
inFlight = 0;
|
|
876
564
|
pumpScheduled = !1;
|
|
877
565
|
stopped = !1;
|
|
@@ -894,7 +582,7 @@ var $ = class {
|
|
|
894
582
|
if (!this.policy) return !0;
|
|
895
583
|
let { maxPendingRecords: t, maxPendingBytes: n, overflow: r } = this.policy.buffering, i;
|
|
896
584
|
try {
|
|
897
|
-
i =
|
|
585
|
+
i = O(JSON.stringify(e));
|
|
898
586
|
} catch {
|
|
899
587
|
return this.onLoss("unserializable", [e]), !1;
|
|
900
588
|
}
|
|
@@ -916,20 +604,20 @@ var $ = class {
|
|
|
916
604
|
}
|
|
917
605
|
return this.held.set(e, i), this.heldBytes += i, !0;
|
|
918
606
|
}
|
|
919
|
-
constructor(e, t, n, r, i, a, o, s = () => void 0) {
|
|
920
|
-
this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r, this.routingContextId = a, this.policy = o, this.onLoss = s;
|
|
921
|
-
let
|
|
607
|
+
constructor(e, t, n, r, i, a, o, s = () => void 0, c = () => void 0) {
|
|
608
|
+
this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r, this.routingContextId = a, this.policy = o, this.onLoss = s, this.clockOffset = c;
|
|
609
|
+
let l = (e) => {
|
|
922
610
|
this.claim(e);
|
|
923
611
|
};
|
|
924
612
|
this.streams = {
|
|
925
|
-
logs: new $(i.logs,
|
|
926
|
-
metrics: new $(i.metrics,
|
|
927
|
-
traces: new $(i.traces,
|
|
613
|
+
logs: new $(i.logs, l),
|
|
614
|
+
metrics: new $(i.metrics, l),
|
|
615
|
+
traces: new $(i.traces, l)
|
|
928
616
|
};
|
|
929
617
|
}
|
|
930
618
|
push(e) {
|
|
931
619
|
if (this.stopped) return;
|
|
932
|
-
e.observedTimeUnixNano =
|
|
620
|
+
e.observedTimeUnixNano = ie();
|
|
933
621
|
let t = { ...e };
|
|
934
622
|
this.admit(t) && this.route(t);
|
|
935
623
|
}
|
|
@@ -961,7 +649,7 @@ var $ = class {
|
|
|
961
649
|
}
|
|
962
650
|
toBatch(e) {
|
|
963
651
|
return e.length === 0 ? null : {
|
|
964
|
-
id:
|
|
652
|
+
id: ae(this.diagnostics),
|
|
965
653
|
records: e,
|
|
966
654
|
createdAt: Date.now(),
|
|
967
655
|
attempts: 0,
|
|
@@ -971,12 +659,16 @@ var $ = class {
|
|
|
971
659
|
}
|
|
972
660
|
route(e) {
|
|
973
661
|
try {
|
|
974
|
-
let t = this.streams[
|
|
975
|
-
if (!this.ceiling.allow(e, this.policy?.capturePolicy.errorCeiling, this.policy?.capturePolicy.windowMs)) {
|
|
662
|
+
let t = Q(e), n = this.streams[t];
|
|
663
|
+
if (t === "logs" && !this.ceiling.allow(e, this.policy?.capturePolicy.errorCeiling, this.policy?.capturePolicy.windowMs, this.policy?.sampling.alwaysSampleFrom)) {
|
|
976
664
|
this.release([e]), this.diagnostics.count("record.dropped_by_ceiling");
|
|
977
665
|
return;
|
|
978
666
|
}
|
|
979
|
-
|
|
667
|
+
let r = this.clockOffset();
|
|
668
|
+
r !== void 0 && t !== "metrics" && (e.attributes = {
|
|
669
|
+
...e.attributes,
|
|
670
|
+
[l]: r
|
|
671
|
+
}), n.add(e);
|
|
980
672
|
} catch (e) {
|
|
981
673
|
this.diagnostics.report("pipeline.crashed", "The pipeline dropped a record before it reached a stream.", void 0, e);
|
|
982
674
|
}
|
|
@@ -993,7 +685,7 @@ var $ = class {
|
|
|
993
685
|
}),
|
|
994
686
|
resolve: t
|
|
995
687
|
};
|
|
996
|
-
this.unconfirmed.set(e.id, e), this.open.add(n), this.queue.push(n),
|
|
688
|
+
this.unconfirmed.set(e.id, e), this.open.add(n), this.queue.push(n), this.pumpScheduled || (this.pumpScheduled = !0, queueMicrotask(() => {
|
|
997
689
|
this.pumpScheduled = !1, this.pump();
|
|
998
690
|
}));
|
|
999
691
|
}
|
|
@@ -1050,10 +742,10 @@ var $ = class {
|
|
|
1050
742
|
}
|
|
1051
743
|
async store(e) {
|
|
1052
744
|
await this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", async () => {
|
|
1053
|
-
await
|
|
745
|
+
await S(this.storage.save(e), t), this.retry.nudge();
|
|
1054
746
|
});
|
|
1055
747
|
}
|
|
1056
|
-
},
|
|
748
|
+
}, ue = class e {
|
|
1057
749
|
storage;
|
|
1058
750
|
retry;
|
|
1059
751
|
pipeline;
|
|
@@ -1066,40 +758,42 @@ var $ = class {
|
|
|
1066
758
|
this.storage = e, this.retry = t, this.pipeline = n, this.exitFlush = r, this.diagnostics = i, this.transport = a;
|
|
1067
759
|
}
|
|
1068
760
|
static async create(t) {
|
|
1069
|
-
let { config: n, diagnostics: r } = t, i = t.storage ?? await
|
|
1070
|
-
t.onStorage?.(i);
|
|
1071
|
-
let a = new
|
|
1072
|
-
let i =
|
|
1073
|
-
i &&
|
|
1074
|
-
},
|
|
761
|
+
let { config: n, diagnostics: r } = t, i = t.storage ?? await ee(n.storage, te(n.persistence.namespace), h(n.retention), r, t.onGap, n.persistence.namespace);
|
|
762
|
+
t.onStorage?.(i), n.persistence.requestPersistent && (i.name === "indexeddb" || i.name === "localstorage") && (t.onPersistence?.("pending"), R(r).then(t.onPersistence));
|
|
763
|
+
let a = new x(i, n.securityContext, n.persistence.namespace), o = (e) => {
|
|
764
|
+
let i = I(e, r);
|
|
765
|
+
i && L(t.remote, n, i);
|
|
766
|
+
}, s, c = (e) => {
|
|
767
|
+
s = e;
|
|
768
|
+
}, { onLoss: l } = t, u = !n.transport && n.transportWorker ? await r.guardAsync("transport.http_error", "The transport worker module did not load. The library uses HTTP.", async () => (await import("./worker-transport-D6jtgpqN.js")).createWorkerTransport(n, r, o, l, c)) : void 0, d = n.transport !== void 0 || u !== void 0 ? void 0 : new X(n, r, o, l, c), f = u?.transport ?? d ?? new W(n, r, o, l, c), p = new ce(a, f, r, n, void 0, l), { batching: m } = n, g = new le(f, a, p, r, {
|
|
1075
769
|
logs: {
|
|
1076
|
-
flushIntervalMs:
|
|
1077
|
-
batchSize:
|
|
770
|
+
flushIntervalMs: m.logFlushIntervalMs,
|
|
771
|
+
batchSize: m.logBatchSize
|
|
1078
772
|
},
|
|
1079
773
|
metrics: {
|
|
1080
|
-
flushIntervalMs:
|
|
1081
|
-
batchSize:
|
|
774
|
+
flushIntervalMs: m.metricFlushIntervalMs,
|
|
775
|
+
batchSize: m.metricBatchSize
|
|
1082
776
|
},
|
|
1083
777
|
traces: {
|
|
1084
|
-
flushIntervalMs:
|
|
1085
|
-
batchSize:
|
|
778
|
+
flushIntervalMs: m.logFlushIntervalMs,
|
|
779
|
+
batchSize: m.logBatchSize
|
|
1086
780
|
}
|
|
1087
|
-
}, () => n.securityContext.id || void 0, n, s),
|
|
781
|
+
}, () => n.securityContext.id || void 0, n, l, () => n.metadata.clockOffset ? s : void 0), _ = new G({
|
|
1088
782
|
config: n,
|
|
1089
783
|
diagnostics: r,
|
|
1090
|
-
drainForExit: () =>
|
|
1091
|
-
flushAlive: () =>
|
|
1092
|
-
exitHeaders: () =>
|
|
1093
|
-
onLoss:
|
|
784
|
+
drainForExit: () => g.drainForExit(),
|
|
785
|
+
flushAlive: () => g.flushPending(),
|
|
786
|
+
exitHeaders: () => u ? u.exitHeaders() : d?.lastHeaders(),
|
|
787
|
+
onLoss: l,
|
|
1094
788
|
beforeExit: t.beforeExit
|
|
1095
|
-
}),
|
|
789
|
+
}), v = !1;
|
|
1096
790
|
try {
|
|
1097
|
-
|
|
791
|
+
_.install(), p.start(), v = !0;
|
|
1098
792
|
} finally {
|
|
1099
|
-
|
|
793
|
+
v || (_.uninstall(), p.stop());
|
|
1100
794
|
}
|
|
1101
|
-
let
|
|
1102
|
-
return
|
|
795
|
+
let y = new e(a, p, g, _, r, f);
|
|
796
|
+
return y.emergencyImport = y.importEmergency(), y;
|
|
1103
797
|
}
|
|
1104
798
|
push(e) {
|
|
1105
799
|
this.pipeline.push(e);
|
|
@@ -1108,7 +802,7 @@ var $ = class {
|
|
|
1108
802
|
await this.pipeline.flushPending();
|
|
1109
803
|
}
|
|
1110
804
|
async clearPersisted(e, t) {
|
|
1111
|
-
e === "namespace" ? await this.storage.clearNamespace() : await this.storage.clear(),
|
|
805
|
+
e === "namespace" ? await this.storage.clearNamespace() : await this.storage.clear(), g(t, this.diagnostics, this.storage.namespace, e === "namespace");
|
|
1112
806
|
}
|
|
1113
807
|
async queueDepth() {
|
|
1114
808
|
return await this.diagnostics.guardAsync("storage.degraded", "The library could not count the batches in storage.", () => this.storage.count()) ?? 0;
|
|
@@ -1120,11 +814,11 @@ var $ = class {
|
|
|
1120
814
|
};
|
|
1121
815
|
}
|
|
1122
816
|
async destroy() {
|
|
1123
|
-
await this.diagnostics.guardAsync("pipeline.crashed", "The flush before shutdown failed.", () => this.flush()), this.exitFlush.flush("shutdown"), this.exitFlush.uninstall(), this.retry.stop(), this.pipeline.destroy(), await this.storage.close();
|
|
817
|
+
await this.diagnostics.guardAsync("pipeline.crashed", "The flush before shutdown failed.", () => this.flush()), this.exitFlush.flush("shutdown"), this.exitFlush.uninstall(), this.retry.stop(), this.transport.stop(), this.pipeline.destroy(), await this.storage.close();
|
|
1124
818
|
}
|
|
1125
819
|
async retire(e, t, n) {
|
|
1126
820
|
if (this.retired = !0, this.exitFlush.uninstall(), this.retry.stop(), e === "flush") try {
|
|
1127
|
-
await
|
|
821
|
+
await S(Promise.all([this.flush(), this.retry.flush()]), t);
|
|
1128
822
|
} catch (e) {
|
|
1129
823
|
this.diagnostics.report("transport.timeout", "The flush of the old security context did not complete before its time limit.", void 0, e);
|
|
1130
824
|
}
|
|
@@ -1138,7 +832,7 @@ var $ = class {
|
|
|
1138
832
|
persistenceNamespace: this.storage.namespace
|
|
1139
833
|
});
|
|
1140
834
|
let o = e === "discard" || e === "flush";
|
|
1141
|
-
return await this.storage.retire(o), o &&
|
|
835
|
+
return await this.storage.retire(o), o && g(n, this.diagnostics, this.storage.namespace), {
|
|
1142
836
|
buffered: i,
|
|
1143
837
|
stored: a
|
|
1144
838
|
};
|
|
@@ -1153,11 +847,10 @@ var $ = class {
|
|
|
1153
847
|
e.length > 0 && this.retry.nudge();
|
|
1154
848
|
}
|
|
1155
849
|
async importEmergency() {
|
|
1156
|
-
let e = await this.diagnostics.guardAsync("storage.degraded", "The emergency import failed.", () =>
|
|
850
|
+
let e = await this.diagnostics.guardAsync("storage.degraded", "The emergency import failed.", () => _(this.storage, this.diagnostics, (e) => this.storage.accepts(e), this.storage.namespace));
|
|
1157
851
|
!this.retired && e !== void 0 && e > 0 && this.retry.nudge();
|
|
1158
852
|
}
|
|
1159
853
|
};
|
|
1160
|
-
|
|
1161
|
-
export { et as Sender };
|
|
854
|
+
export { ue as Sender, B as a, q as i, X as n, J as r, Y as t };
|
|
1162
855
|
|
|
1163
|
-
//# sourceMappingURL=sender-
|
|
856
|
+
//# sourceMappingURL=sender-CiMHC9YG.js.map
|