@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "../models/config.cjs";
|
|
2
|
+
import type { LogLevel, LogRecord } from "../models/log-record.cjs";
|
|
3
|
+
import type { RemoteRules } from "./remote-sampling.cjs";
|
|
4
|
+
/** Value of the longest prefix that matches a namespace. */
|
|
5
|
+
interface PrefixMatch<T> {
|
|
6
|
+
/** The prefix's value, for example a rate or a level. */
|
|
7
|
+
value: T;
|
|
8
|
+
/** Length of the prefix. */
|
|
9
|
+
length: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Finds the longest prefix in a map that matches a namespace.
|
|
13
|
+
* For example, trading.ticks overrides trading.
|
|
14
|
+
* @param namespace Target application namespace.
|
|
15
|
+
* @param values Value for each namespace prefix.
|
|
16
|
+
* @returns The match, or undefined if no prefix matches.
|
|
17
|
+
*/
|
|
18
|
+
export declare function longestPrefix<T>(namespace: string, values: Record<string, T>): PrefixMatch<T> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Finds a namespace's minimum level in the config. The longest matching prefix in
|
|
21
|
+
* `minLevels` wins, and a namespace with no match uses `minLevel`.
|
|
22
|
+
* @param namespace Target application namespace.
|
|
23
|
+
* @param config Active configuration instance.
|
|
24
|
+
* @returns The namespace's minimum level.
|
|
25
|
+
*/
|
|
26
|
+
export declare function levelFor(namespace: string, config: ResolvedConfig): LogLevel;
|
|
27
|
+
/**
|
|
28
|
+
* Decides whether sampling keeps a key at a rate. The same key always gets the same result.
|
|
29
|
+
* @param key Journey ID or trace ID.
|
|
30
|
+
* @param rate Sampling rate, 0..1.
|
|
31
|
+
* @returns True if sampling keeps the key.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sampleKey(key: string, rate: number): boolean;
|
|
34
|
+
/** Fields that sampling reads. The caller knows all of them before it builds a record. */
|
|
35
|
+
export interface SampleInput {
|
|
36
|
+
/** Severity level of the entry. */
|
|
37
|
+
level: string;
|
|
38
|
+
/** Telemetry type classification. */
|
|
39
|
+
type: string;
|
|
40
|
+
/** Originating application namespace. */
|
|
41
|
+
namespace: string;
|
|
42
|
+
/** Active journey ID. Empty when no journey is running. */
|
|
43
|
+
journeyId: string;
|
|
44
|
+
/** Trace ID. Used as the sampling key when no journey is running. */
|
|
45
|
+
traceId: string;
|
|
46
|
+
/** True for a counter or histogram point. Sampling a sum would give a false sum. */
|
|
47
|
+
aggregated?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Decides whether sampling keeps an entry. Reads fields, not a record, so the caller can
|
|
51
|
+
* drop an entry before the attribute walk runs.
|
|
52
|
+
* @param input Fields the sampling decision reads.
|
|
53
|
+
* @param config Active configuration instance.
|
|
54
|
+
* @param remote Current remote rules, or null.
|
|
55
|
+
* @returns True if the runtime keeps and sends the entry.
|
|
56
|
+
*/
|
|
57
|
+
export declare function shouldSampleInput(input: SampleInput, config: ResolvedConfig, remote: RemoteRules | null): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Decides whether sampling keeps a built log record. The runtime uses it for records
|
|
60
|
+
* that a child context sends over the bus.
|
|
61
|
+
* @param record Record to evaluate.
|
|
62
|
+
* @param config Active configuration instance.
|
|
63
|
+
* @param remote Current remote rules, or null.
|
|
64
|
+
* @returns True if the runtime keeps and sends the record.
|
|
65
|
+
*/
|
|
66
|
+
export declare function shouldSample(record: LogRecord, config: ResolvedConfig, remote?: RemoteRules | null): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Puts a fixed-window limit on the records that bypass sampling because of their level.
|
|
69
|
+
*
|
|
70
|
+
* ErrorCapture already limits auto-captured errors. This class covers what is left, for
|
|
71
|
+
* example application code that calls logger.error in a render loop.
|
|
72
|
+
*/
|
|
73
|
+
export declare class ErrorCeiling {
|
|
74
|
+
/** Records at or above the threshold level admitted in the current window. */
|
|
75
|
+
private readonly window;
|
|
76
|
+
/**
|
|
77
|
+
* Checks a record against the limit. Only records at or above `from` are counted.
|
|
78
|
+
* @param record Record about to enter a stream.
|
|
79
|
+
* @param limit Maximum records in one window. 0 allows none, and null means no limit.
|
|
80
|
+
* @param windowMs Rate limit window, in milliseconds.
|
|
81
|
+
* @param from Lowest level that bypasses sampling.
|
|
82
|
+
* @returns False when the window has no allowance left. The caller must drop the record.
|
|
83
|
+
*/
|
|
84
|
+
allow(record: LogRecord, limit?: number | null, windowMs?: number, from?: LogLevel): boolean;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
package/dist/core/sampling.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ResolvedConfig } from "../models/config";
|
|
2
|
-
import type { LogLevel, LogRecord } from "../models/log-record";
|
|
3
|
-
import type { RemoteRules } from "./remote-sampling";
|
|
1
|
+
import type { ResolvedConfig } from "../models/config.js";
|
|
2
|
+
import type { LogLevel, LogRecord } from "../models/log-record.js";
|
|
3
|
+
import type { RemoteRules } from "./remote-sampling.js";
|
|
4
4
|
/** Value of the longest prefix that matches a namespace. */
|
|
5
5
|
interface PrefixMatch<T> {
|
|
6
|
-
/**
|
|
6
|
+
/** The prefix's value, for example a rate or a level. */
|
|
7
7
|
value: T;
|
|
8
8
|
/** Length of the prefix. */
|
|
9
9
|
length: number;
|
|
@@ -17,15 +17,15 @@ interface PrefixMatch<T> {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function longestPrefix<T>(namespace: string, values: Record<string, T>): PrefixMatch<T> | undefined;
|
|
19
19
|
/**
|
|
20
|
-
* Finds
|
|
21
|
-
* `minLevels` wins
|
|
20
|
+
* Finds a namespace's minimum level in the config. The longest matching prefix in
|
|
21
|
+
* `minLevels` wins, and a namespace with no match uses `minLevel`.
|
|
22
22
|
* @param namespace Target application namespace.
|
|
23
23
|
* @param config Active configuration instance.
|
|
24
|
-
* @returns The minimum level
|
|
24
|
+
* @returns The namespace's minimum level.
|
|
25
25
|
*/
|
|
26
26
|
export declare function levelFor(namespace: string, config: ResolvedConfig): LogLevel;
|
|
27
27
|
/**
|
|
28
|
-
* Decides
|
|
28
|
+
* Decides whether sampling keeps a key at a rate. The same key always gets the same result.
|
|
29
29
|
* @param key Journey ID or trace ID.
|
|
30
30
|
* @param rate Sampling rate, 0..1.
|
|
31
31
|
* @returns True if sampling keeps the key.
|
|
@@ -39,48 +39,48 @@ export interface SampleInput {
|
|
|
39
39
|
type: string;
|
|
40
40
|
/** Originating application namespace. */
|
|
41
41
|
namespace: string;
|
|
42
|
-
/** Active journey ID.
|
|
42
|
+
/** Active journey ID. Empty when no journey is running. */
|
|
43
43
|
journeyId: string;
|
|
44
|
-
/** Trace ID.
|
|
44
|
+
/** Trace ID. Used as the sampling key when no journey is running. */
|
|
45
45
|
traceId: string;
|
|
46
|
-
/** True for a
|
|
46
|
+
/** True for a counter or histogram point. Sampling a sum would give a false sum. */
|
|
47
47
|
aggregated?: boolean;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Decides
|
|
51
|
-
*
|
|
50
|
+
* Decides whether sampling keeps an entry. Reads fields, not a record, so the caller can
|
|
51
|
+
* drop an entry before the attribute walk runs.
|
|
52
52
|
* @param input Fields the sampling decision reads.
|
|
53
53
|
* @param config Active configuration instance.
|
|
54
|
-
* @param remote
|
|
54
|
+
* @param remote Current remote rules, or null.
|
|
55
55
|
* @returns True if the runtime keeps and sends the entry.
|
|
56
56
|
*/
|
|
57
57
|
export declare function shouldSampleInput(input: SampleInput, config: ResolvedConfig, remote: RemoteRules | null): boolean;
|
|
58
58
|
/**
|
|
59
|
-
* Decides
|
|
59
|
+
* Decides whether sampling keeps a built log record. The runtime uses it for records
|
|
60
60
|
* that a child context sends over the bus.
|
|
61
61
|
* @param record Record to evaluate.
|
|
62
62
|
* @param config Active configuration instance.
|
|
63
|
-
* @param remote
|
|
63
|
+
* @param remote Current remote rules, or null.
|
|
64
64
|
* @returns True if the runtime keeps and sends the record.
|
|
65
65
|
*/
|
|
66
66
|
export declare function shouldSample(record: LogRecord, config: ResolvedConfig, remote?: RemoteRules | null): boolean;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Puts a fixed-window limit on the records that bypass sampling because of their level.
|
|
69
69
|
*
|
|
70
|
-
* ErrorCapture already limits auto-captured errors. This class
|
|
71
|
-
*
|
|
70
|
+
* ErrorCapture already limits auto-captured errors. This class covers what is left, for
|
|
71
|
+
* example application code that calls logger.error in a render loop.
|
|
72
72
|
*/
|
|
73
73
|
export declare class ErrorCeiling {
|
|
74
74
|
/** Records at or above the threshold level admitted in the current window. */
|
|
75
75
|
private readonly window;
|
|
76
76
|
/**
|
|
77
|
-
* Checks a record against the limit.
|
|
77
|
+
* Checks a record against the limit. Only records at or above `from` are counted.
|
|
78
78
|
* @param record Record about to enter a stream.
|
|
79
|
-
* @param limit Maximum records in one window.
|
|
79
|
+
* @param limit Maximum records in one window. 0 allows none, and null means no limit.
|
|
80
80
|
* @param windowMs Rate limit window, in milliseconds.
|
|
81
81
|
* @param from Lowest level that bypasses sampling.
|
|
82
82
|
* @returns False when the window has no allowance left. The caller must drop the record.
|
|
83
83
|
*/
|
|
84
|
-
allow(record: LogRecord, limit?: number, windowMs?: number, from?: LogLevel): boolean;
|
|
84
|
+
allow(record: LogRecord, limit?: number | null, windowMs?: number, from?: LogLevel): boolean;
|
|
85
85
|
}
|
|
86
86
|
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { LogBatch } from "../models/batch.cjs";
|
|
2
|
+
import type { ResolvedConfig } from "../models/config.cjs";
|
|
3
|
+
import type { LossReporter } from "../models/drop.cjs";
|
|
4
|
+
import type { DeliveryHealth } from "../models/health.cjs";
|
|
5
|
+
import type { LogRecord } from "../models/log-record.cjs";
|
|
6
|
+
import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage.cjs";
|
|
7
|
+
import type { Diagnostics } from "./diagnostics.cjs";
|
|
8
|
+
import { type FlushCounts } from "./pipeline.cjs";
|
|
9
|
+
import type { RemoteSlot } from "./remote-sampling.cjs";
|
|
10
|
+
/** Inputs to build the delivery stack. */
|
|
11
|
+
export interface SenderDeps {
|
|
12
|
+
/** Memory store that this runtime keeps when the security context changes. */
|
|
13
|
+
storage?: StorageAdapter;
|
|
14
|
+
onStorage?: (storage: StorageAdapter) => void;
|
|
15
|
+
/** Receives the state of the persistent-storage request. */
|
|
16
|
+
onPersistence?: (state: StoragePersistence) => void;
|
|
17
|
+
/** Active configuration instance. */
|
|
18
|
+
config: ResolvedConfig;
|
|
19
|
+
/** Diagnostics reporter. */
|
|
20
|
+
diagnostics: Diagnostics;
|
|
21
|
+
/** Receives a report when storage drops batches before delivery. */
|
|
22
|
+
onGap: GapReporter;
|
|
23
|
+
/** Receives the records lost by the transport, the retry engine and the exit flush. */
|
|
24
|
+
onLoss: LossReporter;
|
|
25
|
+
/** The runtime's slot for the sampling rules from the ingest server. */
|
|
26
|
+
remote: RemoteSlot;
|
|
27
|
+
/** Sends the open metric interval's points before the exit flush drains the buffers. */
|
|
28
|
+
beforeExit?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Receives the time of the last accepted batch after a send. The runtime keeps it across a
|
|
31
|
+
* rotation, which builds a new sender.
|
|
32
|
+
*/
|
|
33
|
+
onSent?: (at: number) => void;
|
|
34
|
+
}
|
|
35
|
+
/** What the sender adds to getHealth().delivery. The runtime adds the rest. */
|
|
36
|
+
export type SenderStats = Pick<DeliveryHealth, "pending" | "inFlight" | "lastFailureAt" | "consecutiveFailures" | "throttledUntil">;
|
|
37
|
+
/** Delivery stack for one sender runtime. */
|
|
38
|
+
export declare class Sender {
|
|
39
|
+
private readonly storage;
|
|
40
|
+
private readonly retry;
|
|
41
|
+
private readonly pipeline;
|
|
42
|
+
private readonly exitFlush;
|
|
43
|
+
private readonly diagnostics;
|
|
44
|
+
private readonly transport;
|
|
45
|
+
private readonly outcomes;
|
|
46
|
+
/** True after retire(), so a late emergency import doesn't wake the retry engine. */
|
|
47
|
+
private retired;
|
|
48
|
+
/** Emergency queue import. retire() waits for it before reading storage. */
|
|
49
|
+
private emergencyImport;
|
|
50
|
+
/**
|
|
51
|
+
* @param storage Storage adapter for undelivered batches.
|
|
52
|
+
* @param retry Retry engine for stored batches.
|
|
53
|
+
* @param pipeline Pipeline that batches records.
|
|
54
|
+
* @param exitFlush Handler that sends pending records on unload.
|
|
55
|
+
* @param diagnostics Diagnostics reporter.
|
|
56
|
+
* @param transport The transport that the pipeline and the retry engine use.
|
|
57
|
+
* @param outcomes Counts the failed sends of the pipeline and the retry engine.
|
|
58
|
+
*/
|
|
59
|
+
private constructor();
|
|
60
|
+
/**
|
|
61
|
+
* Builds the delivery stack and starts the retry loop. The emergency queue import runs
|
|
62
|
+
* after the start, so a slow IndexedDB open doesn't hold up the boot buffer.
|
|
63
|
+
* @param deps Configuration, diagnostics and gap reporter.
|
|
64
|
+
* @returns Promise that resolves to the started sender.
|
|
65
|
+
*/
|
|
66
|
+
static create(deps: SenderDeps): Promise<Sender>;
|
|
67
|
+
/**
|
|
68
|
+
* Adds a record to the pipeline.
|
|
69
|
+
* @param record Record to deliver.
|
|
70
|
+
*/
|
|
71
|
+
push(record: LogRecord): void;
|
|
72
|
+
/**
|
|
73
|
+
* Stops every send while `enabled` is false, or starts again. The records stay in memory and
|
|
74
|
+
* the stored batches stay in storage, so they go out after the pause.
|
|
75
|
+
* @param on True to stop.
|
|
76
|
+
*/
|
|
77
|
+
hold(on: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* Lists the records that only memory holds. Nothing sends them during a pause.
|
|
80
|
+
* @returns The pipeline's records.
|
|
81
|
+
*/
|
|
82
|
+
records(): LogRecord[];
|
|
83
|
+
/**
|
|
84
|
+
* Sends the records in the stream buffers, then waits for every batch in flight.
|
|
85
|
+
* @returns Promise that resolves once the pipeline has sent or stored every batch.
|
|
86
|
+
*/
|
|
87
|
+
flush(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Sends the records in the stream buffers, then waits for this call's batches until each one
|
|
90
|
+
* ends or the deadline passes.
|
|
91
|
+
* @param expired Resolves at the caller's deadline.
|
|
92
|
+
* @returns The records of the call's batches by their state when the wait ends.
|
|
93
|
+
*/
|
|
94
|
+
flushUntil(expired: Promise<void>): Promise<FlushCounts>;
|
|
95
|
+
/**
|
|
96
|
+
* Counts the batches held in storage.
|
|
97
|
+
* @returns Promise that resolves to the batch count, or 0 if storage fails.
|
|
98
|
+
*/
|
|
99
|
+
queueDepth(): Promise<number>;
|
|
100
|
+
/**
|
|
101
|
+
* Reads the delivery state of the pipeline and the transport.
|
|
102
|
+
* @returns Waiting records, records in requests, the failures and the throttle end.
|
|
103
|
+
*/
|
|
104
|
+
stats(): SenderStats;
|
|
105
|
+
/**
|
|
106
|
+
* Sends pending records with a normal flush, then with the exit flush, then stops all
|
|
107
|
+
* timers and listeners and closes storage. The normal flush keeps the headers, gzip and
|
|
108
|
+
* the retry. The exit flush picks up the records the normal flush didn't confirm.
|
|
109
|
+
* @returns Promise that resolves when storage closes.
|
|
110
|
+
*/
|
|
111
|
+
destroy(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Stops every send without a flush or an exit flush, for a discard at shutdown. A request in
|
|
114
|
+
* flight can still reach the server, but its result writes nothing and schedules no retry,
|
|
115
|
+
* because the store accepts no write after this.
|
|
116
|
+
* @returns Promise that resolves to the records in the buffers and the queue, once the
|
|
117
|
+
* emergency import is done and the store is closed.
|
|
118
|
+
*/
|
|
119
|
+
discard(): Promise<LogRecord[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Stops every send after a rotation fails, and stores the records from memory under the old
|
|
122
|
+
* id. The store stays open, so the next rotation that succeeds can apply its rule to them.
|
|
123
|
+
* @param contextId Identity of the closed delivery context.
|
|
124
|
+
* @returns Promise that resolves once the records are stored.
|
|
125
|
+
*/
|
|
126
|
+
pause(contextId: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Stores whole batches under a context id. One batch per record would fill
|
|
129
|
+
* retention.maxBatches.
|
|
130
|
+
* @param batches Batches from the pipeline.
|
|
131
|
+
* @param contextId Identity of their delivery context.
|
|
132
|
+
* @returns Promise that resolves once each batch is stored.
|
|
133
|
+
*/
|
|
134
|
+
private keep;
|
|
135
|
+
/**
|
|
136
|
+
* Stops this sender before a new delivery identity takes effect. Does not run exit delivery.
|
|
137
|
+
* @param policy Rule for the old records.
|
|
138
|
+
* @param timeoutMs Maximum wait for a flush, in milliseconds.
|
|
139
|
+
* @param contextId Identity of the old delivery context.
|
|
140
|
+
* @returns The records that were in memory and the batches that were stored, after the
|
|
141
|
+
* delivery attempt.
|
|
142
|
+
*/
|
|
143
|
+
retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
|
|
144
|
+
buffered: LogRecord[];
|
|
145
|
+
stored: LogBatch[];
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Stores an earlier context's batches under this context, and the retry engine then sends
|
|
149
|
+
* them. They don't go through the live buffer, because a large backlog would exceed its
|
|
150
|
+
* budget.
|
|
151
|
+
* @param batches The earlier context's stored batches.
|
|
152
|
+
* @param contextId Identity of this delivery context.
|
|
153
|
+
* @returns Promise that resolves when the batches are stored.
|
|
154
|
+
*/
|
|
155
|
+
adopt(batches: readonly LogBatch[], contextId: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Moves the emergency queue's batches into storage, then wakes the retry engine.
|
|
158
|
+
* The previous page load parked them during its unload.
|
|
159
|
+
*/
|
|
160
|
+
private importEmergency;
|
|
161
|
+
}
|
package/dist/core/sender.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type { LogBatch } from "../models/batch";
|
|
2
|
-
import type { ResolvedConfig } from "../models/config";
|
|
3
|
-
import type { LossReporter } from "../models/drop";
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage";
|
|
7
|
-
import type { Diagnostics } from "./diagnostics";
|
|
8
|
-
import type
|
|
1
|
+
import type { LogBatch } from "../models/batch.js";
|
|
2
|
+
import type { ResolvedConfig } from "../models/config.js";
|
|
3
|
+
import type { LossReporter } from "../models/drop.js";
|
|
4
|
+
import type { DeliveryHealth } from "../models/health.js";
|
|
5
|
+
import type { LogRecord } from "../models/log-record.js";
|
|
6
|
+
import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage.js";
|
|
7
|
+
import type { Diagnostics } from "./diagnostics.js";
|
|
8
|
+
import { type FlushCounts } from "./pipeline.js";
|
|
9
|
+
import type { RemoteSlot } from "./remote-sampling.js";
|
|
9
10
|
/** Inputs to build the delivery stack. */
|
|
10
11
|
export interface SenderDeps {
|
|
11
12
|
/** Memory store that this runtime keeps when the security context changes. */
|
|
12
13
|
storage?: StorageAdapter;
|
|
13
14
|
onStorage?: (storage: StorageAdapter) => void;
|
|
14
|
-
/** Receives the state of the
|
|
15
|
+
/** Receives the state of the persistent-storage request. */
|
|
15
16
|
onPersistence?: (state: StoragePersistence) => void;
|
|
16
17
|
/** Active configuration instance. */
|
|
17
18
|
config: ResolvedConfig;
|
|
@@ -19,13 +20,20 @@ export interface SenderDeps {
|
|
|
19
20
|
diagnostics: Diagnostics;
|
|
20
21
|
/** Receives a report when storage drops batches before delivery. */
|
|
21
22
|
onGap: GapReporter;
|
|
22
|
-
/** Receives the records
|
|
23
|
+
/** Receives the records lost by the transport, the retry engine and the exit flush. */
|
|
23
24
|
onLoss: LossReporter;
|
|
24
|
-
/**
|
|
25
|
+
/** The runtime's slot for the sampling rules from the ingest server. */
|
|
25
26
|
remote: RemoteSlot;
|
|
26
|
-
/** Sends the
|
|
27
|
+
/** Sends the open metric interval's points before the exit flush drains the buffers. */
|
|
27
28
|
beforeExit?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Receives the time of the last accepted batch after a send. The runtime keeps it across a
|
|
31
|
+
* rotation, which builds a new sender.
|
|
32
|
+
*/
|
|
33
|
+
onSent?: (at: number) => void;
|
|
28
34
|
}
|
|
35
|
+
/** What the sender adds to getHealth().delivery. The runtime adds the rest. */
|
|
36
|
+
export type SenderStats = Pick<DeliveryHealth, "pending" | "inFlight" | "lastFailureAt" | "consecutiveFailures" | "throttledUntil">;
|
|
29
37
|
/** Delivery stack for one sender runtime. */
|
|
30
38
|
export declare class Sender {
|
|
31
39
|
private readonly storage;
|
|
@@ -34,9 +42,10 @@ export declare class Sender {
|
|
|
34
42
|
private readonly exitFlush;
|
|
35
43
|
private readonly diagnostics;
|
|
36
44
|
private readonly transport;
|
|
37
|
-
|
|
45
|
+
private readonly outcomes;
|
|
46
|
+
/** True after retire(), so a late emergency import doesn't wake the retry engine. */
|
|
38
47
|
private retired;
|
|
39
|
-
/** Emergency queue import. retire() waits for it before
|
|
48
|
+
/** Emergency queue import. retire() waits for it before reading storage. */
|
|
40
49
|
private emergencyImport;
|
|
41
50
|
/**
|
|
42
51
|
* @param storage Storage adapter for undelivered batches.
|
|
@@ -44,12 +53,13 @@ export declare class Sender {
|
|
|
44
53
|
* @param pipeline Pipeline that batches records.
|
|
45
54
|
* @param exitFlush Handler that sends pending records on unload.
|
|
46
55
|
* @param diagnostics Diagnostics reporter.
|
|
47
|
-
* @param transport
|
|
56
|
+
* @param transport The transport that the pipeline and the retry engine use.
|
|
57
|
+
* @param outcomes Counts the failed sends of the pipeline and the retry engine.
|
|
48
58
|
*/
|
|
49
59
|
private constructor();
|
|
50
60
|
/**
|
|
51
61
|
* Builds the delivery stack and starts the retry loop. The emergency queue import runs
|
|
52
|
-
* after the start
|
|
62
|
+
* after the start, so a slow IndexedDB open doesn't hold up the boot buffer.
|
|
53
63
|
* @param deps Configuration, diagnostics and gap reporter.
|
|
54
64
|
* @returns Promise that resolves to the started sender.
|
|
55
65
|
*/
|
|
@@ -60,17 +70,28 @@ export declare class Sender {
|
|
|
60
70
|
*/
|
|
61
71
|
push(record: LogRecord): void;
|
|
62
72
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
73
|
+
* Stops every send while `enabled` is false, or starts again. The records stay in memory and
|
|
74
|
+
* the stored batches stay in storage, so they go out after the pause.
|
|
75
|
+
* @param on True to stop.
|
|
76
|
+
*/
|
|
77
|
+
hold(on: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* Lists the records that only memory holds. Nothing sends them during a pause.
|
|
80
|
+
* @returns The pipeline's records.
|
|
81
|
+
*/
|
|
82
|
+
records(): LogRecord[];
|
|
83
|
+
/**
|
|
84
|
+
* Sends the records in the stream buffers, then waits for every batch in flight.
|
|
85
|
+
* @returns Promise that resolves once the pipeline has sent or stored every batch.
|
|
65
86
|
*/
|
|
66
87
|
flush(): Promise<void>;
|
|
67
88
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param
|
|
71
|
-
* @returns
|
|
89
|
+
* Sends the records in the stream buffers, then waits for this call's batches until each one
|
|
90
|
+
* ends or the deadline passes.
|
|
91
|
+
* @param expired Resolves at the caller's deadline.
|
|
92
|
+
* @returns The records of the call's batches by their state when the wait ends.
|
|
72
93
|
*/
|
|
73
|
-
|
|
94
|
+
flushUntil(expired: Promise<void>): Promise<FlushCounts>;
|
|
74
95
|
/**
|
|
75
96
|
* Counts the batches held in storage.
|
|
76
97
|
* @returns Promise that resolves to the batch count, or 0 if storage fails.
|
|
@@ -78,37 +99,62 @@ export declare class Sender {
|
|
|
78
99
|
queueDepth(): Promise<number>;
|
|
79
100
|
/**
|
|
80
101
|
* Reads the delivery state of the pipeline and the transport.
|
|
81
|
-
* @returns
|
|
102
|
+
* @returns Waiting records, records in requests, the failures and the throttle end.
|
|
82
103
|
*/
|
|
83
|
-
stats():
|
|
104
|
+
stats(): SenderStats;
|
|
84
105
|
/**
|
|
85
|
-
* Sends pending records with a normal flush, then with the exit flush
|
|
86
|
-
* timers and listeners
|
|
87
|
-
*
|
|
106
|
+
* Sends pending records with a normal flush, then with the exit flush, then stops all
|
|
107
|
+
* timers and listeners and closes storage. The normal flush keeps the headers, gzip and
|
|
108
|
+
* the retry. The exit flush picks up the records the normal flush didn't confirm.
|
|
88
109
|
* @returns Promise that resolves when storage closes.
|
|
89
110
|
*/
|
|
90
111
|
destroy(): Promise<void>;
|
|
91
112
|
/**
|
|
92
|
-
* Stops
|
|
113
|
+
* Stops every send without a flush or an exit flush, for a discard at shutdown. A request in
|
|
114
|
+
* flight can still reach the server, but its result writes nothing and schedules no retry,
|
|
115
|
+
* because the store accepts no write after this.
|
|
116
|
+
* @returns Promise that resolves to the records in the buffers and the queue, once the
|
|
117
|
+
* emergency import is done and the store is closed.
|
|
118
|
+
*/
|
|
119
|
+
discard(): Promise<LogRecord[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Stops every send after a rotation fails, and stores the records from memory under the old
|
|
122
|
+
* id. The store stays open, so the next rotation that succeeds can apply its rule to them.
|
|
123
|
+
* @param contextId Identity of the closed delivery context.
|
|
124
|
+
* @returns Promise that resolves once the records are stored.
|
|
125
|
+
*/
|
|
126
|
+
pause(contextId: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Stores whole batches under a context id. One batch per record would fill
|
|
129
|
+
* retention.maxBatches.
|
|
130
|
+
* @param batches Batches from the pipeline.
|
|
131
|
+
* @param contextId Identity of their delivery context.
|
|
132
|
+
* @returns Promise that resolves once each batch is stored.
|
|
133
|
+
*/
|
|
134
|
+
private keep;
|
|
135
|
+
/**
|
|
136
|
+
* Stops this sender before a new delivery identity takes effect. Does not run exit delivery.
|
|
93
137
|
* @param policy Rule for the old records.
|
|
94
138
|
* @param timeoutMs Maximum wait for a flush, in milliseconds.
|
|
95
139
|
* @param contextId Identity of the old delivery context.
|
|
96
|
-
* @returns
|
|
140
|
+
* @returns The records that were in memory and the batches that were stored, after the
|
|
141
|
+
* delivery attempt.
|
|
97
142
|
*/
|
|
98
143
|
retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
|
|
99
144
|
buffered: LogRecord[];
|
|
100
145
|
stored: LogBatch[];
|
|
101
146
|
}>;
|
|
102
147
|
/**
|
|
103
|
-
* Stores
|
|
104
|
-
*
|
|
105
|
-
*
|
|
148
|
+
* Stores an earlier context's batches under this context, and the retry engine then sends
|
|
149
|
+
* them. They don't go through the live buffer, because a large backlog would exceed its
|
|
150
|
+
* budget.
|
|
151
|
+
* @param batches The earlier context's stored batches.
|
|
106
152
|
* @param contextId Identity of this delivery context.
|
|
107
153
|
* @returns Promise that resolves when the batches are stored.
|
|
108
154
|
*/
|
|
109
155
|
adopt(batches: readonly LogBatch[], contextId: string): Promise<void>;
|
|
110
156
|
/**
|
|
111
|
-
* Moves the
|
|
157
|
+
* Moves the emergency queue's batches into storage, then wakes the retry engine.
|
|
112
158
|
* The previous page load parked them during its unload.
|
|
113
159
|
*/
|
|
114
160
|
private importEmergency;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { EndedTrace } from "../utils/tracing.cjs";
|
|
2
|
+
/** One span recorded by the runtime. */
|
|
3
|
+
export interface SpanData {
|
|
4
|
+
/** Span name. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** "internal" for a root span, "client" for a request. */
|
|
7
|
+
kind: "internal" | "client";
|
|
8
|
+
/** Trace ID. */
|
|
9
|
+
traceId: string;
|
|
10
|
+
/** Span ID. */
|
|
11
|
+
spanId: string;
|
|
12
|
+
/** The parent's span ID, or "" for a root span. */
|
|
13
|
+
parentSpanId: string;
|
|
14
|
+
/** Start time in epoch milliseconds. */
|
|
15
|
+
startMs: number;
|
|
16
|
+
/** End time in epoch milliseconds. */
|
|
17
|
+
endMs: number;
|
|
18
|
+
/** True for a failed operation. */
|
|
19
|
+
error: boolean;
|
|
20
|
+
/** The span's attributes. */
|
|
21
|
+
attributes: Record<string, unknown>;
|
|
22
|
+
/** Server span linked through a response traceparent entry. */
|
|
23
|
+
link?: {
|
|
24
|
+
traceId: string;
|
|
25
|
+
spanId: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Builds the root span for an ambient trace that has ended.
|
|
30
|
+
* @param ended The trace.
|
|
31
|
+
* @returns The span data.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rootSpan(ended: EndedTrace): SpanData;
|
|
34
|
+
/**
|
|
35
|
+
* Builds the span fields for a span record. The record limits don't trim them.
|
|
36
|
+
* @param span The span data.
|
|
37
|
+
* @returns The fields.
|
|
38
|
+
*/
|
|
39
|
+
export declare function spanFields(span: SpanData): Record<string, unknown>;
|
package/dist/core/spans.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EndedTrace } from "../utils/tracing";
|
|
2
|
-
/** One span
|
|
1
|
+
import type { EndedTrace } from "../utils/tracing.js";
|
|
2
|
+
/** One span recorded by the runtime. */
|
|
3
3
|
export interface SpanData {
|
|
4
4
|
/** Span name. */
|
|
5
5
|
name: string;
|
|
@@ -9,7 +9,7 @@ export interface SpanData {
|
|
|
9
9
|
traceId: string;
|
|
10
10
|
/** Span ID. */
|
|
11
11
|
spanId: string;
|
|
12
|
-
/**
|
|
12
|
+
/** The parent's span ID, or "" for a root span. */
|
|
13
13
|
parentSpanId: string;
|
|
14
14
|
/** Start time in epoch milliseconds. */
|
|
15
15
|
startMs: number;
|
|
@@ -17,7 +17,7 @@ export interface SpanData {
|
|
|
17
17
|
endMs: number;
|
|
18
18
|
/** True for a failed operation. */
|
|
19
19
|
error: boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** The span's attributes. */
|
|
21
21
|
attributes: Record<string, unknown>;
|
|
22
22
|
/** Server span linked through a response traceparent entry. */
|
|
23
23
|
link?: {
|
|
@@ -26,13 +26,13 @@ export interface SpanData {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Builds the root span
|
|
29
|
+
* Builds the root span for an ambient trace that has ended.
|
|
30
30
|
* @param ended The trace.
|
|
31
31
|
* @returns The span data.
|
|
32
32
|
*/
|
|
33
33
|
export declare function rootSpan(ended: EndedTrace): SpanData;
|
|
34
34
|
/**
|
|
35
|
-
* Builds the span fields
|
|
35
|
+
* Builds the span fields for a span record. The record limits don't trim them.
|
|
36
36
|
* @param span The span data.
|
|
37
37
|
* @returns The fields.
|
|
38
38
|
*/
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e) {
|
|
3
|
-
typeof e != "number" && e.unref?.();
|
|
4
|
-
}
|
|
1
|
+
import { t as e } from "./unref-DgHPQeWv.js";
|
|
5
2
|
// src/utils/deadline.ts
|
|
6
3
|
var t = class extends Error {
|
|
7
4
|
constructor(e) {
|
|
@@ -19,6 +16,6 @@ function n(n, r) {
|
|
|
19
16
|
clearTimeout(i);
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
export { n,
|
|
19
|
+
export { n, t };
|
|
23
20
|
|
|
24
|
-
//# sourceMappingURL=deadline-
|
|
21
|
+
//# sourceMappingURL=deadline-C4ccAuk5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline-C4ccAuk5.js","names":["unrefTimer","DeadlineError","ms","withDeadline","expire","deadline","timer","work"],"sources":["../src/utils/deadline.ts"],"sourcesContent":["// src/utils/deadline.ts\n//\n// Puts a deadline on a promise that could stay pending. A pending promise raises no\n// diagnostics event, so without a deadline its caller waits forever and keeps its slot.\n\nimport { unrefTimer } from \"./unref\";\n\n/** The error for a promise that didn't settle before its deadline. */\nexport class DeadlineError extends Error {\n /**\n * @param ms Deadline in milliseconds.\n */\n constructor(ms: number) {\n super(`The operation took longer than ${String(ms)} ms.`);\n this.name = \"DeadlineError\";\n }\n}\n\n/**\n * Rejects when a promise doesn't settle within a deadline.\n * @param work The promise to bound.\n * @param ms Deadline in milliseconds.\n * @returns The promise's value, or a rejection after the deadline.\n */\nexport function withDeadline<T>(work: Promise<T>, ms: number): Promise<T> {\n let expire: ReturnType<typeof setTimeout> | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new DeadlineError(ms));\n }, ms);\n\n expire = timer;\n unrefTimer(timer);\n });\n\n // Clear the timer on success and on failure. Otherwise every storage call leaves an armed timer.\n return Promise.race([work, deadline]).finally(() => {\n clearTimeout(expire);\n });\n}\n"],"mappings":";;AAQA,IAAaC,IAAb,cAAmC,MAAM;CAIvC,YAAY,GAAY;EAEtB,AADA,MAAM,kCAAkC,OAAOC,CAAE,EAAE,KAAK,GACxD,KAAK,OAAO;CACd;AACF;AAQA,SAAgBC,EAAgB,GAAkB,GAAwB;CACxE,IAAIC,GAEEC,IAAW,IAAI,SAAgB,GAAU,MAAW;EACxD,IAAMC,IAAQ,iBAAiB;GAC7B,EAAO,IAAIL,EAAcC,CAAE,CAAC;EAC9B,GAAGA,CAAE;EAGL,AADA,IAASI,GACTN,EAAWM,CAAK;CAClB,CAAC;CAGD,OAAO,QAAQ,KAAK,CAACC,GAAMF,CAAQ,CAAC,CAAC,CAAC,cAAc;EAClD,aAAaD,CAAM;CACrB,CAAC;AACH"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./unref-CU9Nyz_9.cjs");var t=class extends Error{constructor(e){super(`The operation took longer than ${String(e)} ms.`),this.name=`DeadlineError`}};function n(n,r){let i,a=new Promise((n,a)=>{let o=setTimeout(()=>{a(new t(r))},r);i=o,e.t(o)});return Promise.race([n,a]).finally(()=>{clearTimeout(i)})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
2
|
+
//# sourceMappingURL=deadline-CUGbto-y.cjs.map
|