@utk09/ui-observability 0.11.0 → 1.0.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 +481 -0
- package/README.md +73 -669
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
- package/dist/batch-CXmPmTse.js.map +1 -0
- package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
- package/dist/batch-mmPigCpi.cjs.map +1 -0
- package/dist/bus/bus.d.cts +331 -0
- package/dist/bus/bus.d.ts +108 -57
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +22 -7
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +11 -2
- package/dist/bus-C39wspFV.js +775 -0
- package/dist/bus-C39wspFV.js.map +1 -0
- package/dist/bus-_EaOVPGq.cjs +2 -0
- package/dist/bus-_EaOVPGq.cjs.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +11 -11
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +7 -7
- package/dist/capture/interactions.d.cts +48 -0
- package/dist/capture/interactions.d.ts +15 -15
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +4 -4
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +7 -7
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +18 -18
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +45 -0
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +79 -0
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +3 -3
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +2 -2
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +7 -7
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +54 -41
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +9 -9
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +4 -4
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +14 -14
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +21 -8
- package/dist/compression-CvED_Jel.cjs +2 -0
- package/dist/compression-CvED_Jel.cjs.map +1 -0
- package/dist/compression-tVtXwVjX.js +11 -0
- package/dist/compression-tVtXwVjX.js.map +1 -0
- package/dist/config-DUs7uHHt.cjs +2 -0
- package/dist/config-DUs7uHHt.cjs.map +1 -0
- package/dist/config-SgQcCP1_.js +560 -0
- package/dist/config-SgQcCP1_.js.map +1 -0
- package/dist/console-BGgGnjSi.js +81 -0
- package/dist/console-BGgGnjSi.js.map +1 -0
- package/dist/console-CSZ5_Vx5.cjs +2 -0
- package/dist/console-CSZ5_Vx5.cjs.map +1 -0
- package/dist/constants-CUyd9cTZ.js +357 -0
- package/dist/constants-CUyd9cTZ.js.map +1 -0
- package/dist/constants-CqdJhTxH.cjs +2 -0
- package/dist/constants-CqdJhTxH.cjs.map +1 -0
- package/dist/constants.d.cts +751 -0
- package/dist/constants.d.ts +231 -116
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +21 -15
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +33 -5
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +8 -13
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +13 -13
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +6 -6
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +4 -4
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +25 -22
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +22 -12
- package/dist/core/hold-buffer.d.cts +36 -0
- package/dist/core/hold-buffer.d.ts +16 -7
- package/dist/core/journey.d.cts +148 -0
- package/dist/core/journey.d.ts +28 -29
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +45 -51
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +21 -10
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +38 -28
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +114 -50
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +67 -35
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +7 -7
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +24 -23
- package/dist/core/rotation.d.cts +75 -0
- package/dist/core/rotation.d.ts +75 -0
- package/dist/core/runtime.d.cts +765 -0
- package/dist/core/runtime.d.ts +430 -186
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +22 -22
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +80 -34
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +6 -6
- package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
- package/dist/deadline-C4ccAuk5.js.map +1 -0
- package/dist/deadline-CUGbto-y.cjs +2 -0
- package/dist/deadline-CUGbto-y.cjs.map +1 -0
- package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
- package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
- package/dist/debug-bundle-CRpYV_ui.js +35 -0
- package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +19 -6
- package/dist/doctor.js +180 -53
- package/dist/doctor.js.map +1 -1
- package/dist/error-like-B11pB4aL.js.map +1 -1
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/errors-BE_EZV7Q.js +86 -0
- package/dist/errors-BE_EZV7Q.js.map +1 -0
- package/dist/errors-CNPbesMs.cjs +3 -0
- package/dist/errors-CNPbesMs.cjs.map +1 -0
- package/dist/factory-CTi0Is3F.js +404 -0
- package/dist/factory-CTi0Is3F.js.map +1 -0
- package/dist/factory-hRrH32v5.cjs +2 -0
- package/dist/factory-hRrH32v5.cjs.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/global-scope-D9I8s-oN.js.map +1 -1
- package/dist/guards-BlYGRK4l.js +10 -0
- package/dist/guards-BlYGRK4l.js.map +1 -0
- package/dist/guards-EjG3ahFp.cjs +2 -0
- package/dist/guards-EjG3ahFp.cjs.map +1 -0
- package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
- package/dist/identity-DdhKgrpk.js.map +1 -0
- package/dist/identity-DlWRIuwy.cjs +2 -0
- package/dist/identity-DlWRIuwy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -0
- package/dist/index.d.ts +165 -141
- package/dist/index.js +1283 -1468
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
- package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
- package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
- package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
- package/dist/interactions-CUkzK8sR.cjs +2 -0
- package/dist/interactions-CUkzK8sR.cjs.map +1 -0
- package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
- package/dist/interactions-DiFvCosX.js.map +1 -0
- package/dist/journey-B4Adltjm.cjs +2 -0
- package/dist/journey-B4Adltjm.cjs.map +1 -0
- package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
- package/dist/journey-D2_sia57.js.map +1 -0
- package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
- package/dist/library-console-Btrzt814.js.map +1 -0
- package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
- package/dist/library-console-CPW6bvZH.cjs.map +1 -0
- package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
- package/dist/library-request-BJ9PLRaD.js.map +1 -0
- package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
- package/dist/library-request-D7OvTxZV.cjs.map +1 -0
- package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
- package/dist/lifecycle-22CUCrc9.js.map +1 -0
- package/dist/lifecycle-IaAm1mOC.cjs +2 -0
- package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
- package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
- package/dist/log-record-BNiLfqtL.js.map +1 -0
- package/dist/log-record-CkivuiEl.cjs +2 -0
- package/dist/log-record-CkivuiEl.cjs.map +1 -0
- package/dist/long-frames-BUUbXd-B.cjs +2 -0
- package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
- package/dist/long-frames-DNFaRnC3.js +62 -0
- package/dist/long-frames-DNFaRnC3.js.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +16 -17
- package/dist/models/bus.d.cts +158 -0
- package/dist/models/bus.d.ts +46 -26
- package/dist/models/config.d.cts +1540 -0
- package/dist/models/config.d.ts +692 -405
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +29 -14
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +119 -23
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +94 -18
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +16 -16
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.cts +23 -0
- package/dist/models/serializer.d.ts +3 -4
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +17 -14
- package/dist/network-CGMLQ-mA.cjs +2 -0
- package/dist/network-CGMLQ-mA.cjs.map +1 -0
- package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
- package/dist/network-on2zZT6H.js.map +1 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-BENHf3g9.cjs +2 -0
- package/dist/otlp-BENHf3g9.cjs.map +1 -0
- package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
- package/dist/otlp-DimfrRor.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/patch-UdPz1ea8.js.map +1 -1
- package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
- package/dist/platform-BaaFIPCU.js.map +1 -0
- package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
- package/dist/platform-CfA3-7sJ.cjs.map +1 -0
- package/dist/profiler-BAZoh7A4.js +292 -0
- package/dist/profiler-BAZoh7A4.js.map +1 -0
- package/dist/profiler-D4tJpDRc.cjs +2 -0
- package/dist/profiler-D4tJpDRc.cjs.map +1 -0
- package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
- package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
- package/dist/profiler-frames-cJMx9wNM.js +78 -0
- package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
- package/dist/remote-rules-Dz9MRAsB.js +95 -0
- package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
- package/dist/remote-rules-_tY0zj5o.cjs +2 -0
- package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
- package/dist/replay-B3gFXIZd.cjs +2 -0
- package/dist/replay-B3gFXIZd.cjs.map +1 -0
- package/dist/replay-Ds-ANH34.js +310 -0
- package/dist/replay-Ds-ANH34.js.map +1 -0
- package/dist/reports-BDSe4dFH.cjs +2 -0
- package/dist/reports-BDSe4dFH.cjs.map +1 -0
- package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
- package/dist/reports-C-thq-bk.js.map +1 -0
- package/dist/resource-timing-C576gFIQ.cjs +2 -0
- package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
- package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
- package/dist/resource-timing-eUl2dNgC.js.map +1 -0
- package/dist/response-body-YdNl-HkR.cjs +3 -0
- package/dist/response-body-YdNl-HkR.cjs.map +1 -0
- package/dist/response-body-eoSQpLiH.js +331 -0
- package/dist/response-body-eoSQpLiH.js.map +1 -0
- package/dist/rotation-Cwct4ckk.js +94 -0
- package/dist/rotation-Cwct4ckk.js.map +1 -0
- package/dist/rotation-D4qUAHAu.cjs +2 -0
- package/dist/rotation-D4qUAHAu.cjs.map +1 -0
- package/dist/sampling-BlrI8jor.js +63 -0
- package/dist/sampling-BlrI8jor.js.map +1 -0
- package/dist/sampling-mXt4dstx.cjs +2 -0
- package/dist/sampling-mXt4dstx.cjs.map +1 -0
- package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
- package/dist/sanitize-Ba0KqU06.js.map +1 -0
- package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
- package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
- package/dist/sender-BdRuNVhF.cjs +2 -0
- package/dist/sender-BdRuNVhF.cjs.map +1 -0
- package/dist/sender-Dv8rAmpV.js +979 -0
- package/dist/sender-Dv8rAmpV.js.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +38 -37
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +13 -13
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +13 -13
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +11 -10
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +9 -9
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +32 -33
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +38 -31
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +9 -9
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +49 -42
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +25 -25
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +3 -3
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-B2EzVuYm.js +51 -0
- package/dist/stored-context-B2EzVuYm.js.map +1 -0
- package/dist/stored-context-CXt7eHZL.cjs +2 -0
- package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
- package/dist/storm-C-zYSdDX.cjs +2 -0
- package/dist/storm-C-zYSdDX.cjs.map +1 -0
- package/dist/storm-DjKetLKZ.js +9 -0
- package/dist/storm-DjKetLKZ.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/custom-transport.d.cts +22 -0
- package/dist/transport/custom-transport.d.ts +6 -5
- package/dist/transport/errors.d.cts +31 -0
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +62 -45
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +4 -4
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +48 -35
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +8 -8
- package/dist/transport/response-body.d.cts +49 -0
- package/dist/transport/response-body.d.ts +49 -0
- package/dist/transport/retry-engine.d.cts +129 -0
- package/dist/transport/retry-engine.d.ts +62 -43
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +2 -2
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +2 -2
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +18 -18
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +11 -11
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +45 -28
- package/dist/transport/worker-client.d.cts +23 -0
- package/dist/transport/worker-client.d.ts +12 -3
- package/dist/transport/worker-entry.d.cts +5 -0
- package/dist/transport/worker-entry.d.ts +1 -1
- package/dist/transport/worker-protocol.d.cts +38 -0
- package/dist/transport/worker-protocol.d.ts +7 -5
- package/dist/transport/worker-server.d.cts +3 -0
- package/dist/transport/worker-server.d.ts +1 -1
- package/dist/transport/worker-transport.d.cts +10 -0
- package/dist/transport/worker-transport.d.ts +5 -4
- package/dist/types-BAerHgCq.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
- package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
- package/dist/unclean-exit-py99ApzT.cjs +2 -0
- package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
- package/dist/unref-CU9Nyz_9.cjs +2 -0
- package/dist/unref-CU9Nyz_9.cjs.map +1 -0
- package/dist/unref-DgHPQeWv.js +7 -0
- package/dist/unref-DgHPQeWv.js.map +1 -0
- package/dist/{user-timing-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
- package/dist/user-timing-BePqb1uN.js.map +1 -0
- package/dist/user-timing-D6XTmpuM.cjs +2 -0
- package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +6 -6
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +10 -2
- package/dist/utils/identity.d.cts +109 -0
- package/dist/utils/identity.d.ts +20 -21
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +11 -10
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +15 -13
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +5 -5
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +49 -42
- package/dist/utils/unref.d.cts +9 -0
- package/dist/utils/unref.d.ts +3 -3
- package/dist/web-socket-CoIUBM3C.cjs +2 -0
- package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
- package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
- package/dist/web-socket-DSHgDiZ6.js.map +1 -0
- package/dist/web-vitals-4pWACwaR.js +71 -0
- package/dist/web-vitals-4pWACwaR.js.map +1 -0
- package/dist/web-vitals-__X7t4pj.cjs +2 -0
- package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
- package/dist/worker-protocol-QbvqNazn.cjs +2 -0
- package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
- package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
- package/dist/worker-protocol-x074Rpet.js.map +1 -0
- package/dist/worker-server-CFe4nvos.cjs +2 -0
- package/dist/worker-server-CFe4nvos.cjs.map +1 -0
- package/dist/worker-server-iUVSjH8L.js +94 -0
- package/dist/worker-server-iUVSjH8L.js.map +1 -0
- package/dist/worker-transport-CRAX-09c.cjs +2 -0
- package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
- package/dist/worker-transport-Dy1KMA7t.js +190 -0
- package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
- package/llms.txt +397 -0
- package/package.json +55 -41
- package/dist/batch-C8OcWR2L.cjs.map +0 -1
- package/dist/batch-CL9uWYY3.js.map +0 -1
- package/dist/bus-BZ0GldpT.js +0 -660
- package/dist/bus-BZ0GldpT.js.map +0 -1
- package/dist/bus-VWlmM5xs.cjs +0 -2
- package/dist/bus-VWlmM5xs.cjs.map +0 -1
- package/dist/console-BPZCuSLc.cjs +0 -2
- package/dist/console-BPZCuSLc.cjs.map +0 -1
- package/dist/console-BeCF7n59.js +0 -82
- package/dist/console-BeCF7n59.js.map +0 -1
- package/dist/constants-DqKJH_MP.cjs +0 -2
- package/dist/constants-DqKJH_MP.cjs.map +0 -1
- package/dist/constants-zyrqveN4.js +0 -304
- package/dist/constants-zyrqveN4.js.map +0 -1
- package/dist/context-storage-BjzeBSxH.cjs +0 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
- package/dist/context-storage-BzkoHzkQ.js +0 -51
- package/dist/context-storage-BzkoHzkQ.js.map +0 -1
- package/dist/deadline-BOjOxNHj.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
- package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
- package/dist/debug-bundle-C7UkHZ-q.js +0 -25
- package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
- package/dist/emergency-queue-CNTRui5t.cjs +0 -2
- package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
- package/dist/emergency-queue-Zy6lNafo.js +0 -67
- package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
- package/dist/errors-Dh7kef0i.js +0 -92
- package/dist/errors-Dh7kef0i.js.map +0 -1
- package/dist/errors-tfEr48bS.cjs +0 -3
- package/dist/errors-tfEr48bS.cjs.map +0 -1
- package/dist/factory-BonqI3NL.js +0 -276
- package/dist/factory-BonqI3NL.js.map +0 -1
- package/dist/factory-CJXVYp0R.cjs +0 -2
- package/dist/factory-CJXVYp0R.cjs.map +0 -1
- package/dist/guards-Cidk71ME.js +0 -7
- package/dist/guards-Cidk71ME.js.map +0 -1
- package/dist/guards-nJ70syPt.cjs +0 -2
- package/dist/guards-nJ70syPt.cjs.map +0 -1
- package/dist/identity-Cxgj6pZX.cjs +0 -2
- package/dist/identity-Cxgj6pZX.cjs.map +0 -1
- package/dist/identity-DT5VmvXy.js.map +0 -1
- package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
- package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
- package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
- package/dist/interactions-DTgKy_6K.js.map +0 -1
- package/dist/interactions-fEN6FbVo.cjs +0 -2
- package/dist/interactions-fEN6FbVo.cjs.map +0 -1
- package/dist/journey-CuJrHzEg.js.map +0 -1
- package/dist/journey-pffMVMfa.cjs +0 -2
- package/dist/journey-pffMVMfa.cjs.map +0 -1
- package/dist/keys-BHhw_0Wh.cjs +0 -2
- package/dist/keys-BHhw_0Wh.cjs.map +0 -1
- package/dist/keys-BU9j5YqW.js +0 -16
- package/dist/keys-BU9j5YqW.js.map +0 -1
- package/dist/library-console-C1m6g1BR.js.map +0 -1
- package/dist/library-console-D2GY9Or6.cjs.map +0 -1
- package/dist/library-request-1BX_UlaX.cjs.map +0 -1
- package/dist/library-request-BQBT9N9Q.js.map +0 -1
- package/dist/lifecycle-2EtUaRpo.cjs +0 -2
- package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
- package/dist/lifecycle-BaKx_-32.js.map +0 -1
- package/dist/log-record-CAoGBBf3.js.map +0 -1
- package/dist/log-record-i9zOTkpQ.cjs +0 -2
- package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
- package/dist/long-frames-BVg4i5SC.cjs +0 -2
- package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
- package/dist/long-frames-Czk7IupC.js +0 -64
- package/dist/long-frames-Czk7IupC.js.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-DBNwApoF.js.map +0 -1
- package/dist/network-xbbuvG_6.cjs +0 -2
- package/dist/network-xbbuvG_6.cjs.map +0 -1
- package/dist/otlp-BDvFrLnc.cjs +0 -2
- package/dist/otlp-BDvFrLnc.cjs.map +0 -1
- package/dist/otlp-BTJdIa6F.js.map +0 -1
- package/dist/platform-C2Ez5kDc.cjs.map +0 -1
- package/dist/platform-DkcuXwe-.js.map +0 -1
- package/dist/remote-rules-Cfb4K-Nl.js +0 -98
- package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
- package/dist/remote-rules-vzvk7aKf.cjs +0 -2
- package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
- package/dist/reports-Dk2YhKIh.cjs +0 -2
- package/dist/reports-Dk2YhKIh.cjs.map +0 -1
- package/dist/reports-TA-zInnq.js.map +0 -1
- package/dist/resource-timing-BLv3EA2A.js.map +0 -1
- package/dist/resource-timing-Cysw1S1f.cjs +0 -2
- package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
- package/dist/sampling-C4VV-1MS.js +0 -60
- package/dist/sampling-C4VV-1MS.js.map +0 -1
- package/dist/sampling-Ckh2yW9k.cjs +0 -2
- package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
- package/dist/sanitize-6ymPlVvP.js.map +0 -1
- package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
- package/dist/select-ZF4by-lF.cjs +0 -3
- package/dist/select-ZF4by-lF.cjs.map +0 -1
- package/dist/select-xtQaenIi.js +0 -270
- package/dist/select-xtQaenIi.js.map +0 -1
- package/dist/sender-CiMHC9YG.js +0 -856
- package/dist/sender-CiMHC9YG.js.map +0 -1
- package/dist/sender-D5wBoXA8.cjs +0 -2
- package/dist/sender-D5wBoXA8.cjs.map +0 -1
- package/dist/storage-BA9RqRO-.cjs +0 -2
- package/dist/storage-BA9RqRO-.cjs.map +0 -1
- package/dist/storage-DZwed89z.js +0 -16
- package/dist/storage-DZwed89z.js.map +0 -1
- package/dist/storm-CYi9Swpx.cjs +0 -2
- package/dist/storm-CYi9Swpx.cjs.map +0 -1
- package/dist/storm-VR024_QN.js +0 -9
- package/dist/storm-VR024_QN.js.map +0 -1
- package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
- package/dist/unclean-exit-DFUN57wY.cjs +0 -2
- package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
- package/dist/user-timing-C9kfRq3J.cjs +0 -2
- package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
- package/dist/user-timing-_jZIhDKI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BWUoqBh8.cjs +0 -2
- package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
- package/dist/web-socket-CV7yIMnm.js.map +0 -1
- package/dist/web-vitals-Bq4WFHQo.js +0 -52
- package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
- package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
- package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
- package/dist/worker-protocol-Bai7GAIA.cjs +0 -2
- package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
- package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
- package/dist/worker-server-BrIYkfoa.cjs +0 -2
- package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
- package/dist/worker-server-Dp5HYm4b.js +0 -83
- package/dist/worker-server-Dp5HYm4b.js.map +0 -1
- package/dist/worker-transport-Bwej4N2e.cjs +0 -2
- package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
- package/dist/worker-transport-D6jtgpqN.js +0 -199
- package/dist/worker-transport-D6jtgpqN.js.map +0 -1
package/dist/sender-CiMHC9YG.js
DELETED
|
@@ -1,856 +0,0 @@
|
|
|
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";
|
|
23
|
-
}
|
|
24
|
-
// src/transport/status-transport.ts
|
|
25
|
-
function z(e) {
|
|
26
|
-
let t = typeof e == "string" ? Date.parse(e) : NaN;
|
|
27
|
-
return Number.isNaN(t) ? void 0 : Math.round(t + 500 - Date.now());
|
|
28
|
-
}
|
|
29
|
-
var B = class {
|
|
30
|
-
config;
|
|
31
|
-
diagnostics;
|
|
32
|
-
onSampling;
|
|
33
|
-
onLoss;
|
|
34
|
-
onClock;
|
|
35
|
-
cancellation = new AbortController();
|
|
36
|
-
stop() {
|
|
37
|
-
this.cancellation.abort();
|
|
38
|
-
}
|
|
39
|
-
assertContext(e) {
|
|
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.");
|
|
41
|
-
}
|
|
42
|
-
async untilCancelled(e) {
|
|
43
|
-
if (this.cancellation.signal.aborted) throw new N("permanent", "The delivery context retired.");
|
|
44
|
-
let t, n = new Promise((e, n) => {
|
|
45
|
-
t = () => {
|
|
46
|
-
n(new N("permanent", "The delivery context retired."));
|
|
47
|
-
}, this.cancellation.signal.addEventListener("abort", t, { once: !0 });
|
|
48
|
-
});
|
|
49
|
-
try {
|
|
50
|
-
return await Promise.race([e, n]);
|
|
51
|
-
} finally {
|
|
52
|
-
this.cancellation.signal.removeEventListener("abort", t);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
throttledUntil = {
|
|
56
|
-
logs: 0,
|
|
57
|
-
metrics: 0,
|
|
58
|
-
traces: 0
|
|
59
|
-
};
|
|
60
|
-
acceptedAt = null;
|
|
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;
|
|
63
|
-
}
|
|
64
|
-
throttledForMs(e) {
|
|
65
|
-
return Math.max(0, this.throttledUntil[P(e, this.config)] - Date.now());
|
|
66
|
-
}
|
|
67
|
-
lastSendAt() {
|
|
68
|
-
return this.acceptedAt;
|
|
69
|
-
}
|
|
70
|
-
serialize(e) {
|
|
71
|
-
let t = M(this.config, e, this.diagnostics, "The serializer threw an error. The library dropped the batch.");
|
|
72
|
-
return t || this.onLoss("unserializable", e.records, [e.id]), t;
|
|
73
|
-
}
|
|
74
|
-
accept(e, t, n) {
|
|
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);
|
|
78
|
-
}
|
|
79
|
-
reject(e, t, n, r) {
|
|
80
|
-
let i = String(e);
|
|
81
|
-
if (e === 401 || e === 403) {
|
|
82
|
-
let t = r.advice === void 0 ? "" : ` ${r.advice}`;
|
|
83
|
-
return this.diagnostics.report("transport.rejected_credentials", `The server returned ${i}.${t}`, {
|
|
84
|
-
status: e,
|
|
85
|
-
endpoint: j(n, this.config)
|
|
86
|
-
}), new N("permanent", `The server rejected the batch with ${i}.`, e);
|
|
87
|
-
}
|
|
88
|
-
if (e === 413) return new N("too_large", "The payload is too large.", e, void 0, r.maxBytes);
|
|
89
|
-
if (e === 429 || e === 503) {
|
|
90
|
-
let t = e === 429, i = r.retryAfterMs === void 0 ? void 0 : Math.min(r.retryAfterMs, this.config.delivery.retryMaxDelayMs);
|
|
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);
|
|
92
|
-
}
|
|
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.`, {
|
|
94
|
-
batchId: t,
|
|
95
|
-
status: e
|
|
96
|
-
}), new N("permanent", `The server rejected the batch with ${i}.`, e));
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
// src/transport/custom-transport.ts
|
|
100
|
-
function V(e, t, n) {
|
|
101
|
-
return {
|
|
102
|
-
kind: n,
|
|
103
|
-
body: t.body,
|
|
104
|
-
contentType: t.contentType,
|
|
105
|
-
batchId: e.id,
|
|
106
|
-
attempt: e.attempts,
|
|
107
|
-
records: e.records,
|
|
108
|
-
routingContextId: e.routingContextId
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function H(e) {
|
|
112
|
-
if (typeof e != "object" || !e) return !1;
|
|
113
|
-
let t = Reflect.get(e, "status");
|
|
114
|
-
return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 599;
|
|
115
|
-
}
|
|
116
|
-
function U(e) {
|
|
117
|
-
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : void 0;
|
|
118
|
-
}
|
|
119
|
-
var W = class extends B {
|
|
120
|
-
async send(e) {
|
|
121
|
-
this.assertContext(e);
|
|
122
|
-
let { transport: t } = this.config;
|
|
123
|
-
if (!t || e.records.length === 0) return;
|
|
124
|
-
let n = this.serialize(e);
|
|
125
|
-
if (!n) return;
|
|
126
|
-
let r = P(e, this.config), i = V(e, n, r);
|
|
127
|
-
i.signal = this.cancellation.signal;
|
|
128
|
-
let a;
|
|
129
|
-
try {
|
|
130
|
-
a = await S(this.untilCancelled(T(() => E(() => k(() => t(i))))), this.config.delivery.requestTimeoutMs);
|
|
131
|
-
} catch (e) {
|
|
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);
|
|
134
|
-
}
|
|
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.");
|
|
136
|
-
let { status: o } = a;
|
|
137
|
-
if (o >= 200 && o < 300) this.accept(r, a.sampling, a.date);
|
|
138
|
-
else throw this.reject(o, e.id, r, {
|
|
139
|
-
retryAfterMs: U(a.retryAfterMs),
|
|
140
|
-
maxBytes: U(a.maxBytes)
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}, G = class {
|
|
144
|
-
deps;
|
|
145
|
-
installed = !1;
|
|
146
|
-
keepaliveBytes = 0;
|
|
147
|
-
onVisibility = () => {
|
|
148
|
-
document.visibilityState === "hidden" && this.flush("hidden");
|
|
149
|
-
};
|
|
150
|
-
onPageHide = () => {
|
|
151
|
-
this.flush("pagehide");
|
|
152
|
-
};
|
|
153
|
-
onFreeze = () => {
|
|
154
|
-
this.flush("freeze");
|
|
155
|
-
};
|
|
156
|
-
onOpenFinClose = () => {
|
|
157
|
-
this.flush("openfin-close");
|
|
158
|
-
};
|
|
159
|
-
constructor(e) {
|
|
160
|
-
this.deps = e;
|
|
161
|
-
}
|
|
162
|
-
install() {
|
|
163
|
-
if (this.installed || typeof addEventListener > "u") return;
|
|
164
|
-
this.installed = !0, typeof document < "u" && (document.addEventListener("visibilitychange", this.onVisibility), document.addEventListener("freeze", this.onFreeze)), addEventListener("pagehide", this.onPageHide);
|
|
165
|
-
let e = D()?.me;
|
|
166
|
-
this.deps.diagnostics.guard("openfin.unavailable", "The library could not subscribe to close-requested.", () => {
|
|
167
|
-
e?.on?.("close-requested", this.onOpenFinClose);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
uninstall() {
|
|
171
|
-
if (!this.installed) return;
|
|
172
|
-
this.installed = !1, typeof document < "u" && (document.removeEventListener("visibilitychange", this.onVisibility), document.removeEventListener("freeze", this.onFreeze)), removeEventListener("pagehide", this.onPageHide);
|
|
173
|
-
let e = D()?.me;
|
|
174
|
-
this.deps.diagnostics.guard("openfin.unavailable", "The library could not unsubscribe from close-requested.", () => {
|
|
175
|
-
e?.removeListener?.("close-requested", this.onOpenFinClose);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
flush(e) {
|
|
179
|
-
let { config: t, diagnostics: n } = this.deps;
|
|
180
|
-
if (n.guard("pipeline.crashed", "The metric points before the exit flush failed.", () => {
|
|
181
|
-
this.deps.beforeExit?.();
|
|
182
|
-
}), e === "hidden") {
|
|
183
|
-
this.flushAlive();
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (t.transport) {
|
|
187
|
-
this.flushCustom(e, t.transportOnExit);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
let r = this.endpointUrl();
|
|
191
|
-
if (r !== null) {
|
|
192
|
-
this.keepaliveBytes = 0;
|
|
193
|
-
for (let i of this.deps.drainForExit()) {
|
|
194
|
-
let a = P(i, t), o = a === "logs" ? r.href : j(a, t);
|
|
195
|
-
o ? this.flushBatch(i, e, new URL(o)) : n.count("record.dropped_no_destination");
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
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);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
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;
|
|
214
|
-
});
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (o.headers) {
|
|
218
|
-
this.park(t);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
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 })));
|
|
223
|
-
}
|
|
224
|
-
flushAlive() {
|
|
225
|
-
let { diagnostics: e } = this.deps, t = "The flush of the hidden document failed.";
|
|
226
|
-
e.guard("pipeline.crashed", t, () => {
|
|
227
|
-
Promise.resolve(this.deps.flushAlive()).catch((n) => {
|
|
228
|
-
e.report("pipeline.crashed", t, void 0, n);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
flushCustom(e, t) {
|
|
233
|
-
let { config: n, diagnostics: r } = this.deps;
|
|
234
|
-
for (let i of this.deps.drainForExit()) {
|
|
235
|
-
let a = this.serialize(i, e);
|
|
236
|
-
if (!a) continue;
|
|
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);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
park(e) {
|
|
242
|
-
let { config: t, diagnostics: n, onLoss: r } = this.deps;
|
|
243
|
-
t.storage === "memory" || t.storage === "none" ? r?.("not_stored", e.records, [e.id]) : y(e, n, r);
|
|
244
|
-
}
|
|
245
|
-
serialize(e, t) {
|
|
246
|
-
let n = M(this.deps.config, e, this.deps.diagnostics, `The ${t} exit flush could not serialize its batch.`);
|
|
247
|
-
return n || this.deps.onLoss?.("unserializable", e.records, [e.id]), n;
|
|
248
|
-
}
|
|
249
|
-
endpointUrl() {
|
|
250
|
-
let { endpoint: e } = this.deps.config;
|
|
251
|
-
return e ? this.deps.diagnostics.guard("config.invalid", `The exit flush cannot use the endpoint ${e}.`, () => new URL(e)) ?? null : null;
|
|
252
|
-
}
|
|
253
|
-
beacon(e, t) {
|
|
254
|
-
return this.deps.diagnostics.guard("transport.http_error", "The sendBeacon call failed.", () => {
|
|
255
|
-
let n = globalThis.navigator;
|
|
256
|
-
return n?.sendBeacon ? n.sendBeacon(e, new Blob([t], { type: "text/plain;charset=UTF-8" })) ? "sent" : "refused" : "unavailable";
|
|
257
|
-
}) ?? "unavailable";
|
|
258
|
-
}
|
|
259
|
-
keepaliveFetch(e, t, n, r, i) {
|
|
260
|
-
let { config: a, diagnostics: o } = this.deps, s = () => {
|
|
261
|
-
this.park(t);
|
|
262
|
-
}, c = O(n);
|
|
263
|
-
this.keepaliveBytes + c > 6e4 ? s() : (this.keepaliveBytes += c, o.guard("transport.http_error", "The keepalive fetch failed.", () => (fetch(e, {
|
|
264
|
-
method: "POST",
|
|
265
|
-
body: n,
|
|
266
|
-
headers: i(),
|
|
267
|
-
credentials: a.credentials,
|
|
268
|
-
keepalive: !0
|
|
269
|
-
}).catch((e) => {
|
|
270
|
-
o.report("transport.http_error", "The exit flush failed.", { reason: r }, e), s();
|
|
271
|
-
}), !0)) !== !0 && s());
|
|
272
|
-
}
|
|
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;
|
|
280
|
-
}
|
|
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 {
|
|
299
|
-
async send(e, t) {
|
|
300
|
-
this.assertContext(e);
|
|
301
|
-
let { config: n } = this, r = P(e, n), i = j(r, n);
|
|
302
|
-
i ? e.records.length !== 0 && await this.post(e, r, i, t) : this.diagnostics.count("record.dropped_no_destination");
|
|
303
|
-
}
|
|
304
|
-
lastHeaders() {
|
|
305
|
-
return se(this, this.config);
|
|
306
|
-
}
|
|
307
|
-
async post(e, t, n, r) {
|
|
308
|
-
let i = this.serialize(e);
|
|
309
|
-
if (!i) return;
|
|
310
|
-
let a = await this.attempt(e, n, i, r);
|
|
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));
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
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
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
rejectsCredentials(e) {
|
|
324
|
-
return e === 401 || e === 403;
|
|
325
|
-
}
|
|
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);
|
|
333
|
-
}
|
|
334
|
-
async before(e, t, n) {
|
|
335
|
-
try {
|
|
336
|
-
return await S(this.untilCancelled(e), Math.max(0, t - Date.now()));
|
|
337
|
-
} catch {
|
|
338
|
-
throw this.cancellation.signal.aborted ? new N("permanent", "The delivery context retired.") : this.timeout(n);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
timeout(e) {
|
|
342
|
-
let t = `The request took longer than ${String(this.config.delivery.requestTimeoutMs)} ms.`;
|
|
343
|
-
return this.diagnostics.report("transport.timeout", t, { endpoint: e }), new N("timeout", t);
|
|
344
|
-
}
|
|
345
|
-
async encodeBody(e) {
|
|
346
|
-
let { config: t } = this;
|
|
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;
|
|
348
|
-
}
|
|
349
|
-
async dispatch(e, t, n, r, i) {
|
|
350
|
-
let { config: a } = this, o = new AbortController(), s = () => {
|
|
351
|
-
o.abort();
|
|
352
|
-
};
|
|
353
|
-
this.cancellation.signal.addEventListener("abort", s, { once: !0 }), this.cancellation.signal.aborted && o.abort();
|
|
354
|
-
let c = setTimeout(() => {
|
|
355
|
-
o.abort();
|
|
356
|
-
}, Math.max(0, r - Date.now()));
|
|
357
|
-
C(c);
|
|
358
|
-
try {
|
|
359
|
-
return await E(() => fetch(e, {
|
|
360
|
-
method: "POST",
|
|
361
|
-
headers: t,
|
|
362
|
-
body: n,
|
|
363
|
-
credentials: a.credentials,
|
|
364
|
-
signal: o.signal,
|
|
365
|
-
cache: "no-store",
|
|
366
|
-
keepalive: i,
|
|
367
|
-
priority: i ? "auto" : a.delivery.priority
|
|
368
|
-
}));
|
|
369
|
-
} catch {
|
|
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.");
|
|
371
|
-
} finally {
|
|
372
|
-
this.cancellation.signal.removeEventListener("abort", s), clearTimeout(c);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
keepalive(e) {
|
|
376
|
-
let t = globalThis.document?.visibilityState === "hidden", n = typeof e == "string" ? O(e) : e.byteLength;
|
|
377
|
-
return t && n <= 6e4;
|
|
378
|
-
}
|
|
379
|
-
async readMaxBytes(e) {
|
|
380
|
-
return this.diagnostics.guardAsync("transport.http_error", "The library could not read the body of the 413 response.", async () => {
|
|
381
|
-
let t = JSON.parse(await e.text());
|
|
382
|
-
return typeof t.maxBytes == "number" ? t.maxBytes : void 0;
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
async resolveHeaders() {
|
|
386
|
-
return q(this, this.config, this.diagnostics);
|
|
387
|
-
}
|
|
388
|
-
}, ce = class {
|
|
389
|
-
storage;
|
|
390
|
-
transport;
|
|
391
|
-
diagnostics;
|
|
392
|
-
config;
|
|
393
|
-
batchesPerDrain;
|
|
394
|
-
onLoss;
|
|
395
|
-
timer = null;
|
|
396
|
-
attempt = 0;
|
|
397
|
-
draining = !1;
|
|
398
|
-
stopped = !1;
|
|
399
|
-
maxAttempts;
|
|
400
|
-
onOnline = () => {
|
|
401
|
-
this.attempt = 0, this.schedule(0);
|
|
402
|
-
};
|
|
403
|
-
constructor(e, t, n, r, i, a = () => void 0) {
|
|
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;
|
|
405
|
-
}
|
|
406
|
-
start() {
|
|
407
|
-
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(this.config.delivery.retryIdleDelayMs);
|
|
408
|
-
}
|
|
409
|
-
nudge() {
|
|
410
|
-
this.draining || this.schedule(this.config.delivery.retryBaseDelayMs);
|
|
411
|
-
}
|
|
412
|
-
async storeFailed(e, t) {
|
|
413
|
-
let n = this.toStorable(e, t);
|
|
414
|
-
for (let e of n) await this.bounded(this.storage.save(e));
|
|
415
|
-
n.length > 0 && this.nudge();
|
|
416
|
-
}
|
|
417
|
-
stop() {
|
|
418
|
-
this.stopped = !0, typeof removeEventListener < "u" && removeEventListener("online", this.onOnline), this.clearTimer();
|
|
419
|
-
}
|
|
420
|
-
async flush() {
|
|
421
|
-
this.stopped = !1;
|
|
422
|
-
try {
|
|
423
|
-
await this.drain();
|
|
424
|
-
} finally {
|
|
425
|
-
this.stop();
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
schedule(e) {
|
|
429
|
-
if (this.stopped) return;
|
|
430
|
-
this.clearTimer();
|
|
431
|
-
let t = setTimeout(() => {
|
|
432
|
-
this.drain();
|
|
433
|
-
}, e);
|
|
434
|
-
this.timer = t, C(t);
|
|
435
|
-
}
|
|
436
|
-
bounded(e) {
|
|
437
|
-
return S(e, t);
|
|
438
|
-
}
|
|
439
|
-
clearTimer() {
|
|
440
|
-
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
441
|
-
}
|
|
442
|
-
backoffMs() {
|
|
443
|
-
let e = Math.min(this.config.delivery.retryBaseDelayMs * 2 ** this.attempt, this.config.delivery.retryMaxDelayMs);
|
|
444
|
-
return Math.random() * e;
|
|
445
|
-
}
|
|
446
|
-
async drain() {
|
|
447
|
-
if (!this.draining) {
|
|
448
|
-
this.draining = !0;
|
|
449
|
-
try {
|
|
450
|
-
let e = b(i, this.config.persistence.namespace);
|
|
451
|
-
await v(e, this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(this.config.delivery.retryIdleDelayMs);
|
|
452
|
-
} finally {
|
|
453
|
-
this.draining = !1;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
async drainLocked() {
|
|
458
|
-
try {
|
|
459
|
-
if (!F()) return this.schedule(this.config.delivery.retryIdleDelayMs), !0;
|
|
460
|
-
let e = await this.bounded(this.storage.take(this.batchesPerDrain ?? this.config.delivery.batchesPerDrain));
|
|
461
|
-
if (e.length === 0) return this.schedule(this.config.delivery.retryIdleDelayMs), !0;
|
|
462
|
-
let t = /* @__PURE__ */ new Set(), n = 0;
|
|
463
|
-
for (let r of e) {
|
|
464
|
-
if (this.stopped) return !0;
|
|
465
|
-
let e = P(r, this.config);
|
|
466
|
-
if (t.has(e)) continue;
|
|
467
|
-
let i = await this.deliver(r);
|
|
468
|
-
if (i === "stop") return !0;
|
|
469
|
-
i !== "next" && (t.add(e), n = Math.max(n, i));
|
|
470
|
-
}
|
|
471
|
-
return t.size > 0 ? this.schedule(n) : this.schedule(e.length === (this.batchesPerDrain ?? this.config.delivery.batchesPerDrain) ? 0 : this.config.delivery.retryIdleDelayMs), !0;
|
|
472
|
-
} catch (e) {
|
|
473
|
-
return this.diagnostics.report("storage.degraded", "The drain loop threw an error.", void 0, e), this.attempt++, this.schedule(this.backoffMs()), !0;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
async deliver(e) {
|
|
477
|
-
if (e.attempts >= this.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `The library dropped a batch after ${e.attempts.toString()} attempts.`, {
|
|
478
|
-
batchId: e.id,
|
|
479
|
-
records: e.records.length
|
|
480
|
-
}), this.onLoss("max_attempts", e.records, [e.id]), await this.bounded(this.storage.remove(e.id)), "next";
|
|
481
|
-
try {
|
|
482
|
-
return await this.transport.send(e), await this.bounded(this.storage.remove(e.id)), this.attempt = 0, "next";
|
|
483
|
-
} catch (t) {
|
|
484
|
-
if (this.stopped) return "stop";
|
|
485
|
-
let n = t instanceof N ? t : void 0;
|
|
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());
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
async replaceStored(e, t) {
|
|
490
|
-
let n = this.toStorable(e, t);
|
|
491
|
-
await this.bounded(this.storage.remove(e.id));
|
|
492
|
-
for (let e of n) await this.bounded(this.storage.save(e));
|
|
493
|
-
}
|
|
494
|
-
toStorable(e, t) {
|
|
495
|
-
let n = t instanceof N ? t : void 0;
|
|
496
|
-
if (n?.kind === "permanent") return this.onLoss("rejected", e.records, [e.id]), [];
|
|
497
|
-
if (n?.kind !== "too_large") return [e];
|
|
498
|
-
let r = re(e, this.diagnostics);
|
|
499
|
-
return r ? (this.diagnostics.report("transport.batch_split", "The server refused the batch because it is too large.", {
|
|
500
|
-
from: e.records.length,
|
|
501
|
-
to: r[0].records.length,
|
|
502
|
-
serverMaxBytes: n.maxBytes
|
|
503
|
-
}), r) : (this.diagnostics.report("transport.dropped_permanent", "One record is larger than the server limit. The library dropped it.", {
|
|
504
|
-
batchId: e.id,
|
|
505
|
-
bodies: e.records.map((e) => e.body)
|
|
506
|
-
}), this.onLoss("rejected", e.records, [e.id]), []);
|
|
507
|
-
}
|
|
508
|
-
}, Z = [
|
|
509
|
-
"metrics",
|
|
510
|
-
"logs",
|
|
511
|
-
"traces"
|
|
512
|
-
];
|
|
513
|
-
function Q(e) {
|
|
514
|
-
let t = e.attributes[c];
|
|
515
|
-
return t === "metric" ? "metrics" : t === "span" ? "traces" : "logs";
|
|
516
|
-
}
|
|
517
|
-
var $ = class {
|
|
518
|
-
options;
|
|
519
|
-
onFlush;
|
|
520
|
-
pending = [];
|
|
521
|
-
timer = null;
|
|
522
|
-
constructor(e, t) {
|
|
523
|
-
this.options = e, this.onFlush = t;
|
|
524
|
-
}
|
|
525
|
-
add(e) {
|
|
526
|
-
this.pending.push(e), this.pending.length >= this.options.batchSize ? this.onFlush(this) : this.arm();
|
|
527
|
-
}
|
|
528
|
-
take() {
|
|
529
|
-
this.clearTimer();
|
|
530
|
-
let e = this.pending;
|
|
531
|
-
return this.pending = [], e;
|
|
532
|
-
}
|
|
533
|
-
get size() {
|
|
534
|
-
return this.pending.length;
|
|
535
|
-
}
|
|
536
|
-
stop() {
|
|
537
|
-
this.clearTimer();
|
|
538
|
-
}
|
|
539
|
-
arm() {
|
|
540
|
-
if (this.timer !== null) return;
|
|
541
|
-
let e = setTimeout(() => {
|
|
542
|
-
this.timer = null, this.onFlush(this);
|
|
543
|
-
}, this.options.flushIntervalMs);
|
|
544
|
-
this.timer = e, C(e);
|
|
545
|
-
}
|
|
546
|
-
clearTimer() {
|
|
547
|
-
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
548
|
-
}
|
|
549
|
-
}, le = class {
|
|
550
|
-
transport;
|
|
551
|
-
storage;
|
|
552
|
-
retry;
|
|
553
|
-
diagnostics;
|
|
554
|
-
routingContextId;
|
|
555
|
-
policy;
|
|
556
|
-
onLoss;
|
|
557
|
-
clockOffset;
|
|
558
|
-
streams;
|
|
559
|
-
unconfirmed = /* @__PURE__ */ new Map();
|
|
560
|
-
queue = [];
|
|
561
|
-
open = /* @__PURE__ */ new Set();
|
|
562
|
-
ceiling = new oe();
|
|
563
|
-
inFlight = 0;
|
|
564
|
-
pumpScheduled = !1;
|
|
565
|
-
stopped = !1;
|
|
566
|
-
held = /* @__PURE__ */ new Map();
|
|
567
|
-
heldBytes = 0;
|
|
568
|
-
persisting = !1;
|
|
569
|
-
release(e) {
|
|
570
|
-
for (let t of e) this.heldBytes -= this.held.get(t) ?? 0, this.held.delete(t);
|
|
571
|
-
}
|
|
572
|
-
evict() {
|
|
573
|
-
let e = this.queue.shift();
|
|
574
|
-
if (e) return this.open.delete(e), this.unconfirmed.delete(e.batch.id), this.release(e.batch.records), e.resolve(), this.onLoss("buffer_full", e.batch.records, [e.batch.id]), !0;
|
|
575
|
-
for (let e of Object.values(this.streams)) {
|
|
576
|
-
let t = e.take();
|
|
577
|
-
if (t.length) return this.release(t), this.onLoss("buffer_full", t), !0;
|
|
578
|
-
}
|
|
579
|
-
return !1;
|
|
580
|
-
}
|
|
581
|
-
admit(e) {
|
|
582
|
-
if (!this.policy) return !0;
|
|
583
|
-
let { maxPendingRecords: t, maxPendingBytes: n, overflow: r } = this.policy.buffering, i;
|
|
584
|
-
try {
|
|
585
|
-
i = O(JSON.stringify(e));
|
|
586
|
-
} catch {
|
|
587
|
-
return this.onLoss("unserializable", [e]), !1;
|
|
588
|
-
}
|
|
589
|
-
let a = () => !!(t && this.held.size >= t || n && this.heldBytes + i > n), o = !n || i <= n;
|
|
590
|
-
for (; o && a() && r === "drop-oldest" && this.evict(););
|
|
591
|
-
if (a()) {
|
|
592
|
-
if (r === "persist" && !this.persisting) {
|
|
593
|
-
this.persisting = !0;
|
|
594
|
-
let t = this.toBatch([e]);
|
|
595
|
-
this.diagnostics.guardAsync("storage.degraded", "Could not persist an overflow record.", async () => {
|
|
596
|
-
try {
|
|
597
|
-
await this.storage.save(t), this.retry.nudge();
|
|
598
|
-
} finally {
|
|
599
|
-
this.persisting = !1;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
} else this.onLoss("buffer_full", [e]);
|
|
603
|
-
return !1;
|
|
604
|
-
}
|
|
605
|
-
return this.held.set(e, i), this.heldBytes += i, !0;
|
|
606
|
-
}
|
|
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) => {
|
|
610
|
-
this.claim(e);
|
|
611
|
-
};
|
|
612
|
-
this.streams = {
|
|
613
|
-
logs: new $(i.logs, l),
|
|
614
|
-
metrics: new $(i.metrics, l),
|
|
615
|
-
traces: new $(i.traces, l)
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
push(e) {
|
|
619
|
-
if (this.stopped) return;
|
|
620
|
-
e.observedTimeUnixNano = ie();
|
|
621
|
-
let t = { ...e };
|
|
622
|
-
this.admit(t) && this.route(t);
|
|
623
|
-
}
|
|
624
|
-
drainForExit() {
|
|
625
|
-
let e = [...this.unconfirmed.values()].flatMap((e) => e.records);
|
|
626
|
-
return this.unconfirmed.clear(), this.held.clear(), this.heldBytes = 0, Z.map((t) => this.toBatch([...e.filter((e) => Q(e) === t), ...this.streams[t].take()])).filter((e) => e !== null);
|
|
627
|
-
}
|
|
628
|
-
async flushPending() {
|
|
629
|
-
if (!this.stopped) for (let e of Z) this.claim(this.streams[e]);
|
|
630
|
-
await Promise.all([...this.open].map((e) => e.done));
|
|
631
|
-
}
|
|
632
|
-
counts() {
|
|
633
|
-
let e = (e) => {
|
|
634
|
-
let t = 0;
|
|
635
|
-
for (let n of e) t += n.batch.records.length;
|
|
636
|
-
return t;
|
|
637
|
-
}, t = e(this.queue);
|
|
638
|
-
return {
|
|
639
|
-
pending: Z.reduce((e, t) => e + this.streams[t].size, 0) + t,
|
|
640
|
-
inFlight: e(this.open) - t
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
destroy() {
|
|
644
|
-
this.stopped = !0, this.held.clear(), this.heldBytes = 0;
|
|
645
|
-
for (let e of Z) this.streams[e].stop();
|
|
646
|
-
this.queue.length = 0;
|
|
647
|
-
for (let e of this.open) e.resolve();
|
|
648
|
-
this.open.clear();
|
|
649
|
-
}
|
|
650
|
-
toBatch(e) {
|
|
651
|
-
return e.length === 0 ? null : {
|
|
652
|
-
id: ae(this.diagnostics),
|
|
653
|
-
records: e,
|
|
654
|
-
createdAt: Date.now(),
|
|
655
|
-
attempts: 0,
|
|
656
|
-
routingContextId: this.routingContextId?.(),
|
|
657
|
-
persistenceNamespace: this.policy?.persistence.namespace
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
route(e) {
|
|
661
|
-
try {
|
|
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)) {
|
|
664
|
-
this.release([e]), this.diagnostics.count("record.dropped_by_ceiling");
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
let r = this.clockOffset();
|
|
668
|
-
r !== void 0 && t !== "metrics" && (e.attributes = {
|
|
669
|
-
...e.attributes,
|
|
670
|
-
[l]: r
|
|
671
|
-
}), n.add(e);
|
|
672
|
-
} catch (e) {
|
|
673
|
-
this.diagnostics.report("pipeline.crashed", "The pipeline dropped a record before it reached a stream.", void 0, e);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
claim(e) {
|
|
677
|
-
this.enqueue(this.toBatch(e.take()));
|
|
678
|
-
}
|
|
679
|
-
enqueue(e) {
|
|
680
|
-
if (!e) return;
|
|
681
|
-
let t, n = {
|
|
682
|
-
batch: e,
|
|
683
|
-
done: new Promise((e) => {
|
|
684
|
-
t = e;
|
|
685
|
-
}),
|
|
686
|
-
resolve: t
|
|
687
|
-
};
|
|
688
|
-
this.unconfirmed.set(e.id, e), this.open.add(n), this.queue.push(n), this.pumpScheduled || (this.pumpScheduled = !0, queueMicrotask(() => {
|
|
689
|
-
this.pumpScheduled = !1, this.pump();
|
|
690
|
-
}));
|
|
691
|
-
}
|
|
692
|
-
pump() {
|
|
693
|
-
if (!this.stopped) for (; this.inFlight < (this.policy?.delivery.maxConcurrentRequests ?? 2);) {
|
|
694
|
-
let e = this.queue.shift();
|
|
695
|
-
if (!e) return;
|
|
696
|
-
this.inFlight++, this.run(e);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
async run(e) {
|
|
700
|
-
let { batch: t } = e;
|
|
701
|
-
try {
|
|
702
|
-
await this.dispatch(t);
|
|
703
|
-
} catch (e) {
|
|
704
|
-
this.diagnostics.report("pipeline.crashed", "A dispatch rejected its promise. This must not occur.", { batchId: t.id }, e);
|
|
705
|
-
} finally {
|
|
706
|
-
this.release(t.records), this.inFlight--, this.open.delete(e), e.resolve(), this.pump();
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
async dispatch(e) {
|
|
710
|
-
try {
|
|
711
|
-
let t = this.transport.throttledForMs(e);
|
|
712
|
-
if (t > 0) {
|
|
713
|
-
await this.store(e), this.diagnostics.report("transport.throttled", "The server throttles requests. The pipeline stored the batch and did not send it.", {
|
|
714
|
-
batchId: e.id,
|
|
715
|
-
records: e.records.length,
|
|
716
|
-
throttledMs: t
|
|
717
|
-
});
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
try {
|
|
721
|
-
await this.transport.send(e, () => {
|
|
722
|
-
this.unconfirmed.delete(e.id);
|
|
723
|
-
});
|
|
724
|
-
} catch (t) {
|
|
725
|
-
if (this.stopped) return;
|
|
726
|
-
await this.storeFailed({
|
|
727
|
-
...e,
|
|
728
|
-
attempts: e.attempts + 1
|
|
729
|
-
}, t), this.diagnostics.report("transport.http_error", "The send failed. The pipeline stored the batch for a retry.", {
|
|
730
|
-
batchId: e.id,
|
|
731
|
-
records: e.records.length
|
|
732
|
-
}, t);
|
|
733
|
-
}
|
|
734
|
-
} finally {
|
|
735
|
-
this.unconfirmed.delete(e.id);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
async storeFailed(e, t) {
|
|
739
|
-
await this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", async () => {
|
|
740
|
-
await this.retry.storeFailed(e, t);
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
async store(e) {
|
|
744
|
-
await this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", async () => {
|
|
745
|
-
await S(this.storage.save(e), t), this.retry.nudge();
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}, ue = class e {
|
|
749
|
-
storage;
|
|
750
|
-
retry;
|
|
751
|
-
pipeline;
|
|
752
|
-
exitFlush;
|
|
753
|
-
diagnostics;
|
|
754
|
-
transport;
|
|
755
|
-
retired = !1;
|
|
756
|
-
emergencyImport = Promise.resolve();
|
|
757
|
-
constructor(e, t, n, r, i, a) {
|
|
758
|
-
this.storage = e, this.retry = t, this.pipeline = n, this.exitFlush = r, this.diagnostics = i, this.transport = a;
|
|
759
|
-
}
|
|
760
|
-
static async create(t) {
|
|
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, {
|
|
769
|
-
logs: {
|
|
770
|
-
flushIntervalMs: m.logFlushIntervalMs,
|
|
771
|
-
batchSize: m.logBatchSize
|
|
772
|
-
},
|
|
773
|
-
metrics: {
|
|
774
|
-
flushIntervalMs: m.metricFlushIntervalMs,
|
|
775
|
-
batchSize: m.metricBatchSize
|
|
776
|
-
},
|
|
777
|
-
traces: {
|
|
778
|
-
flushIntervalMs: m.logFlushIntervalMs,
|
|
779
|
-
batchSize: m.logBatchSize
|
|
780
|
-
}
|
|
781
|
-
}, () => n.securityContext.id || void 0, n, l, () => n.metadata.clockOffset ? s : void 0), _ = new G({
|
|
782
|
-
config: n,
|
|
783
|
-
diagnostics: r,
|
|
784
|
-
drainForExit: () => g.drainForExit(),
|
|
785
|
-
flushAlive: () => g.flushPending(),
|
|
786
|
-
exitHeaders: () => u ? u.exitHeaders() : d?.lastHeaders(),
|
|
787
|
-
onLoss: l,
|
|
788
|
-
beforeExit: t.beforeExit
|
|
789
|
-
}), v = !1;
|
|
790
|
-
try {
|
|
791
|
-
_.install(), p.start(), v = !0;
|
|
792
|
-
} finally {
|
|
793
|
-
v || (_.uninstall(), p.stop());
|
|
794
|
-
}
|
|
795
|
-
let y = new e(a, p, g, _, r, f);
|
|
796
|
-
return y.emergencyImport = y.importEmergency(), y;
|
|
797
|
-
}
|
|
798
|
-
push(e) {
|
|
799
|
-
this.pipeline.push(e);
|
|
800
|
-
}
|
|
801
|
-
async flush() {
|
|
802
|
-
await this.pipeline.flushPending();
|
|
803
|
-
}
|
|
804
|
-
async clearPersisted(e, t) {
|
|
805
|
-
e === "namespace" ? await this.storage.clearNamespace() : await this.storage.clear(), g(t, this.diagnostics, this.storage.namespace, e === "namespace");
|
|
806
|
-
}
|
|
807
|
-
async queueDepth() {
|
|
808
|
-
return await this.diagnostics.guardAsync("storage.degraded", "The library could not count the batches in storage.", () => this.storage.count()) ?? 0;
|
|
809
|
-
}
|
|
810
|
-
stats() {
|
|
811
|
-
return {
|
|
812
|
-
...this.pipeline.counts(),
|
|
813
|
-
lastSendAt: this.transport.lastSendAt()
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
async destroy() {
|
|
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();
|
|
818
|
-
}
|
|
819
|
-
async retire(e, t, n) {
|
|
820
|
-
if (this.retired = !0, this.exitFlush.uninstall(), this.retry.stop(), e === "flush") try {
|
|
821
|
-
await S(Promise.all([this.flush(), this.retry.flush()]), t);
|
|
822
|
-
} catch (e) {
|
|
823
|
-
this.diagnostics.report("transport.timeout", "The flush of the old security context did not complete before its time limit.", void 0, e);
|
|
824
|
-
}
|
|
825
|
-
this.retry.stop(), this.transport.stop();
|
|
826
|
-
let r = this.pipeline.drainForExit(), i = r.flatMap((e) => e.records);
|
|
827
|
-
this.pipeline.destroy(), await this.emergencyImport;
|
|
828
|
-
let a = await this.storage.take(2 ** 53 - 1);
|
|
829
|
-
if (e === "retain") for (let e of r) await this.storage.save({
|
|
830
|
-
...e,
|
|
831
|
-
routingContextId: n,
|
|
832
|
-
persistenceNamespace: this.storage.namespace
|
|
833
|
-
});
|
|
834
|
-
let o = e === "discard" || e === "flush";
|
|
835
|
-
return await this.storage.retire(o), o && g(n, this.diagnostics, this.storage.namespace), {
|
|
836
|
-
buffered: i,
|
|
837
|
-
stored: a
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
async adopt(e, t) {
|
|
841
|
-
for (let n of e) await this.storage.save({
|
|
842
|
-
...n,
|
|
843
|
-
attempts: 0,
|
|
844
|
-
routingContextId: t,
|
|
845
|
-
persistenceNamespace: this.storage.namespace
|
|
846
|
-
});
|
|
847
|
-
e.length > 0 && this.retry.nudge();
|
|
848
|
-
}
|
|
849
|
-
async importEmergency() {
|
|
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));
|
|
851
|
-
!this.retired && e !== void 0 && e > 0 && this.retry.nudge();
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
export { ue as Sender, B as a, q as i, X as n, J as r, Y as t };
|
|
855
|
-
|
|
856
|
-
//# sourceMappingURL=sender-CiMHC9YG.js.map
|