@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/index.js
CHANGED
|
@@ -1,79 +1,46 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
7
|
-
import {
|
|
8
|
-
import { i as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
function pt(e, t, n, r, i) {
|
|
19
|
-
e.logMetric(`${t}.duration`, n, "ms", "histogram", {
|
|
20
|
-
status: r,
|
|
21
|
-
...i
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function mt(e, t, n, r, i) {
|
|
25
|
-
let a = ft(n);
|
|
26
|
-
e.error(`${t} failed`, r, {
|
|
27
|
-
"action.duration_ms": a,
|
|
28
|
-
status: "FAILURE",
|
|
29
|
-
...i
|
|
30
|
-
}), pt(e, t, a, "FAILURE", i);
|
|
31
|
-
}
|
|
32
|
-
function ht(e, t, n, r) {
|
|
33
|
-
let i = performance.now();
|
|
34
|
-
try {
|
|
35
|
-
let a = n();
|
|
36
|
-
return pt(e, t, ft(i), "SUCCESS", r), a;
|
|
37
|
-
} catch (n) {
|
|
38
|
-
throw mt(e, t, i, n, r), n;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async function gt(e, t, n, r) {
|
|
42
|
-
let i = performance.now();
|
|
43
|
-
try {
|
|
44
|
-
let a = await n();
|
|
45
|
-
return pt(e, t, ft(i), "SUCCESS", r), a;
|
|
46
|
-
} catch (n) {
|
|
47
|
-
throw mt(e, t, i, n, r), n;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
import { $n as e, An as t, Bt as n, Dn as r, En as i, G as a, Gn as o, Hn as s, J as c, K as l, Lt as u, M as d, Mn as f, Nn as p, Ot as m, P as h, Qn as g, Sn as ee, Tn as _, Vn as te, Y as ne, _ as re, _n as ie, a as v, at as ae, bn as oe, c as y, d as se, er as b, f as x, g as S, gn as ce, h as C, hn as le, j as ue, jt as de, kt as w, m as fe, mn as pe, nr as me, o as he, on as ge, or as _e, p as ve, q as ye, rr as be, rt as xe, s as Se, sn as Ce, sr as we, tr as Te, u as Ee, v as T, vn as De, wn as Oe, xn as ke, xt as Ae, y as je, yn as Me, zt as E } from "./constants-CUyd9cTZ.js";
|
|
2
|
+
import { n as Ne, r as Pe, t as Fe } from "./log-record-BNiLfqtL.js";
|
|
3
|
+
import { n as Ie, r as Le, t as Re } from "./error-like-B11pB4aL.js";
|
|
4
|
+
import { n as D, t as ze } from "./guards-BlYGRK4l.js";
|
|
5
|
+
import { t as O } from "./unref-DgHPQeWv.js";
|
|
6
|
+
import { i as Be, n as Ve, t as He } from "./platform-BaaFIPCU.js";
|
|
7
|
+
import { t as k } from "./defineProperty-s2S8BXUc.js";
|
|
8
|
+
import { a as Ue, i as A, n as We, o as Ge, r as Ke, s as qe, t as Je } from "./identity-DdhKgrpk.js";
|
|
9
|
+
import { t as j } from "./profiler-BAZoh7A4.js";
|
|
10
|
+
import { n as M, t as Ye } from "./library-console-Btrzt814.js";
|
|
11
|
+
import { i as Xe, n as Ze, r as N } from "./sanitize-Ba0KqU06.js";
|
|
12
|
+
import { r as Qe } from "./library-request-BJ9PLRaD.js";
|
|
13
|
+
import { n as $e, r as P, t as F } from "./config-SgQcCP1_.js";
|
|
14
|
+
import { r as et, t as tt } from "./batch-CXmPmTse.js";
|
|
15
|
+
import { n as nt, t as rt } from "./journey-D2_sia57.js";
|
|
16
|
+
import { a as it, i as at, n as ot, o as st } from "./sampling-BlrI8jor.js";
|
|
50
17
|
// src/core/deferred.ts
|
|
51
|
-
var
|
|
52
|
-
function
|
|
18
|
+
var I = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
function ct(e) {
|
|
53
20
|
let t = e.idle;
|
|
54
21
|
t !== void 0 && (e.diagnostics.guard("pipeline.crashed", "The idle callback could not be cancelled.", () => {
|
|
55
22
|
cancelIdleCallback(t);
|
|
56
23
|
}), e.idle = void 0), clearTimeout(e.timer), e.timer = void 0;
|
|
57
24
|
}
|
|
58
|
-
function
|
|
25
|
+
function lt(e, t) {
|
|
59
26
|
typeof requestIdleCallback == "function" && typeof cancelIdleCallback == "function" && (t.idle = t.diagnostics.guard("pipeline.crashed", "The idle callback could not be scheduled.", () => requestIdleCallback((n) => {
|
|
60
|
-
|
|
61
|
-
}, { timeout:
|
|
62
|
-
|
|
63
|
-
}, 0),
|
|
64
|
-
}
|
|
65
|
-
function
|
|
66
|
-
if (
|
|
67
|
-
|
|
27
|
+
L(e, t, n);
|
|
28
|
+
}, { timeout: l })), t.idle !== void 0) || (t.timer = setTimeout(() => {
|
|
29
|
+
L(e, t);
|
|
30
|
+
}, 0), O(t.timer));
|
|
31
|
+
}
|
|
32
|
+
function L(e, t, n) {
|
|
33
|
+
if (I.get(e) !== t || t.draining) return;
|
|
34
|
+
ct(t), t.draining = !0;
|
|
68
35
|
let r = t.work;
|
|
69
36
|
t.work = [];
|
|
70
37
|
let i = 0;
|
|
71
|
-
for (; i < r.length && (!n || n.didTimeout && i === 0 || n.timeRemaining() > 0);) if (t.diagnostics.guard("pipeline.crashed", "The library could not build a deferred record.", r[i]), i++,
|
|
72
|
-
t.work = [...r.slice(i), ...t.work], t.draining = !1, t.work.length > 0 ?
|
|
38
|
+
for (; i < r.length && (!n || n.didTimeout && i === 0 || n.timeRemaining() > 0);) if (t.diagnostics.guard("pipeline.crashed", "The library could not build a deferred record.", r[i]), i++, I.get(e) !== t) return;
|
|
39
|
+
t.work = [...r.slice(i), ...t.work], t.draining = !1, t.work.length > 0 ? lt(e, t) : I.delete(e);
|
|
73
40
|
}
|
|
74
|
-
function
|
|
75
|
-
let i =
|
|
76
|
-
if (i && i.work.length >= a && !i.draining && (
|
|
41
|
+
function ut(e, t, n, r) {
|
|
42
|
+
let i = I.get(e), a = r === null ? ye : Math.min(r, ye);
|
|
43
|
+
if (i && i.work.length >= a && !i.draining && (L(e, i), i = I.get(e)), i) {
|
|
77
44
|
if (i.work.length >= a) {
|
|
78
45
|
n.count("record.dropped_by_ceiling");
|
|
79
46
|
return;
|
|
@@ -83,29 +50,29 @@ function yt(e, t, n, r) {
|
|
|
83
50
|
work: [t],
|
|
84
51
|
diagnostics: n,
|
|
85
52
|
draining: !1
|
|
86
|
-
},
|
|
53
|
+
}, I.set(e, i), lt(e, i);
|
|
87
54
|
}
|
|
88
|
-
function
|
|
89
|
-
let t =
|
|
90
|
-
t &&
|
|
55
|
+
function R(e) {
|
|
56
|
+
let t = I.get(e);
|
|
57
|
+
t && L(e, t);
|
|
91
58
|
}
|
|
92
|
-
function
|
|
93
|
-
let t =
|
|
59
|
+
function dt(e) {
|
|
60
|
+
let t = I.get(e);
|
|
94
61
|
if (t) {
|
|
95
|
-
|
|
62
|
+
ct(t), I.delete(e);
|
|
96
63
|
for (let e of t.work) t.diagnostics.count("record.dropped_by_ceiling");
|
|
97
64
|
t.work = [];
|
|
98
65
|
}
|
|
99
66
|
}
|
|
100
67
|
// src/core/logger.ts
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
68
|
+
var ft = [
|
|
69
|
+
h,
|
|
70
|
+
o,
|
|
71
|
+
c
|
|
105
72
|
];
|
|
106
|
-
function
|
|
73
|
+
function pt(e, t) {
|
|
107
74
|
let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
|
|
108
|
-
if (!(e instanceof Error) && !
|
|
75
|
+
if (!(e instanceof Error) && !Le(e)) return;
|
|
109
76
|
let t = Error(e.message);
|
|
110
77
|
return t.name = e.name, t.stack = e.stack, t;
|
|
111
78
|
});
|
|
@@ -113,38 +80,50 @@ function St(e, t) {
|
|
|
113
80
|
let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
|
|
114
81
|
return Error(r ?? typeof e);
|
|
115
82
|
}
|
|
116
|
-
function
|
|
83
|
+
function mt(e, t, n) {
|
|
117
84
|
return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
|
|
118
85
|
}
|
|
119
|
-
function
|
|
86
|
+
function ht(e, t) {
|
|
120
87
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
|
|
121
88
|
if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
|
|
122
|
-
let t = e, n =
|
|
89
|
+
let t = e, n = Le(e), r = {}, i = 0;
|
|
123
90
|
for (let e of Object.keys(t)) {
|
|
124
91
|
let a = t[e];
|
|
125
|
-
n &&
|
|
92
|
+
n && Re.has(e) || !Ie(a) || (r[e] = a, i++);
|
|
126
93
|
}
|
|
127
94
|
return i === 0 ? void 0 : r;
|
|
128
95
|
});
|
|
129
96
|
}
|
|
130
|
-
function
|
|
131
|
-
if (!
|
|
97
|
+
function gt(e) {
|
|
98
|
+
if (!D(e) || e instanceof Error) return !1;
|
|
132
99
|
let t = Object.getPrototypeOf(e);
|
|
133
100
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
134
101
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
102
|
+
function _t(e) {
|
|
103
|
+
return ft.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
|
|
137
104
|
}
|
|
138
|
-
function
|
|
105
|
+
function z(e, t) {
|
|
139
106
|
return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
|
|
140
107
|
}
|
|
141
|
-
var
|
|
142
|
-
bind;
|
|
143
|
-
namespace;
|
|
144
|
-
options;
|
|
145
|
-
levelType;
|
|
108
|
+
var B = class e {
|
|
146
109
|
constructor(e, t, n = {}) {
|
|
147
|
-
this
|
|
110
|
+
k(this, "bind", void 0), k(this, "namespace", void 0), k(this, "options", void 0), k(this, "levelType", void 0), k(this, "trace", (e, t) => {
|
|
111
|
+
this.write("TRACE", this.levelType, e, t);
|
|
112
|
+
}), k(this, "debug", (e, t) => {
|
|
113
|
+
this.write("DEBUG", this.levelType, e, t);
|
|
114
|
+
}), k(this, "info", (e, t) => {
|
|
115
|
+
this.write("INFO", this.levelType, e, t);
|
|
116
|
+
}), k(this, "warn", (e, t) => {
|
|
117
|
+
this.write("WARN", this.levelType, e, t);
|
|
118
|
+
}), k(this, "error", (e, t, n) => {
|
|
119
|
+
this.writeError("ERROR", e, t, n);
|
|
120
|
+
}), k(this, "fatal", (e, t, n) => {
|
|
121
|
+
this.writeError("FATAL", e, t, n);
|
|
122
|
+
}), k(this, "logAction", (e, t) => {
|
|
123
|
+
this.write("INFO", "action", e, t);
|
|
124
|
+
}), k(this, "logEvent", (e, t) => {
|
|
125
|
+
this.write("INFO", "event", e, t);
|
|
126
|
+
}), this.bind = e, this.namespace = t, this.options = n, this.levelType = _t(t);
|
|
148
127
|
}
|
|
149
128
|
child(t, n = {}) {
|
|
150
129
|
return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
|
|
@@ -152,50 +131,6 @@ var F = class e {
|
|
|
152
131
|
...n.scopedContext
|
|
153
132
|
} });
|
|
154
133
|
}
|
|
155
|
-
trace = (e, t) => {
|
|
156
|
-
this.write("TRACE", this.levelType, e, t);
|
|
157
|
-
};
|
|
158
|
-
debug = (e, t) => {
|
|
159
|
-
this.write("DEBUG", this.levelType, e, t);
|
|
160
|
-
};
|
|
161
|
-
info = (e, t) => {
|
|
162
|
-
this.write("INFO", this.levelType, e, t);
|
|
163
|
-
};
|
|
164
|
-
warn = (e, t) => {
|
|
165
|
-
this.write("WARN", this.levelType, e, t);
|
|
166
|
-
};
|
|
167
|
-
error = (e, t, n) => {
|
|
168
|
-
this.writeError("ERROR", e, t, n);
|
|
169
|
-
};
|
|
170
|
-
fatal = (e, t, n) => {
|
|
171
|
-
this.writeError("FATAL", e, t, n);
|
|
172
|
-
};
|
|
173
|
-
logAction = (e, t) => {
|
|
174
|
-
this.write("INFO", "action", e, t);
|
|
175
|
-
};
|
|
176
|
-
logEvent = (e, t) => {
|
|
177
|
-
this.write("INFO", "event", e, t);
|
|
178
|
-
};
|
|
179
|
-
logMetric = (e, t, n = ae, r = "gauge", i) => {
|
|
180
|
-
if (!Number.isFinite(t)) {
|
|
181
|
-
this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
let a = this.bind();
|
|
185
|
-
this.submit(a, "INFO", "metric", (o) => {
|
|
186
|
-
let s = P(i, a.diagnostics), c = {
|
|
187
|
-
...s,
|
|
188
|
-
"metric.name": e,
|
|
189
|
-
"metric.value": t,
|
|
190
|
-
"metric.unit": n,
|
|
191
|
-
"metric.type": r,
|
|
192
|
-
[y.attributeKeys]: Object.keys(s)
|
|
193
|
-
};
|
|
194
|
-
this.writeNow(a, "INFO", "metric", e, c, !0, o);
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
timeSync = (e, t, n) => ht(this, e, t, n);
|
|
198
|
-
timeAsync = (e, t, n) => gt(this, e, t, n);
|
|
199
134
|
write(e, t, n, r) {
|
|
200
135
|
let i = this.bind();
|
|
201
136
|
this.submit(i, e, t, (a) => {
|
|
@@ -208,13 +143,13 @@ var F = class e {
|
|
|
208
143
|
else if (e.config.payloadMode === "defer" && e.config.enabled && !e.config.debugBuffer.enabled && this.namespace !== "uiobs.diagnostics") {
|
|
209
144
|
if (!e.builder.isEnabled(t, this.namespace, n) && !this.mirrors(e, t)) return;
|
|
210
145
|
let i = e.journey.current(), a = {
|
|
211
|
-
timeUnixNano:
|
|
146
|
+
timeUnixNano: Pe(),
|
|
212
147
|
trace: e.tracing.resolve(),
|
|
213
148
|
journey: i ? { ...i } : null,
|
|
214
149
|
context: e.context.getAll(),
|
|
215
|
-
url:
|
|
150
|
+
url: He(e.diagnostics)
|
|
216
151
|
};
|
|
217
|
-
|
|
152
|
+
ut(e, () => {
|
|
218
153
|
r(a);
|
|
219
154
|
}, e.diagnostics, e.config.buffering.maxPendingRecords);
|
|
220
155
|
} else r();
|
|
@@ -232,8 +167,8 @@ var F = class e {
|
|
|
232
167
|
body: r,
|
|
233
168
|
namespace: this.namespace,
|
|
234
169
|
scoped: this.options.scopedContext,
|
|
235
|
-
payload: a ? i :
|
|
236
|
-
}, { record: c, dropped: l } = e.builder.build(s), u = !!e.config.redact || e.config.processors.length > 0, d = n !== "metric" && e.config.
|
|
170
|
+
payload: a ? i : z(i, e.diagnostics)
|
|
171
|
+
}, { record: c, dropped: l } = e.builder.build(s), u = !!e.config.redact || e.config.processors.length > 0, d = n !== "metric" && e.config.captureLimits.breadcrumbs > 0, f = l === "sampling" && u && d ? e.builder.build(s, !0) : void 0, p = c ?? f?.record ?? null, m = p ? p.body : l === "sampling" && !u ? r : void 0;
|
|
237
172
|
d && m !== void 0 && e.breadcrumbs.push({
|
|
238
173
|
t: o ? Number(o.timeUnixNano.slice(0, -6)) : Date.now(),
|
|
239
174
|
category: n === "action" ? "action" : n === "event" ? "event" : "log",
|
|
@@ -249,12 +184,12 @@ var F = class e {
|
|
|
249
184
|
writeErrorNow(e, t, n, r, i, a) {
|
|
250
185
|
let o = e.builder.isEnabled(t, this.namespace);
|
|
251
186
|
if (!o && !this.mirrors(e, t)) return;
|
|
252
|
-
let s = i === void 0 && (e.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () =>
|
|
187
|
+
let s = i === void 0 && (e.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => gt(r)) ?? !1), c = s ? r : i, l = s ? void 0 : r, u = l === void 0 ? void 0 : pt(l, e.diagnostics), d = u === void 0 ? void 0 : mt(l, u, e.diagnostics);
|
|
253
188
|
if (!o) {
|
|
254
189
|
this.print(e, t, n, c, d, null, void 0, a);
|
|
255
190
|
return;
|
|
256
191
|
}
|
|
257
|
-
let f = u ?
|
|
192
|
+
let f = u ? ht(l, e.diagnostics) : void 0, { record: p, dropped: m } = e.builder.build({
|
|
258
193
|
snapshot: a,
|
|
259
194
|
level: t,
|
|
260
195
|
type: this.levelType,
|
|
@@ -262,14 +197,14 @@ var F = class e {
|
|
|
262
197
|
namespace: this.namespace,
|
|
263
198
|
scoped: this.options.scopedContext,
|
|
264
199
|
payload: {
|
|
265
|
-
...
|
|
200
|
+
...z(c, e.diagnostics),
|
|
266
201
|
...u ? {
|
|
267
202
|
"error.type": u.name,
|
|
268
203
|
"error.message": u.message,
|
|
269
204
|
"error.stack_trace": u.stack
|
|
270
205
|
} : {},
|
|
271
|
-
...f === void 0 ? {} : { [
|
|
272
|
-
[
|
|
206
|
+
...f === void 0 ? {} : { [se]: f },
|
|
207
|
+
[y]: e.breadcrumbs.snapshot()
|
|
273
208
|
}
|
|
274
209
|
});
|
|
275
210
|
this.print(e, t, n, c, d, p, m, a), e.emit(p);
|
|
@@ -292,7 +227,7 @@ var F = class e {
|
|
|
292
227
|
namespace: this.namespace,
|
|
293
228
|
scoped: this.options.scopedContext,
|
|
294
229
|
payload: {
|
|
295
|
-
...
|
|
230
|
+
...z(r, e.diagnostics),
|
|
296
231
|
...i ? {
|
|
297
232
|
"error.type": i.name,
|
|
298
233
|
"error.message": i.message,
|
|
@@ -305,117 +240,336 @@ var F = class e {
|
|
|
305
240
|
mirrors(e, t) {
|
|
306
241
|
return e.config.enabled && e.console.accepts(t);
|
|
307
242
|
}
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
243
|
+
}, vt = class extends B {
|
|
244
|
+
constructor(...e) {
|
|
245
|
+
super(...e), k(this, "logMetric", (e, t, n = a, r = "gauge", i, o) => {
|
|
246
|
+
if (!Number.isFinite(t)) {
|
|
247
|
+
this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
let s = this.bind();
|
|
251
|
+
this.submit(s, "INFO", "metric", (a) => {
|
|
252
|
+
let c = z(i, s.diagnostics), l = {
|
|
253
|
+
...z(o, s.diagnostics),
|
|
254
|
+
...c,
|
|
255
|
+
"metric.name": e,
|
|
256
|
+
"metric.value": t,
|
|
257
|
+
"metric.unit": n,
|
|
258
|
+
"metric.type": r,
|
|
259
|
+
[E.attributeKeys]: Object.keys(c)
|
|
260
|
+
};
|
|
261
|
+
this.writeNow(s, "INFO", "metric", e, l, !0, a);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}, yt = /^[0-9a-f]{32}$/, bt = /^[0-9a-f]{16}$/, xt = /[1-9a-f]/;
|
|
266
|
+
function St(e) {
|
|
267
|
+
return yt.test(e.traceId) && xt.test(e.traceId) && bt.test(e.spanId) && xt.test(e.spanId);
|
|
268
|
+
}
|
|
269
|
+
function Ct() {
|
|
270
|
+
return Ge(16);
|
|
271
|
+
}
|
|
272
|
+
function wt() {
|
|
273
|
+
return Ge(8);
|
|
274
|
+
}
|
|
275
|
+
function Tt(e) {
|
|
276
|
+
return {
|
|
277
|
+
traceId: Ct(),
|
|
278
|
+
spanId: wt(),
|
|
279
|
+
traceFlags: 1,
|
|
280
|
+
startedAt: Date.now(),
|
|
281
|
+
reason: e,
|
|
282
|
+
ended: !1
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function Et(e, t, n) {
|
|
286
|
+
return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
|
|
287
|
+
}
|
|
288
|
+
function Dt(e) {
|
|
289
|
+
return {
|
|
290
|
+
traceId: e.traceId,
|
|
291
|
+
spanId: e.spanId,
|
|
292
|
+
traceFlags: e.traceFlags
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
var Ot = class {
|
|
296
|
+
constructor(e, t = me, n, r) {
|
|
297
|
+
k(this, "diagnostics", void 0), k(this, "maxAgeMs", void 0), k(this, "load", void 0), k(this, "spans", void 0), k(this, "ambient", Tt("start")), k(this, "otel", void 0), this.diagnostics = e, this.maxAgeMs = t, this.load = n, this.spans = r;
|
|
298
|
+
}
|
|
299
|
+
setup(e, t) {
|
|
300
|
+
this.maxAgeMs = e, this.load = t;
|
|
301
|
+
}
|
|
302
|
+
async loadOtel() {
|
|
303
|
+
if (this.load) try {
|
|
304
|
+
this.otel = await this.load();
|
|
305
|
+
} catch (e) {
|
|
306
|
+
this.diagnostics.report("trace.otel_failed", "The library could not load @opentelemetry/api. Records use the trace ids of the library.", void 0, e);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
resolve() {
|
|
310
|
+
return this.activeSpanContext() ?? this.ambientContext();
|
|
311
|
+
}
|
|
312
|
+
ambientContext() {
|
|
313
|
+
return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Dt(this.ambient);
|
|
314
|
+
}
|
|
315
|
+
activeSpanContext() {
|
|
316
|
+
let e = this.otel;
|
|
317
|
+
if (e) return this.diagnostics.guard("trace.otel_failed", "The library could not read the active OpenTelemetry span.", () => {
|
|
318
|
+
let t = e.trace.getActiveSpan();
|
|
319
|
+
if (t === void 0) return;
|
|
320
|
+
let n = t.spanContext();
|
|
321
|
+
if (St(n)) return {
|
|
322
|
+
traceId: n.traceId,
|
|
323
|
+
spanId: n.spanId,
|
|
324
|
+
traceFlags: n.traceFlags
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
rotate(e) {
|
|
329
|
+
let t = this.ambient;
|
|
330
|
+
this.ambient = Tt(e);
|
|
331
|
+
let n = Dt(this.ambient);
|
|
332
|
+
return this.finish(t), n;
|
|
333
|
+
}
|
|
334
|
+
end() {
|
|
335
|
+
this.finish(this.ambient);
|
|
336
|
+
}
|
|
337
|
+
finish(e) {
|
|
338
|
+
e.ended || (e.ended = !0, this.spans?.onEnd({
|
|
339
|
+
traceId: e.traceId,
|
|
340
|
+
spanId: e.spanId,
|
|
341
|
+
reason: e.reason,
|
|
342
|
+
startedAt: e.startedAt,
|
|
343
|
+
endedAt: Date.now()
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
headers() {
|
|
347
|
+
return this.trace(!1).headers;
|
|
348
|
+
}
|
|
349
|
+
request() {
|
|
350
|
+
return this.trace(!0);
|
|
351
|
+
}
|
|
352
|
+
trace(e) {
|
|
353
|
+
let t = {}, n = this.otel;
|
|
354
|
+
if (n && this.diagnostics.guard("trace.otel_failed", "The library could not add the OpenTelemetry headers.", () => {
|
|
355
|
+
n.propagation.inject(n.context.active(), t);
|
|
356
|
+
}), t.traceparent) return { headers: t };
|
|
357
|
+
let r = this.activeSpanContext(), i = r ?? this.ambientContext(), a = r ? void 0 : this.spans;
|
|
358
|
+
if (!a?.enabled()) return t[Te] = Et(i.traceId, i.spanId, i.traceFlags), { headers: t };
|
|
359
|
+
let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? wt() : i.spanId;
|
|
360
|
+
return t[Te] = Et(i.traceId, c, s), !e || !o ? { headers: t } : {
|
|
361
|
+
headers: t,
|
|
362
|
+
span: {
|
|
363
|
+
traceId: i.traceId,
|
|
364
|
+
spanId: c,
|
|
365
|
+
parentSpanId: i.spanId
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
}, kt = {
|
|
370
|
+
name: "ui.measure.duration",
|
|
371
|
+
kind: "histogram",
|
|
372
|
+
unit: "ms",
|
|
373
|
+
boundaries: u
|
|
374
|
+
}, At = {
|
|
375
|
+
name: "ui.measure.phase.duration",
|
|
376
|
+
kind: "histogram",
|
|
377
|
+
unit: "ms",
|
|
378
|
+
boundaries: u
|
|
379
|
+
};
|
|
380
|
+
function jt(e, t, n, r) {
|
|
381
|
+
let i = String(e), a = Date.now(), o = performance.now(), s, c = !1, l = (e) => a + e - o, u = (e, a) => {
|
|
382
|
+
s &&= (r.metric(At, e - s.at, {
|
|
383
|
+
...t,
|
|
384
|
+
"measure.name": i,
|
|
385
|
+
"measure.phase": s.name
|
|
386
|
+
}), n && r.span({
|
|
387
|
+
name: s.name,
|
|
388
|
+
kind: "internal",
|
|
389
|
+
traceId: n.traceId,
|
|
390
|
+
spanId: wt(),
|
|
391
|
+
parentSpanId: n.spanId,
|
|
392
|
+
startMs: l(s.at),
|
|
393
|
+
endMs: l(e),
|
|
394
|
+
error: a,
|
|
395
|
+
attributes: { "measure.name": i }
|
|
396
|
+
}), void 0);
|
|
397
|
+
};
|
|
398
|
+
return {
|
|
399
|
+
phase: (e) => {
|
|
400
|
+
if (c) return;
|
|
401
|
+
let t = performance.now();
|
|
402
|
+
u(t, !1), s = {
|
|
403
|
+
name: String(e),
|
|
404
|
+
at: t
|
|
405
|
+
};
|
|
406
|
+
},
|
|
407
|
+
end: (e = "ok") => {
|
|
408
|
+
if (c) return;
|
|
409
|
+
c = !0;
|
|
410
|
+
let s = performance.now(), d = e === "error";
|
|
411
|
+
u(s, d);
|
|
412
|
+
let f = {
|
|
413
|
+
...t,
|
|
414
|
+
"measure.outcome": e
|
|
415
|
+
};
|
|
416
|
+
r.metric(kt, s - o, {
|
|
417
|
+
...f,
|
|
418
|
+
"measure.name": i
|
|
419
|
+
}), n && r.span({
|
|
420
|
+
...n,
|
|
421
|
+
name: i,
|
|
422
|
+
kind: "internal",
|
|
423
|
+
startMs: a,
|
|
424
|
+
endMs: l(s),
|
|
425
|
+
error: d,
|
|
426
|
+
attributes: f
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function Mt(e, t, n) {
|
|
432
|
+
let r = "error";
|
|
433
|
+
try {
|
|
434
|
+
let i = t(), a = n.guard("record.sanitize_failed", "The library could not read what the function of the measure returned. The measure ends now.", () => i?.then);
|
|
435
|
+
if (typeof a != "function") return r = "ok", i;
|
|
436
|
+
let o = a.call(i, (t) => (e.end(), t), (t) => {
|
|
437
|
+
throw e.end("error"), t;
|
|
438
|
+
});
|
|
439
|
+
return r = void 0, o;
|
|
440
|
+
} finally {
|
|
441
|
+
r !== void 0 && e.end(r);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// src/core/meter.ts
|
|
445
|
+
var Nt = "overflow", Pt = /* @__PURE__ */ new Set([
|
|
446
|
+
S,
|
|
312
447
|
C,
|
|
448
|
+
v,
|
|
449
|
+
T,
|
|
313
450
|
x,
|
|
314
|
-
|
|
315
|
-
|
|
451
|
+
ve,
|
|
452
|
+
fe
|
|
316
453
|
]);
|
|
317
|
-
function
|
|
454
|
+
function Ft(e = {}) {
|
|
318
455
|
let t = {};
|
|
319
456
|
for (let n of Object.keys(e).sort()) {
|
|
320
|
-
if (n.startsWith("metric.") ||
|
|
457
|
+
if (n.startsWith("metric.") || Pt.has(n)) continue;
|
|
321
458
|
let r = e[n];
|
|
322
459
|
(typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
|
|
323
460
|
}
|
|
324
461
|
return t;
|
|
325
462
|
}
|
|
326
|
-
function
|
|
463
|
+
function It(e, t) {
|
|
327
464
|
if (!Array.isArray(e)) return null;
|
|
328
|
-
let n = t ===
|
|
465
|
+
let n = t === null ? e.length : Math.min(e.length, t + 1);
|
|
329
466
|
return Array.from({ length: n }, (t, n) => e[n]);
|
|
330
467
|
}
|
|
331
|
-
function
|
|
332
|
-
return Array.isArray(e) && (t ===
|
|
468
|
+
function Lt(e, t) {
|
|
469
|
+
return Array.isArray(e) && (t === null || e.length <= t) && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
|
|
333
470
|
}
|
|
334
|
-
function
|
|
471
|
+
function Rt(e, t, n) {
|
|
335
472
|
let r = {
|
|
336
473
|
"metric.name": e.name,
|
|
337
474
|
"metric.unit": e.unit,
|
|
338
475
|
"metric.type": e.kind,
|
|
339
|
-
[
|
|
340
|
-
[
|
|
476
|
+
[E.start]: n,
|
|
477
|
+
[E.attributeKeys]: Object.keys(t.attributes)
|
|
341
478
|
};
|
|
342
|
-
return e.kind === "
|
|
479
|
+
return e.kind === "histogram" ? {
|
|
343
480
|
...r,
|
|
344
|
-
[
|
|
345
|
-
[
|
|
346
|
-
[
|
|
347
|
-
[
|
|
348
|
-
[
|
|
349
|
-
[
|
|
350
|
-
};
|
|
481
|
+
[E.count]: t.count,
|
|
482
|
+
[E.sum]: t.sum,
|
|
483
|
+
[E.min]: t.min,
|
|
484
|
+
[E.max]: t.max,
|
|
485
|
+
[E.bounds]: e.boundaries,
|
|
486
|
+
[E.buckets]: t.buckets
|
|
487
|
+
} : (r["metric.value"] = e.kind === "gauge" ? t.last : t.sum, r);
|
|
488
|
+
}
|
|
489
|
+
function zt(e, t) {
|
|
490
|
+
try {
|
|
491
|
+
return {
|
|
492
|
+
unit: e.unit,
|
|
493
|
+
boundaries: e.boundaries
|
|
494
|
+
};
|
|
495
|
+
} catch (e) {
|
|
496
|
+
return t(e), {
|
|
497
|
+
unit: void 0,
|
|
498
|
+
boundaries: void 0
|
|
499
|
+
};
|
|
500
|
+
}
|
|
351
501
|
}
|
|
352
|
-
function
|
|
353
|
-
|
|
502
|
+
function Bt(e, t, n, r) {
|
|
503
|
+
return {
|
|
354
504
|
name: e,
|
|
355
|
-
kind:
|
|
356
|
-
unit:
|
|
505
|
+
kind: t,
|
|
506
|
+
unit: zt(n, r).unit ?? "count",
|
|
357
507
|
boundaries: []
|
|
358
508
|
};
|
|
509
|
+
}
|
|
510
|
+
function Vt(e, t, n, r) {
|
|
511
|
+
let i = Bt(e, "counter", t, r);
|
|
359
512
|
return { add: (e, t) => {
|
|
360
|
-
n(
|
|
513
|
+
n(i, e, t);
|
|
361
514
|
} };
|
|
362
515
|
}
|
|
363
|
-
function
|
|
364
|
-
let
|
|
516
|
+
function Ht(e, t, n, r) {
|
|
517
|
+
let i = Bt(e, "gauge", t, r);
|
|
518
|
+
return { set: (e, t) => {
|
|
519
|
+
n(i, e, t);
|
|
520
|
+
} };
|
|
521
|
+
}
|
|
522
|
+
function Ut(e, t, n, r) {
|
|
523
|
+
let { unit: i, boundaries: a } = zt(t, r), o = {
|
|
365
524
|
name: e,
|
|
366
525
|
kind: "histogram",
|
|
367
|
-
unit:
|
|
368
|
-
boundaries:
|
|
526
|
+
unit: i ?? "count",
|
|
527
|
+
boundaries: a ?? u,
|
|
528
|
+
fromApp: a !== void 0
|
|
369
529
|
};
|
|
370
530
|
return { record: (e, t) => {
|
|
371
|
-
n(
|
|
531
|
+
n(o, e, t);
|
|
372
532
|
} };
|
|
373
533
|
}
|
|
374
|
-
var
|
|
375
|
-
intervalMs;
|
|
376
|
-
emit;
|
|
377
|
-
diagnostics;
|
|
378
|
-
policy;
|
|
379
|
-
instruments = /* @__PURE__ */ new Map();
|
|
380
|
-
timer = null;
|
|
381
|
-
startedAt = 0;
|
|
534
|
+
var Wt = class {
|
|
382
535
|
constructor(e, t, n, r = {
|
|
383
536
|
maxSeries: 100,
|
|
384
537
|
maxInstruments: 1e3,
|
|
385
538
|
maxHistogramBoundaries: 50
|
|
386
539
|
}) {
|
|
387
|
-
this.intervalMs = e, this.emit = t, this.diagnostics = n, this.policy = r;
|
|
540
|
+
k(this, "intervalMs", void 0), k(this, "emit", void 0), k(this, "diagnostics", void 0), k(this, "policy", void 0), k(this, "instruments", /* @__PURE__ */ new Map()), k(this, "timer", null), k(this, "startedAt", 0), this.intervalMs = e, this.emit = t, this.diagnostics = n, this.policy = r;
|
|
388
541
|
}
|
|
389
542
|
record(e, t, n) {
|
|
390
543
|
!Number.isFinite(t) || e.kind === "counter" && t < 0 ? this.diagnostics.report("record.dropped_malformed", `The value of the metric ${e.name} is not valid. The library dropped it.`, { "metric.name": e.name }) : this.diagnostics.guard("record.sanitize_failed", `The library could not read the attributes of the metric ${e.name}.`, () => {
|
|
391
544
|
let r = this.instrumentOf(e);
|
|
392
|
-
r && (this.add(r, t,
|
|
545
|
+
r && (this.add(r, t, Ft(n)), this.arm());
|
|
393
546
|
});
|
|
394
547
|
}
|
|
395
548
|
collect() {
|
|
396
549
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
397
550
|
let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
|
|
398
551
|
this.instruments.clear();
|
|
399
|
-
for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes,
|
|
552
|
+
for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, Rt(n, t, e));
|
|
400
553
|
}
|
|
401
554
|
instrumentOf(e) {
|
|
402
555
|
let t = this.instruments.get(e.name);
|
|
403
|
-
if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
e.
|
|
407
|
-
|
|
556
|
+
if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a ${t.def.kind} and a ${e.kind}. The library dropped the value.`, { "metric.name": e.name }), null);
|
|
557
|
+
let { maxInstruments: n } = this.policy;
|
|
558
|
+
if (n !== null && this.instruments.size >= n) return this.diagnostics.count("record.dropped_by_ceiling"), null;
|
|
559
|
+
let r = e.fromApp === !0 ? this.policy.maxHistogramBoundaries : null, i = It(e.boundaries, r), a = Lt(i, r);
|
|
560
|
+
e.kind === "histogram" && !a && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);
|
|
561
|
+
let o = {
|
|
408
562
|
def: {
|
|
409
563
|
...e,
|
|
410
|
-
boundaries:
|
|
564
|
+
boundaries: a ? i : [...u]
|
|
411
565
|
},
|
|
412
566
|
series: /* @__PURE__ */ new Map()
|
|
413
567
|
};
|
|
414
|
-
return this.instruments.set(e.name,
|
|
568
|
+
return this.instruments.set(e.name, o), o;
|
|
415
569
|
}
|
|
416
570
|
add(e, t, n) {
|
|
417
|
-
let r = JSON.stringify(n), i = e.series.get(r), a = n;
|
|
418
|
-
if (!i &&
|
|
571
|
+
let r = JSON.stringify(n), i = e.series.get(r), a = n, { maxSeries: o } = this.policy;
|
|
572
|
+
if (!i && o !== null && e.series.size >= o && (r = Nt, i = e.series.get(r), a = { [re]: !0 }), !i) {
|
|
419
573
|
let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
|
|
420
574
|
i = {
|
|
421
575
|
attributes: a,
|
|
@@ -423,10 +577,11 @@ var Ft = class {
|
|
|
423
577
|
sum: 0,
|
|
424
578
|
min: t,
|
|
425
579
|
max: t,
|
|
580
|
+
last: t,
|
|
426
581
|
buckets: o
|
|
427
582
|
}, e.series.set(r, i);
|
|
428
583
|
}
|
|
429
|
-
if (i.count += 1, i.sum += t, i.min = Math.min(i.min, t), i.max = Math.max(i.max, t), i.buckets.length > 0) {
|
|
584
|
+
if (i.count += 1, i.sum += t, i.min = Math.min(i.min, t), i.max = Math.max(i.max, t), i.last = t, i.buckets.length > 0) {
|
|
430
585
|
let n = e.def.boundaries.findIndex((e) => t <= e);
|
|
431
586
|
i.buckets[n === -1 ? i.buckets.length - 1 : n] += 1;
|
|
432
587
|
}
|
|
@@ -434,157 +589,45 @@ var Ft = class {
|
|
|
434
589
|
arm() {
|
|
435
590
|
this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
|
|
436
591
|
this.collect();
|
|
437
|
-
}, this.intervalMs()),
|
|
592
|
+
}, this.intervalMs()), O(this.timer));
|
|
438
593
|
}
|
|
439
|
-
},
|
|
594
|
+
}, Gt = {
|
|
440
595
|
TRACE: "debug",
|
|
441
596
|
DEBUG: "debug",
|
|
442
597
|
INFO: "info",
|
|
443
598
|
WARN: "warn",
|
|
444
599
|
ERROR: "error",
|
|
445
600
|
FATAL: "error"
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
limits;
|
|
450
|
-
constructor(e, t, n = p) {
|
|
451
|
-
this.settings = e, this.diagnostics = t, this.limits = n;
|
|
601
|
+
}, Kt = class {
|
|
602
|
+
constructor(e, t, n = ge) {
|
|
603
|
+
k(this, "settings", void 0), k(this, "diagnostics", void 0), k(this, "limits", void 0), this.settings = e, this.diagnostics = t, this.limits = n;
|
|
452
604
|
}
|
|
453
605
|
update(e) {
|
|
454
606
|
this.settings = e;
|
|
455
607
|
}
|
|
456
608
|
accepts(e) {
|
|
457
|
-
return this.settings.level === null || !
|
|
609
|
+
return this.settings.level === null || !ze(w, this.settings.level) ? !1 : w[e] >= w[this.settings.level];
|
|
458
610
|
}
|
|
459
611
|
write(e, t, n, r, i) {
|
|
460
|
-
if (!this.accepts(t) || typeof console > "u" ||
|
|
461
|
-
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s =
|
|
612
|
+
if (!this.accepts(t) || typeof console > "u" || Ye()) return;
|
|
613
|
+
let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = Gt[t];
|
|
462
614
|
this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
|
|
463
615
|
let c = [];
|
|
464
|
-
i !== void 0 && c.push(i), r !== void 0 && c.push(
|
|
616
|
+
i !== void 0 && c.push(i), r !== void 0 && c.push(Ze(r, this.limits, this.diagnostics)), M(() => {
|
|
465
617
|
console[s](a, o.namespace, e, o[t], "", n, ...c);
|
|
466
618
|
});
|
|
467
619
|
});
|
|
468
620
|
}
|
|
469
|
-
},
|
|
470
|
-
|
|
621
|
+
}, qt = class {
|
|
622
|
+
constructor() {
|
|
623
|
+
k(this, "value", 0);
|
|
624
|
+
}
|
|
471
625
|
next() {
|
|
472
626
|
return ++this.value;
|
|
473
627
|
}
|
|
474
|
-
},
|
|
475
|
-
function Ht(e) {
|
|
476
|
-
return zt.test(e.traceId) && Vt.test(e.traceId) && Bt.test(e.spanId) && Vt.test(e.spanId);
|
|
477
|
-
}
|
|
478
|
-
function Ut() {
|
|
479
|
-
return $e(16);
|
|
480
|
-
}
|
|
481
|
-
function Wt() {
|
|
482
|
-
return $e(8);
|
|
483
|
-
}
|
|
484
|
-
function Gt(e) {
|
|
485
|
-
return {
|
|
486
|
-
traceId: Ut(),
|
|
487
|
-
spanId: Wt(),
|
|
488
|
-
traceFlags: 1,
|
|
489
|
-
startedAt: Date.now(),
|
|
490
|
-
reason: e,
|
|
491
|
-
ended: !1
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
function Kt(e, t, n) {
|
|
495
|
-
return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
|
|
496
|
-
}
|
|
497
|
-
function qt(e) {
|
|
498
|
-
return {
|
|
499
|
-
traceId: e.traceId,
|
|
500
|
-
spanId: e.spanId,
|
|
501
|
-
traceFlags: e.traceFlags
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
var Jt = class {
|
|
505
|
-
diagnostics;
|
|
506
|
-
maxAgeMs;
|
|
507
|
-
load;
|
|
508
|
-
spans;
|
|
509
|
-
ambient = Gt("start");
|
|
510
|
-
otel;
|
|
511
|
-
constructor(e, t = o, n, r) {
|
|
512
|
-
this.diagnostics = e, this.maxAgeMs = t, this.load = n, this.spans = r;
|
|
513
|
-
}
|
|
514
|
-
async loadOtel() {
|
|
515
|
-
if (this.load) try {
|
|
516
|
-
this.otel = await this.load();
|
|
517
|
-
} catch (e) {
|
|
518
|
-
this.diagnostics.report("trace.otel_failed", "The library could not load @opentelemetry/api. Records use the trace ids of the library.", void 0, e);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
resolve() {
|
|
522
|
-
return this.activeSpanContext() ?? this.ambientContext();
|
|
523
|
-
}
|
|
524
|
-
ambientContext() {
|
|
525
|
-
return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), qt(this.ambient);
|
|
526
|
-
}
|
|
527
|
-
activeSpanContext() {
|
|
528
|
-
let e = this.otel;
|
|
529
|
-
if (e) return this.diagnostics.guard("trace.otel_failed", "The library could not read the active OpenTelemetry span.", () => {
|
|
530
|
-
let t = e.trace.getActiveSpan();
|
|
531
|
-
if (t === void 0) return;
|
|
532
|
-
let n = t.spanContext();
|
|
533
|
-
if (Ht(n)) return {
|
|
534
|
-
traceId: n.traceId,
|
|
535
|
-
spanId: n.spanId,
|
|
536
|
-
traceFlags: n.traceFlags
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
rotate(e) {
|
|
541
|
-
let t = this.ambient;
|
|
542
|
-
this.ambient = Gt(e);
|
|
543
|
-
let n = qt(this.ambient);
|
|
544
|
-
return this.finish(t), n;
|
|
545
|
-
}
|
|
546
|
-
end() {
|
|
547
|
-
this.finish(this.ambient);
|
|
548
|
-
}
|
|
549
|
-
finish(e) {
|
|
550
|
-
e.ended || (e.ended = !0, this.spans?.onEnd({
|
|
551
|
-
traceId: e.traceId,
|
|
552
|
-
spanId: e.spanId,
|
|
553
|
-
reason: e.reason,
|
|
554
|
-
startedAt: e.startedAt,
|
|
555
|
-
endedAt: Date.now()
|
|
556
|
-
}));
|
|
557
|
-
}
|
|
558
|
-
headers() {
|
|
559
|
-
return this.trace(!1).headers;
|
|
560
|
-
}
|
|
561
|
-
request() {
|
|
562
|
-
return this.trace(!0);
|
|
563
|
-
}
|
|
564
|
-
trace(e) {
|
|
565
|
-
let t = {}, n = this.otel;
|
|
566
|
-
if (n && this.diagnostics.guard("trace.otel_failed", "The library could not add the OpenTelemetry headers.", () => {
|
|
567
|
-
n.propagation.inject(n.context.active(), t);
|
|
568
|
-
}), t.traceparent) return { headers: t };
|
|
569
|
-
let r = this.activeSpanContext(), i = r ?? this.ambientContext(), a = r ? void 0 : this.spans;
|
|
570
|
-
if (!a?.enabled()) return t[ee] = Kt(i.traceId, i.spanId, i.traceFlags), { headers: t };
|
|
571
|
-
let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? Wt() : i.spanId;
|
|
572
|
-
return t[ee] = Kt(i.traceId, c, s), !e || !o ? { headers: t } : {
|
|
573
|
-
headers: t,
|
|
574
|
-
span: {
|
|
575
|
-
traceId: i.traceId,
|
|
576
|
-
spanId: c,
|
|
577
|
-
parentSpanId: i.spanId
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
}, Yt = class {
|
|
582
|
-
buffer;
|
|
583
|
-
pointer = 0;
|
|
584
|
-
filled = !1;
|
|
585
|
-
capacity;
|
|
628
|
+
}, Jt = class {
|
|
586
629
|
constructor(e) {
|
|
587
|
-
this.capacity = e === 0 ? 0 : Math.max(e, 1), this.buffer = Array(this.capacity);
|
|
630
|
+
k(this, "buffer", void 0), k(this, "pointer", 0), k(this, "filled", !1), k(this, "capacity", void 0), this.capacity = e === 0 ? 0 : Math.max(e, 1), this.buffer = Array(this.capacity);
|
|
588
631
|
}
|
|
589
632
|
resize(e) {
|
|
590
633
|
let t = this.snapshot().slice(-e);
|
|
@@ -593,467 +636,23 @@ var Jt = class {
|
|
|
593
636
|
push(e) {
|
|
594
637
|
this.capacity !== 0 && (this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0));
|
|
595
638
|
}
|
|
639
|
+
retain(e) {
|
|
640
|
+
let t = this.snapshot().filter(e);
|
|
641
|
+
this.clear();
|
|
642
|
+
for (let e of t) this.push(e);
|
|
643
|
+
}
|
|
596
644
|
clear() {
|
|
597
645
|
this.buffer.fill(void 0), this.pointer = 0, this.filled = !1;
|
|
598
646
|
}
|
|
599
|
-
snapshot() {
|
|
600
|
-
return (this.filled ? [...this.buffer.slice(this.pointer), ...this.buffer.slice(0, this.pointer)] : this.buffer.slice(0, this.pointer)).filter((e) => e !== void 0);
|
|
601
|
-
}
|
|
602
|
-
}, Xt = Object.keys(w), Zt = ["gzip", "none"], Qt = [
|
|
603
|
-
"omit",
|
|
604
|
-
"same-origin",
|
|
605
|
-
"include"
|
|
606
|
-
], $t = [
|
|
607
|
-
"auto",
|
|
608
|
-
"indexeddb",
|
|
609
|
-
"localstorage",
|
|
610
|
-
"memory",
|
|
611
|
-
"none"
|
|
612
|
-
], en = ["storage", "memory"], tn = [
|
|
613
|
-
"auto",
|
|
614
|
-
"sender",
|
|
615
|
-
"forwarder",
|
|
616
|
-
"off"
|
|
617
|
-
], nn = [
|
|
618
|
-
"auto",
|
|
619
|
-
"provider",
|
|
620
|
-
"client"
|
|
621
|
-
], rn = [
|
|
622
|
-
"auto",
|
|
623
|
-
"context",
|
|
624
|
-
"tab",
|
|
625
|
-
"origin"
|
|
626
|
-
], an = [
|
|
627
|
-
"error",
|
|
628
|
-
"warn",
|
|
629
|
-
"info",
|
|
630
|
-
"log"
|
|
631
|
-
], on = ["limited", "until-delivered"], sn = {
|
|
632
|
-
logFlushIntervalMs: [100, 6e4],
|
|
633
|
-
logBatchSize: [1, 1e3],
|
|
634
|
-
metricFlushIntervalMs: [100, 6e4],
|
|
635
|
-
metricBatchSize: [1, 1e3]
|
|
636
|
-
}, cn = {
|
|
637
|
-
maxBatches: [1, 5e3],
|
|
638
|
-
maxAgeMs: [6e4, 6048e5],
|
|
639
|
-
maxAttempts: [1, 20]
|
|
640
|
-
}, ln = {
|
|
641
|
-
maxBodyChars: [256, 65536],
|
|
642
|
-
maxAttributeChars: [256, 65536],
|
|
643
|
-
maxAttributeCount: [1, 1024],
|
|
644
|
-
maxStackChars: [256, 65536],
|
|
645
|
-
maxDepth: [1, 16],
|
|
646
|
-
maxArrayLength: [1, 1e4],
|
|
647
|
-
maxNodes: [100, 1e5],
|
|
648
|
-
maxRecordBytes: [1024, r]
|
|
649
|
-
}, un = [6e4, 864e5], I = [0, 2147483647], L = [0, 2 ** 53 - 1], dn = [1, 2 ** 53 - 1], fn = [100, 1e4], pn = {
|
|
650
|
-
capturePolicy: { ranges: {
|
|
651
|
-
breadcrumbs: [0, 1e6],
|
|
652
|
-
errorDedupeMs: I,
|
|
653
|
-
maxErrorSignatures: L,
|
|
654
|
-
errorsPerWindow: L,
|
|
655
|
-
consolePerWindow: L,
|
|
656
|
-
longFramesPerWindow: L,
|
|
657
|
-
webSocketPerWindow: L,
|
|
658
|
-
reportsPerWindow: L,
|
|
659
|
-
resourcesPerWindow: L,
|
|
660
|
-
lifecyclePerWindow: L,
|
|
661
|
-
windowMs: I,
|
|
662
|
-
errorCeiling: L
|
|
663
|
-
} },
|
|
664
|
-
metadata: { ranges: {} },
|
|
665
|
-
persistence: { ranges: {} },
|
|
666
|
-
diagnostics: {
|
|
667
|
-
ranges: { throttleMs: I },
|
|
668
|
-
custom: { records: jn }
|
|
669
|
-
},
|
|
670
|
-
correlation: { ranges: {
|
|
671
|
-
sessionIdleMs: I,
|
|
672
|
-
sessionTouchMs: I,
|
|
673
|
-
traceMaxAgeMs: I
|
|
674
|
-
} },
|
|
675
|
-
metrics: { ranges: {
|
|
676
|
-
maxSeries: L,
|
|
677
|
-
maxInstruments: L,
|
|
678
|
-
maxHistogramBoundaries: L
|
|
679
|
-
} },
|
|
680
|
-
buffering: {
|
|
681
|
-
ranges: {
|
|
682
|
-
maxPendingRecords: L,
|
|
683
|
-
maxPendingBytes: L
|
|
684
|
-
},
|
|
685
|
-
choices: { overflow: [
|
|
686
|
-
"drop-oldest",
|
|
687
|
-
"drop-newest",
|
|
688
|
-
"persist"
|
|
689
|
-
] }
|
|
690
|
-
},
|
|
691
|
-
delivery: {
|
|
692
|
-
ranges: {
|
|
693
|
-
requestTimeoutMs: [1, I[1]],
|
|
694
|
-
maxConcurrentRequests: dn,
|
|
695
|
-
retryBaseDelayMs: I,
|
|
696
|
-
retryMaxDelayMs: I,
|
|
697
|
-
retryIdleDelayMs: I,
|
|
698
|
-
batchesPerDrain: dn
|
|
699
|
-
},
|
|
700
|
-
choices: { priority: [
|
|
701
|
-
"low",
|
|
702
|
-
"auto",
|
|
703
|
-
"high"
|
|
704
|
-
] }
|
|
705
|
-
},
|
|
706
|
-
debugBuffer: { ranges: {
|
|
707
|
-
maxRecords: [1, 1e4],
|
|
708
|
-
maxAgeMs: I
|
|
709
|
-
} }
|
|
710
|
-
}, mn = [
|
|
711
|
-
"errors",
|
|
712
|
-
"rejections",
|
|
713
|
-
"resourceErrors",
|
|
714
|
-
"fetch",
|
|
715
|
-
"xhr",
|
|
716
|
-
"httpMetrics",
|
|
717
|
-
"navigation",
|
|
718
|
-
"webVitals",
|
|
719
|
-
"longFrames",
|
|
720
|
-
"fullUrls",
|
|
721
|
-
"webSocket",
|
|
722
|
-
"uncleanExit",
|
|
723
|
-
"userTiming",
|
|
724
|
-
"serverTiming",
|
|
725
|
-
"reports",
|
|
726
|
-
"lifecycle"
|
|
727
|
-
], hn = "null", R = `a level name: ${Sn(Xt)}`, gn = `true, false or a list of ${Sn(an)}`, _n = "a list of strings and RegExp patterns", vn = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", yn = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", bn = "a list of strings", xn = "true, false or a list of diagnostic codes";
|
|
728
|
-
function Sn(e) {
|
|
729
|
-
let t = e.map((e) => `"${e}"`);
|
|
730
|
-
return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
731
|
-
}
|
|
732
|
-
function Cn(e) {
|
|
733
|
-
return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
|
|
734
|
-
}
|
|
735
|
-
function z(e, t, n, r, i) {
|
|
736
|
-
e.report("config.invalid", `${t} must be ${n}. The value is ${Cn(r)}. The library keeps ${i}.`);
|
|
737
|
-
}
|
|
738
|
-
function B(e, t, n, r, i) {
|
|
739
|
-
if (t === void 0) return r;
|
|
740
|
-
let a = n.find((e) => e === t);
|
|
741
|
-
return a === void 0 ? (z(i, e, Sn(n), t, `"${r}"`), r) : a;
|
|
742
|
-
}
|
|
743
|
-
function V(e, t, n, r) {
|
|
744
|
-
return t === void 0 ? n : typeof t == "boolean" ? t : (z(r, e, "true or false", t, String(n)), n);
|
|
745
|
-
}
|
|
746
|
-
function wn(e, t, n, r) {
|
|
747
|
-
return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (z(r, e, "a finite number of 0 or more", t, String(n)), n);
|
|
748
|
-
}
|
|
749
|
-
function H(e, t, n, r, i) {
|
|
750
|
-
if (t === void 0) return r;
|
|
751
|
-
let [a, o] = n;
|
|
752
|
-
return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (z(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
|
|
753
|
-
}
|
|
754
|
-
function Tn(e, t, n) {
|
|
755
|
-
return e === void 0 ? t : e === null ? null : typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : (z(n, "loggerCache.maxEntries", "a nonnegative safe integer or null", e, String(t)), t);
|
|
756
|
-
}
|
|
757
|
-
function En(e, t, n, r, i) {
|
|
758
|
-
let a = t ?? {}, o = Object.keys(r);
|
|
759
|
-
return Object.fromEntries(o.map((t) => [t, H(`${e}.${t}`, a[t], r[t], n[t], i)]));
|
|
760
|
-
}
|
|
761
|
-
function U(e) {
|
|
762
|
-
if (typeof e != "string") return;
|
|
763
|
-
let t = e.toUpperCase();
|
|
764
|
-
return Xt.find((e) => e === t);
|
|
765
|
-
}
|
|
766
|
-
function Dn(e, t, n, r) {
|
|
767
|
-
if (t === void 0) return n;
|
|
768
|
-
let i = U(t);
|
|
769
|
-
return i === void 0 ? (z(r, e, R, t, `"${n}"`), n) : i;
|
|
770
|
-
}
|
|
771
|
-
function On(e, t, n) {
|
|
772
|
-
if (e === void 0) return t;
|
|
773
|
-
if (!E(e)) return z(n, "minLevels", "an object of level names", e, "the value in force"), t;
|
|
774
|
-
let r = [];
|
|
775
|
-
for (let [t, i] of Object.entries(e)) {
|
|
776
|
-
let e = U(i);
|
|
777
|
-
t !== "" && e !== void 0 ? r.push([t, e]) : z(n, `minLevels["${t}"]`, R, i, "minLevel for it");
|
|
778
|
-
}
|
|
779
|
-
return Object.fromEntries(r);
|
|
780
|
-
}
|
|
781
|
-
function W(e, t, n, r, i, a) {
|
|
782
|
-
if (t === void 0) return n;
|
|
783
|
-
if (!Array.isArray(t)) return z(a, e, r, t, "the list in force"), n;
|
|
784
|
-
let o = [], s = t;
|
|
785
|
-
for (let t of s) {
|
|
786
|
-
let n = i(t);
|
|
787
|
-
n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${Cn(t)}. ${e} must be ${r}.`) : o.push(n);
|
|
788
|
-
}
|
|
789
|
-
return o;
|
|
790
|
-
}
|
|
791
|
-
function kn(e) {
|
|
792
|
-
return typeof e == "function" ? e : void 0;
|
|
793
|
-
}
|
|
794
|
-
function An(e) {
|
|
795
|
-
return E(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
|
|
796
|
-
}
|
|
797
|
-
function jn(e, t, n, r) {
|
|
798
|
-
return t === void 0 || typeof t == "boolean" ? t ?? n : Array.isArray(t) ? W(e, t, [], xn, Mn, r) : (z(r, e, xn, t, "the value in force"), n);
|
|
799
|
-
}
|
|
800
|
-
function Mn(e) {
|
|
801
|
-
return typeof e == "string" ? e : void 0;
|
|
802
|
-
}
|
|
803
|
-
function Nn(e) {
|
|
804
|
-
return typeof e == "string" || e instanceof RegExp ? e : void 0;
|
|
805
|
-
}
|
|
806
|
-
function Pn(e) {
|
|
807
|
-
return an.find((t) => t === e);
|
|
808
|
-
}
|
|
809
|
-
function Fn(e) {
|
|
810
|
-
if (typeof e == "string") try {
|
|
811
|
-
let { origin: t } = new URL(e);
|
|
812
|
-
return t === hn ? void 0 : t;
|
|
813
|
-
} catch {
|
|
814
|
-
return;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
function In(e) {
|
|
818
|
-
return e instanceof RegExp ? e : Fn(e);
|
|
819
|
-
}
|
|
820
|
-
function Ln(e) {
|
|
821
|
-
return E(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
|
|
822
|
-
}
|
|
823
|
-
function Rn(e, t, n) {
|
|
824
|
-
if (e !== void 0) return typeof e == "function" || Ln(e) ? e : (n.report("config.invalid", "headers must be an object of strings or a function. The library keeps the headers in force."), t);
|
|
825
|
-
}
|
|
826
|
-
function zn(e) {
|
|
827
|
-
return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
|
|
828
|
-
}
|
|
829
|
-
function Bn(e, t, n) {
|
|
830
|
-
return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || zn(e) ? e : (n.report("config.invalid", `serializer must be "${S}", "ecs" or an implementation. The library uses "${S}".`), S);
|
|
831
|
-
}
|
|
832
|
-
var Vn = new Set(Object.keys(m));
|
|
833
|
-
function Hn(e, t) {
|
|
834
|
-
let n = {}, r = Object.entries(e ?? {});
|
|
835
|
-
for (let [e, i] of r) Vn.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
|
|
836
|
-
return n;
|
|
837
|
-
}
|
|
838
|
-
function Un(e, t, n) {
|
|
839
|
-
if (e === void 0) return t ?? "DEBUG";
|
|
840
|
-
let r = U(e);
|
|
841
|
-
return r === void 0 ? (z(n, "console.level", R, e, "the console level in force"), t) : r;
|
|
842
|
-
}
|
|
843
|
-
function Wn(e, t, n) {
|
|
844
|
-
if (e === void 0) return t;
|
|
845
|
-
if (e === !1) return {
|
|
846
|
-
level: null,
|
|
847
|
-
styles: t.styles
|
|
848
|
-
};
|
|
849
|
-
if (e === !0) return {
|
|
850
|
-
level: l,
|
|
851
|
-
styles: t.styles
|
|
852
|
-
};
|
|
853
|
-
if (typeof e == "string") {
|
|
854
|
-
let r = U(e);
|
|
855
|
-
return r === void 0 ? (z(n, "console", R, e, "the console level in force"), t) : {
|
|
856
|
-
level: r,
|
|
857
|
-
styles: t.styles
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
return typeof e != "object" || !e ? (n.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), t) : {
|
|
861
|
-
level: Un(e.level, t.level, n),
|
|
862
|
-
styles: {
|
|
863
|
-
...t.styles,
|
|
864
|
-
...Hn(e.styles, n)
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
function Gn(e, t, n) {
|
|
869
|
-
let r = e ?? {};
|
|
870
|
-
return {
|
|
871
|
-
...t,
|
|
872
|
-
...r,
|
|
873
|
-
rates: {
|
|
874
|
-
...t.rates,
|
|
875
|
-
...r.rates
|
|
876
|
-
},
|
|
877
|
-
alwaysSampleTypes: W("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, bn, Mn, n),
|
|
878
|
-
alwaysSampleFrom: Dn("sampling.alwaysSampleFrom", r.alwaysSampleFrom, t.alwaysSampleFrom, n),
|
|
879
|
-
remote: V("sampling.remote", r.remote, t.remote, n)
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
function Kn(e, t, n) {
|
|
883
|
-
let r = e ?? {};
|
|
884
|
-
return {
|
|
885
|
-
maxTrackedSources: H("bus.maxTrackedSources", r.maxTrackedSources, [0, 2 ** 53 - 1], t.maxTrackedSources, n),
|
|
886
|
-
sourcePolicy: B("bus.sourcePolicy", r.sourcePolicy, ["registered", "trusted-origin"], t.sourcePolicy, n),
|
|
887
|
-
validation: B("bus.validation", r.validation, ["strict", "envelope"], t.validation, n),
|
|
888
|
-
maxMessageBytes: H("bus.maxMessageBytes", r.maxMessageBytes, [0, 2 ** 53 - 1], t.maxMessageBytes, n),
|
|
889
|
-
maxRecordsPerMessage: H("bus.maxRecordsPerMessage", r.maxRecordsPerMessage, [0, 2 ** 53 - 1], t.maxRecordsPerMessage, n),
|
|
890
|
-
maxMessagesPerSecond: H("bus.maxMessagesPerSecond", r.maxMessagesPerSecond, [0, 2 ** 53 - 1], t.maxMessagesPerSecond, n),
|
|
891
|
-
mode: B("bus.mode", r.mode, tn, t.mode, n),
|
|
892
|
-
trustedOrigins: W("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, yn, Fn, n),
|
|
893
|
-
openFinRole: B("bus.openFinRole", r.openFinRole, nn, t.openFinRole, n)
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
function qn(e, t, n) {
|
|
897
|
-
let r = e ?? {};
|
|
898
|
-
return {
|
|
899
|
-
scope: B("journey.scope", r.scope, rn, t.scope, n),
|
|
900
|
-
maxAgeMs: H("journey.maxAgeMs", r.maxAgeMs, un, t.maxAgeMs, n)
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
function Jn(e, t, n) {
|
|
904
|
-
let r = e ?? {};
|
|
905
|
-
return {
|
|
906
|
-
mode: B("retention.mode", r.mode, on, t.mode, n),
|
|
907
|
-
...En("retention", r, t, cn, n)
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
function Yn(e, t, n) {
|
|
911
|
-
return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? W("capture.console", e, [], gn, Pn, n) : (z(n, "capture.console", gn, e, "the value in force"), t);
|
|
912
|
-
}
|
|
913
|
-
function Xn(e, t, n) {
|
|
914
|
-
let r = e ?? {}, i = {
|
|
915
|
-
...t,
|
|
916
|
-
...r,
|
|
917
|
-
remoteToggles: W("capture.remoteToggles", r.remoteToggles, t.remoteToggles, "a list of capture switch names without privacy controls", (e) => ke.find((t) => t === e), n),
|
|
918
|
-
resourceTiming: Zn(r.resourceTiming, t.resourceTiming, n),
|
|
919
|
-
interactions: Qn(r.interactions, t.interactions, n),
|
|
920
|
-
console: Yn(r.console, t.console, n),
|
|
921
|
-
longFrameThresholdMs: wn("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
|
|
922
|
-
ignoreUrls: W("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, _n, Nn, n),
|
|
923
|
-
userTimingInclude: W("capture.userTimingInclude", r.userTimingInclude, t.userTimingInclude, _n, Nn, n),
|
|
924
|
-
propagateTraceHeaderTo: W("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, vn, In, n),
|
|
925
|
-
plugins: W("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", An, n)
|
|
926
|
-
};
|
|
927
|
-
for (let e of mn) i[e] = V(`capture.${e}`, r[e], t[e], n);
|
|
928
|
-
return i;
|
|
929
|
-
}
|
|
930
|
-
function Zn(e, t, n) {
|
|
931
|
-
return e === void 0 ? t : typeof e == "boolean" ? e : E(e) ? { slowMs: wn("capture.resourceTiming.slowMs", e.slowMs, typeof t == "object" ? t.slowMs ?? 1e3 : Ee, n) } : (n.report("config.invalid", "capture.resourceTiming must be a boolean or an options object."), t);
|
|
932
|
-
}
|
|
933
|
-
function Qn(e, t, n) {
|
|
934
|
-
if (e === void 0) return t;
|
|
935
|
-
if (typeof e == "boolean") return e;
|
|
936
|
-
if (!E(e)) return n.report("config.invalid", "capture.interactions must be a boolean or an options object."), t;
|
|
937
|
-
let r = typeof t == "object" ? t : {}, i = e.ignoreSelector, a = i === void 0 ? r.ignoreSelector : i;
|
|
938
|
-
if (a != null) try {
|
|
939
|
-
if (typeof a != "string") throw Error("Invalid selector");
|
|
940
|
-
typeof document < "u" && document.createElement("div").matches(a);
|
|
941
|
-
} catch {
|
|
942
|
-
n.report("config.invalid", "capture.interactions.ignoreSelector must be a valid CSS selector or null."), a = r.ignoreSelector;
|
|
943
|
-
}
|
|
944
|
-
let o = r.actionAttribute ?? "data-observability-action";
|
|
945
|
-
return e.actionAttribute !== void 0 && (typeof e.actionAttribute == "string" && /^[a-z][\w-]*$/i.test(e.actionAttribute) ? o = e.actionAttribute : z(n, "capture.interactions.actionAttribute", "an attribute name of letters, digits, hyphens and underscores", e.actionAttribute, `"${o}"`)), {
|
|
946
|
-
actionAttribute: o,
|
|
947
|
-
text: V("capture.interactions.text", e.text, r.text ?? !1, n),
|
|
948
|
-
selector: V("capture.interactions.selector", e.selector, r.selector ?? !1, n),
|
|
949
|
-
ignoreSelector: typeof a == "string" || a === null ? a : void 0,
|
|
950
|
-
maxTextChars: H("capture.interactions.maxTextChars", e.maxTextChars, [0, 2 ** 53 - 1], r.maxTextChars ?? 50, n),
|
|
951
|
-
rageClicks: V("capture.interactions.rageClicks", e.rageClicks, r.rageClicks ?? !1, n),
|
|
952
|
-
rageClickCount: H("capture.interactions.rageClickCount", e.rageClickCount, [2, 20], r.rageClickCount ?? 3, n),
|
|
953
|
-
rageClickWindowMs: H("capture.interactions.rageClickWindowMs", e.rageClickWindowMs, fn, r.rageClickWindowMs ?? 1e3, n),
|
|
954
|
-
deadClicks: V("capture.interactions.deadClicks", e.deadClicks, r.deadClicks ?? !1, n),
|
|
955
|
-
deadClickMs: H("capture.interactions.deadClickMs", e.deadClickMs, fn, r.deadClickMs ?? 1e3, n)
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
var $n = {
|
|
959
|
-
metricsEndpoint: "The library sends metric records as log records.",
|
|
960
|
-
tracesEndpoint: "The library sends no span."
|
|
961
|
-
};
|
|
962
|
-
function er(e, t, n, r, i) {
|
|
963
|
-
let a = n;
|
|
964
|
-
if (typeof t == "string" && t !== "") try {
|
|
965
|
-
new URL(t), a = t;
|
|
966
|
-
} catch (n) {
|
|
967
|
-
i.report("config.invalid", `${e} is not a valid absolute URL: ${D(t, !1)}. The library keeps the value in force.`, void 0, n);
|
|
968
|
-
}
|
|
969
|
-
else t === "" ? a = "" : t !== void 0 && z(i, e, "a URL string", t, "the value in force");
|
|
970
|
-
return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${S}". ${$n[e]}`), "") : a;
|
|
971
|
-
}
|
|
972
|
-
function tr(e, t, n, r, i) {
|
|
973
|
-
let a = { ...n };
|
|
974
|
-
for (let o of Object.keys(n)) {
|
|
975
|
-
let s = t?.[o], c = n[o], l = r.ranges[o], u = r.choices?.[o], d = r.custom?.[o], f = c;
|
|
976
|
-
d ? f = d(`${e}.${o}`, s, c, i) : typeof c == "number" && l ? f = H(`${e}.${o}`, s, l, c, i) : typeof c == "boolean" ? f = V(`${e}.${o}`, s, c, i) : u ? f = B(`${e}.${o}`, s, u, String(c), i) : s === void 0 || typeof s == "string" ? f = s ?? c : z(i, `${e}.${o}`, "a string", s, String(c)), Object.assign(a, { [o]: f });
|
|
977
|
-
}
|
|
978
|
-
return a;
|
|
979
|
-
}
|
|
980
|
-
function G(e, t, n) {
|
|
981
|
-
let r = n ?? re, i = Object.fromEntries(Object.keys(pn).map((n) => [n, tr(n, e[n], r[n], pn[n], t)])), a = {
|
|
982
|
-
...r,
|
|
983
|
-
...e,
|
|
984
|
-
...i,
|
|
985
|
-
lockConfiguration: V("lockConfiguration", e.lockConfiguration, r.lockConfiguration, t),
|
|
986
|
-
loggerCache: { maxEntries: Tn(e.loggerCache?.maxEntries, r.loggerCache.maxEntries, t) },
|
|
987
|
-
securityContext: {
|
|
988
|
-
id: typeof e.securityContext?.id == "string" && e.securityContext.id || r.securityContext.id,
|
|
989
|
-
isolation: V("securityContext.isolation", e.securityContext?.isolation, r.securityContext.isolation, t)
|
|
990
|
-
},
|
|
991
|
-
endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
|
|
992
|
-
enabled: V("enabled", e.enabled, r.enabled, t),
|
|
993
|
-
payloadMode: B("payloadMode", e.payloadMode, ["copy", "defer"], r.payloadMode, t),
|
|
994
|
-
minLevel: Dn("minLevel", e.minLevel, r.minLevel, t),
|
|
995
|
-
minLevels: On(e.minLevels, r.minLevels, t),
|
|
996
|
-
processors: W("processors", e.processors, r.processors, "a list of functions", kn, t),
|
|
997
|
-
compression: B("compression", e.compression, Zt, r.compression, t),
|
|
998
|
-
credentials: B("credentials", e.credentials, Qt, r.credentials, t),
|
|
999
|
-
headers: "headers" in e ? Rn(e.headers, r.headers, t) : r.headers,
|
|
1000
|
-
storage: B("storage", e.storage, $t, r.storage, t),
|
|
1001
|
-
identity: B("identity", e.identity, en, r.identity, t),
|
|
1002
|
-
serializer: Bn(e.serializer, n?.serializer, t),
|
|
1003
|
-
console: Wn(e.console, r.console, t),
|
|
1004
|
-
sampling: Gn(e.sampling, r.sampling, t),
|
|
1005
|
-
bus: Kn(e.bus, r.bus, t),
|
|
1006
|
-
batching: En("batching", e.batching, r.batching, sn, t),
|
|
1007
|
-
retention: Jn(e.retention, r.retention, t),
|
|
1008
|
-
limits: En("limits", e.limits, r.limits, ln, t),
|
|
1009
|
-
journey: qn(e.journey, r.journey, t),
|
|
1010
|
-
capture: Xn(e.capture, r.capture, t)
|
|
1011
|
-
};
|
|
1012
|
-
for (let n of ["metricsEndpoint", "tracesEndpoint"]) a[n] = er(n, e[n], r[n], a.serializer, t);
|
|
1013
|
-
if (a.transport !== void 0 && typeof a.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), a.transport = r.transport), a.onDrop !== void 0 && typeof a.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), a.onDrop = r.onDrop), a.contextProvider !== void 0 && typeof a.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), a.contextProvider = r.contextProvider), a.transportWorker !== void 0 && typeof a.transportWorker != "function" && (t.report("config.invalid", "transportWorker must be a function. The library keeps the value in force."), a.transportWorker = r.transportWorker), a.transportOnExit !== void 0 && typeof a.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), a.transportOnExit = r.transportOnExit), a.endpoint === "") a.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
|
|
1014
|
-
else if (a.endpoint !== null) try {
|
|
1015
|
-
new URL(a.endpoint);
|
|
1016
|
-
} catch (e) {
|
|
1017
|
-
t.report("config.invalid", `endpoint is not a valid absolute URL: ${D(a.endpoint, !1)}.`, void 0, e);
|
|
1018
|
-
}
|
|
1019
|
-
for (let e of ["metricsEndpoint", "tracesEndpoint"]) a[e] !== "" && a.endpoint === null && !a.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
|
|
1020
|
-
a.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${oe}'.`), oe);
|
|
1021
|
-
let o = a.sampling.defaultRate;
|
|
1022
|
-
(typeof o != "number" || o < 0 || o > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(o)}. The library uses 1.`), a.sampling.defaultRate = 1);
|
|
1023
|
-
let s = a.sampling.remoteMaxRate;
|
|
1024
|
-
typeof s == "number" && s >= 0 && s <= 1 || (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(s)}. The library uses 1.`), a.sampling.remoteMaxRate = 1);
|
|
1025
|
-
let c = Object.entries(a.sampling.rates);
|
|
1026
|
-
for (let [e, n] of c) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), a.sampling.rates[e] = 1);
|
|
1027
|
-
a.capture.ignoreUrls = a.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
|
|
1028
|
-
for (let e of [
|
|
1029
|
-
a.endpoint,
|
|
1030
|
-
a.metricsEndpoint,
|
|
1031
|
-
a.tracesEndpoint
|
|
1032
|
-
]) e && !a.capture.ignoreUrls.includes(e) && (a.capture.ignoreUrls = [...a.capture.ignoreUrls, e]);
|
|
1033
|
-
return a.delivery.retryMaxDelayMs < a.delivery.retryBaseDelayMs && (t.report("config.invalid", "delivery.retryMaxDelayMs must be at least retryBaseDelayMs."), a.delivery.retryBaseDelayMs = r.delivery.retryBaseDelayMs, a.delivery.retryMaxDelayMs = r.delivery.retryMaxDelayMs), a.capture.urlTransform !== void 0 && typeof a.capture.urlTransform != "function" && (t.report("config.invalid", "capture.urlTransform must be a function."), a.capture.urlTransform = r.capture.urlTransform), nr(e, t), a;
|
|
1034
|
-
}
|
|
1035
|
-
function nr(e, t) {
|
|
1036
|
-
let n = /* @__PURE__ */ new Set([...Object.keys(re), ...c]);
|
|
1037
|
-
for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `The library ignores the unknown config key "${r}". Check the spelling.`);
|
|
1038
|
-
for (let n of a) {
|
|
1039
|
-
let r = e[n];
|
|
1040
|
-
if (typeof r != "object" || !r) continue;
|
|
1041
|
-
let i = /* @__PURE__ */ new Set([...Object.keys(re[n]), ...ie[n]]);
|
|
1042
|
-
for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `The library ignores the unknown config key "${n}.${e}". Check the spelling.`);
|
|
647
|
+
snapshot() {
|
|
648
|
+
return (this.filled ? [...this.buffer.slice(this.pointer), ...this.buffer.slice(0, this.pointer)] : this.buffer.slice(0, this.pointer)).filter((e) => e !== void 0);
|
|
1043
649
|
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
for (let n of a) Object.assign(e[n], t[n]);
|
|
1048
|
-
}
|
|
1049
|
-
// src/core/context.ts
|
|
1050
|
-
var ir = class {
|
|
1051
|
-
map = /* @__PURE__ */ new Map();
|
|
1052
|
-
set(e, t) {
|
|
1053
|
-
this.map.set(e, t);
|
|
650
|
+
}, Yt = class {
|
|
651
|
+
constructor() {
|
|
652
|
+
k(this, "map", /* @__PURE__ */ new Map());
|
|
1054
653
|
}
|
|
1055
|
-
|
|
1056
|
-
for (let [t, n] of Object.entries(e)) this.map.set(t, n);
|
|
654
|
+
merge(e) {
|
|
655
|
+
for (let [t, n] of Object.entries(e)) n === null ? this.map.delete(t) : n !== void 0 && this.map.set(t, n);
|
|
1057
656
|
}
|
|
1058
657
|
remove(e) {
|
|
1059
658
|
this.map.delete(e);
|
|
@@ -1064,11 +663,9 @@ var ir = class {
|
|
|
1064
663
|
getAll() {
|
|
1065
664
|
return Object.fromEntries(this.map);
|
|
1066
665
|
}
|
|
1067
|
-
},
|
|
1068
|
-
policy;
|
|
1069
|
-
kept = [];
|
|
666
|
+
}, Xt = class {
|
|
1070
667
|
constructor(e) {
|
|
1071
|
-
this.policy = e;
|
|
668
|
+
k(this, "policy", void 0), k(this, "kept", []), this.policy = e;
|
|
1072
669
|
}
|
|
1073
670
|
push(e) {
|
|
1074
671
|
let { enabled: t, maxRecords: n } = this.policy();
|
|
@@ -1083,7 +680,7 @@ var ir = class {
|
|
|
1083
680
|
...e,
|
|
1084
681
|
attributes: {
|
|
1085
682
|
...e.attributes,
|
|
1086
|
-
[
|
|
683
|
+
[Ee]: !0
|
|
1087
684
|
}
|
|
1088
685
|
}));
|
|
1089
686
|
}
|
|
@@ -1093,20 +690,15 @@ var ir = class {
|
|
|
1093
690
|
live() {
|
|
1094
691
|
let { enabled: e, maxRecords: t, maxAgeMs: n } = this.policy();
|
|
1095
692
|
if (!e) return this.kept = [], [];
|
|
1096
|
-
let r = n ===
|
|
693
|
+
let r = n === null ? -Infinity : Date.now() - n;
|
|
1097
694
|
return this.kept.slice(-t).filter((e) => e.at >= r);
|
|
1098
695
|
}
|
|
1099
696
|
clear() {
|
|
1100
697
|
this.kept = [];
|
|
1101
698
|
}
|
|
1102
|
-
},
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
consoleFallback;
|
|
1106
|
-
counters = /* @__PURE__ */ new Map();
|
|
1107
|
-
lastEmitted = /* @__PURE__ */ new Map();
|
|
1108
|
-
constructor(e, t = d, n = !1) {
|
|
1109
|
-
this.handler = e, this.throttleMs = t, this.consoleFallback = n;
|
|
699
|
+
}, V = class {
|
|
700
|
+
constructor(e, t = ne, n = !1) {
|
|
701
|
+
k(this, "handler", void 0), k(this, "throttleMs", void 0), k(this, "consoleFallback", void 0), k(this, "counters", /* @__PURE__ */ new Map()), k(this, "lastEmitted", /* @__PURE__ */ new Map()), this.handler = e, this.throttleMs = t, this.consoleFallback = n;
|
|
1110
702
|
}
|
|
1111
703
|
setPolicy(e, t) {
|
|
1112
704
|
this.throttleMs = e, this.consoleFallback = t;
|
|
@@ -1119,26 +711,28 @@ var ir = class {
|
|
|
1119
711
|
return this.counters.set(e, n), n;
|
|
1120
712
|
}
|
|
1121
713
|
report(e, t, n, r) {
|
|
1122
|
-
let
|
|
1123
|
-
if (
|
|
1124
|
-
this.lastEmitted.set(e,
|
|
1125
|
-
let
|
|
714
|
+
let i = this.count(e), a = Date.now();
|
|
715
|
+
if (a - (this.lastEmitted.get(e) ?? 0) < this.throttleMs) return !1;
|
|
716
|
+
this.lastEmitted.set(e, a);
|
|
717
|
+
let o = {
|
|
1126
718
|
code: e,
|
|
1127
719
|
message: t,
|
|
1128
720
|
detail: n,
|
|
1129
721
|
cause: r,
|
|
1130
|
-
at:
|
|
1131
|
-
count:
|
|
1132
|
-
}, { handler:
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
|
|
722
|
+
at: a,
|
|
723
|
+
count: i
|
|
724
|
+
}, { handler: s } = this;
|
|
725
|
+
if (!s) return !0;
|
|
726
|
+
try {
|
|
727
|
+
M(() => {
|
|
728
|
+
s(o);
|
|
1136
729
|
});
|
|
1137
730
|
} catch {
|
|
1138
|
-
this.count("handler.threw"), this.consoleFallback && typeof console < "u" &&
|
|
1139
|
-
console.warn(`${
|
|
731
|
+
this.count("handler.threw"), this.consoleFallback && typeof console < "u" && M(() => {
|
|
732
|
+
console.warn(`${de} The onDiagnostic handler threw an error.`);
|
|
1140
733
|
});
|
|
1141
734
|
}
|
|
735
|
+
return !0;
|
|
1142
736
|
}
|
|
1143
737
|
guard(e, t, n) {
|
|
1144
738
|
try {
|
|
@@ -1161,39 +755,37 @@ var ir = class {
|
|
|
1161
755
|
}
|
|
1162
756
|
};
|
|
1163
757
|
// src/core/drops.ts
|
|
1164
|
-
function
|
|
758
|
+
function Zt(e, t) {
|
|
1165
759
|
e.length < 20 && !e.includes(t) && e.push(t);
|
|
1166
760
|
}
|
|
1167
|
-
var
|
|
1168
|
-
config;
|
|
1169
|
-
diagnostics;
|
|
1170
|
-
pending = /* @__PURE__ */ new Map();
|
|
1171
|
-
scheduled = !1;
|
|
1172
|
-
reporting = !1;
|
|
761
|
+
var Qt = class {
|
|
1173
762
|
constructor(e, t) {
|
|
1174
|
-
this.config = e, this.diagnostics = t;
|
|
763
|
+
k(this, "config", void 0), k(this, "diagnostics", void 0), k(this, "pending", /* @__PURE__ */ new Map()), k(this, "scheduled", !1), k(this, "reporting", !1), k(this, "lost", {}), this.config = e, this.diagnostics = t;
|
|
1175
764
|
}
|
|
1176
|
-
add(e, t, n = []) {
|
|
1177
|
-
if (!this.config.onDrop || this.reporting || t.length === 0 && n.length === 0) return;
|
|
1178
|
-
let
|
|
1179
|
-
|
|
765
|
+
add(e, t, n = [], r = t.length) {
|
|
766
|
+
if (r > 0 && (this.lost[e] = (this.lost[e] ?? 0) + r), !this.config.onDrop || this.reporting || t.length === 0 && n.length === 0) return;
|
|
767
|
+
let i = this.pending.get(e);
|
|
768
|
+
i || (i = {
|
|
1180
769
|
reason: e,
|
|
1181
770
|
records: 0,
|
|
1182
771
|
batchIds: [],
|
|
1183
772
|
journeyIds: [],
|
|
1184
773
|
actions: []
|
|
1185
|
-
}, this.pending.set(e,
|
|
1186
|
-
for (let e of n)
|
|
774
|
+
}, this.pending.set(e, i)), i.records += r;
|
|
775
|
+
for (let e of n) Zt(i.batchIds, e);
|
|
1187
776
|
for (let e of t) {
|
|
1188
|
-
let t =
|
|
1189
|
-
typeof t == "string" &&
|
|
1190
|
-
let n =
|
|
1191
|
-
typeof n == "string" &&
|
|
777
|
+
let t = tt(e, x);
|
|
778
|
+
typeof t == "string" && Zt(i.journeyIds, t);
|
|
779
|
+
let n = et(e) ? e.body : void 0;
|
|
780
|
+
typeof n == "string" && Zt(i.actions, n);
|
|
1192
781
|
}
|
|
1193
782
|
this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
|
|
1194
783
|
this.flush();
|
|
1195
784
|
}));
|
|
1196
785
|
}
|
|
786
|
+
counts() {
|
|
787
|
+
return { ...this.lost };
|
|
788
|
+
}
|
|
1197
789
|
flush() {
|
|
1198
790
|
this.scheduled = !1;
|
|
1199
791
|
let e = [...this.pending.values()];
|
|
@@ -1202,8 +794,8 @@ var cr = class {
|
|
|
1202
794
|
if (t) {
|
|
1203
795
|
this.reporting = !0;
|
|
1204
796
|
for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
|
|
1205
|
-
|
|
1206
|
-
|
|
797
|
+
Qe(() => {
|
|
798
|
+
M(() => {
|
|
1207
799
|
t(n);
|
|
1208
800
|
});
|
|
1209
801
|
});
|
|
@@ -1211,137 +803,121 @@ var cr = class {
|
|
|
1211
803
|
this.reporting = !1;
|
|
1212
804
|
}
|
|
1213
805
|
}
|
|
1214
|
-
},
|
|
1215
|
-
onDrop;
|
|
1216
|
-
held = [];
|
|
1217
|
-
actions = 0;
|
|
806
|
+
}, $t = class {
|
|
1218
807
|
constructor(e) {
|
|
1219
|
-
this
|
|
808
|
+
k(this, "onDrop", void 0), k(this, "actions", {
|
|
809
|
+
head: [],
|
|
810
|
+
tail: []
|
|
811
|
+
}), k(this, "others", {
|
|
812
|
+
head: [],
|
|
813
|
+
tail: []
|
|
814
|
+
}), k(this, "arrivals", 0), this.onDrop = e;
|
|
1220
815
|
}
|
|
1221
816
|
get records() {
|
|
1222
|
-
return this.
|
|
817
|
+
return this.inOrder();
|
|
1223
818
|
}
|
|
1224
819
|
get length() {
|
|
1225
|
-
|
|
820
|
+
let { actions: e, others: t } = this;
|
|
821
|
+
return e.head.length + e.tail.length + t.head.length + t.tail.length;
|
|
1226
822
|
}
|
|
1227
|
-
push(e) {
|
|
1228
|
-
let
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
823
|
+
push(e, t) {
|
|
824
|
+
let n = et(e), r = n ? this.actions : this.others, i = n ? ue : t, a = {
|
|
825
|
+
record: e,
|
|
826
|
+
arrival: this.arrivals
|
|
827
|
+
};
|
|
828
|
+
if (this.arrivals += 1, r.head.length < 100) r.head.push(a);
|
|
829
|
+
else if (r.tail.push(a), r.head.length + r.tail.length > i) {
|
|
830
|
+
let e = r.tail[0];
|
|
831
|
+
r.tail.shift(), this.onDrop(e.record);
|
|
1233
832
|
}
|
|
1234
|
-
this.held.push(e);
|
|
1235
833
|
}
|
|
1236
834
|
take() {
|
|
1237
|
-
let e = this.
|
|
1238
|
-
return this.
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
}), n && r.span({
|
|
1258
|
-
name: s.name,
|
|
1259
|
-
kind: "internal",
|
|
1260
|
-
traceId: n.traceId,
|
|
1261
|
-
spanId: Wt(),
|
|
1262
|
-
parentSpanId: n.spanId,
|
|
1263
|
-
startMs: l(s.at),
|
|
1264
|
-
endMs: l(e),
|
|
1265
|
-
error: a,
|
|
1266
|
-
attributes: { "measure.name": i }
|
|
1267
|
-
}), void 0);
|
|
1268
|
-
};
|
|
1269
|
-
return {
|
|
1270
|
-
phase: (e) => {
|
|
1271
|
-
if (c) return;
|
|
1272
|
-
let t = performance.now();
|
|
1273
|
-
u(t, !1), s = {
|
|
1274
|
-
name: String(e),
|
|
1275
|
-
at: t
|
|
1276
|
-
};
|
|
1277
|
-
},
|
|
1278
|
-
end: (e = "ok") => {
|
|
1279
|
-
if (c) return;
|
|
1280
|
-
c = !0;
|
|
1281
|
-
let s = performance.now(), d = e === "error";
|
|
1282
|
-
u(s, d);
|
|
1283
|
-
let f = {
|
|
1284
|
-
...t,
|
|
1285
|
-
"measure.outcome": e
|
|
1286
|
-
};
|
|
1287
|
-
r.metric(ur, s - o, {
|
|
1288
|
-
...f,
|
|
1289
|
-
"measure.name": i
|
|
1290
|
-
}), n && r.span({
|
|
1291
|
-
...n,
|
|
1292
|
-
name: i,
|
|
1293
|
-
kind: "internal",
|
|
1294
|
-
startMs: a,
|
|
1295
|
-
endMs: l(s),
|
|
1296
|
-
error: d,
|
|
1297
|
-
attributes: f
|
|
1298
|
-
});
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
// src/core/record.ts
|
|
1303
|
-
var pr = "error.", mr = [
|
|
1304
|
-
C,
|
|
835
|
+
let e = this.inOrder();
|
|
836
|
+
return this.actions = {
|
|
837
|
+
head: [],
|
|
838
|
+
tail: []
|
|
839
|
+
}, this.others = {
|
|
840
|
+
head: [],
|
|
841
|
+
tail: []
|
|
842
|
+
}, this.arrivals = 0, e;
|
|
843
|
+
}
|
|
844
|
+
inOrder() {
|
|
845
|
+
let { actions: e, others: t } = this;
|
|
846
|
+
return [
|
|
847
|
+
...e.head,
|
|
848
|
+
...e.tail,
|
|
849
|
+
...t.head,
|
|
850
|
+
...t.tail
|
|
851
|
+
].sort((e, t) => e.arrival - t.arrival).map((e) => e.record);
|
|
852
|
+
}
|
|
853
|
+
}, en = "error.", tn = [
|
|
854
|
+
T,
|
|
1305
855
|
x,
|
|
1306
|
-
|
|
1307
|
-
],
|
|
856
|
+
ve
|
|
857
|
+
], nn = {
|
|
1308
858
|
processor: {
|
|
1309
859
|
label: "A processor",
|
|
1310
|
-
code: "record.dropped_by_processor"
|
|
860
|
+
code: "record.dropped_by_processor",
|
|
861
|
+
refused: "processors is not a list of functions. The library drops each record until processors is a list of functions or []."
|
|
1311
862
|
},
|
|
1312
863
|
redact: {
|
|
1313
864
|
label: "The redact hook",
|
|
1314
|
-
code: "record.dropped_by_redact"
|
|
1315
|
-
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
"metric.
|
|
1319
|
-
"metric.
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
]
|
|
1324
|
-
|
|
1325
|
-
|
|
865
|
+
code: "record.dropped_by_redact",
|
|
866
|
+
refused: "redact is not a function. The library drops each record until redact is a function or null."
|
|
867
|
+
}
|
|
868
|
+
}, H = (e) => typeof e == "number" && Number.isFinite(e), rn = (e) => Array.isArray(e) && e.every(H), U = (e) => typeof e == "string" && /^\d{1,20}$/.test(e), an = (e) => typeof e == "string" && /^[0-9a-f]{32}$/.test(e), on = (e) => typeof e == "string" && /^[0-9a-f]{16}$/.test(e), sn = (e) => e === "" || on(e), cn = (e) => e === "counter", ln = (e) => e === "histogram", un = (e) => e === "client" || e === "internal", dn = (e) => e === "error" || e === "unset", fn = {
|
|
869
|
+
"metric.type": cn,
|
|
870
|
+
"metric.value": H,
|
|
871
|
+
[E.start]: U
|
|
872
|
+
}, pn = {
|
|
873
|
+
"metric.type": ln,
|
|
874
|
+
[E.start]: U,
|
|
875
|
+
[E.count]: H,
|
|
876
|
+
[E.sum]: H,
|
|
877
|
+
[E.min]: H,
|
|
878
|
+
[E.max]: H,
|
|
879
|
+
[E.bounds]: rn,
|
|
880
|
+
[E.buckets]: rn
|
|
881
|
+
}, mn = {
|
|
882
|
+
[s.kind]: un,
|
|
883
|
+
[s.parentId]: sn,
|
|
884
|
+
[s.start]: U,
|
|
885
|
+
[s.end]: U,
|
|
886
|
+
[s.status]: dn
|
|
887
|
+
}, hn = {
|
|
888
|
+
[s.linkTraceId]: an,
|
|
889
|
+
[s.linkSpanId]: on
|
|
890
|
+
};
|
|
891
|
+
function gn(e) {
|
|
892
|
+
let t = e[S], n = e[v];
|
|
893
|
+
return t === "span" && n === "uiobs.traces" ? [mn, hn] : t !== "metric" || n !== "uiobs.metrics" ? [] : e["metric.type"] === "histogram" ? [pn] : [fn];
|
|
1326
894
|
}
|
|
1327
|
-
function
|
|
895
|
+
function _n(e) {
|
|
896
|
+
let t = {};
|
|
897
|
+
for (let n of gn(e)) {
|
|
898
|
+
let r = Object.keys(n);
|
|
899
|
+
if (r.every((t) => n[t](e[t]))) for (let n of r) t[n] = e[n];
|
|
900
|
+
}
|
|
901
|
+
return t;
|
|
902
|
+
}
|
|
903
|
+
function W(e) {
|
|
1328
904
|
return e;
|
|
1329
905
|
}
|
|
1330
|
-
var
|
|
1331
|
-
deps;
|
|
1332
|
-
resourceCache = null;
|
|
906
|
+
var vn = class {
|
|
1333
907
|
constructor(e) {
|
|
1334
|
-
this.deps = e;
|
|
908
|
+
k(this, "deps", void 0), k(this, "resourceCache", null), this.deps = e;
|
|
1335
909
|
}
|
|
1336
910
|
invalidateResource() {
|
|
1337
911
|
this.resourceCache = null;
|
|
1338
912
|
}
|
|
1339
|
-
isEnabled(e, t,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
let
|
|
1344
|
-
|
|
913
|
+
isEnabled(e, t, n) {
|
|
914
|
+
return this.deps.config.enabled && this.passesLevel(e, t, n);
|
|
915
|
+
}
|
|
916
|
+
passesLevel(e, t, n) {
|
|
917
|
+
let { config: r } = this.deps;
|
|
918
|
+
if (n !== void 0 && m.includes(n)) return !0;
|
|
919
|
+
let i = this.deps.remote.sampling?.minLevelFor(t) ?? ot(t, r);
|
|
920
|
+
return w[e] >= w[i];
|
|
1345
921
|
}
|
|
1346
922
|
keepForDebug(e) {
|
|
1347
923
|
let { config: t, debug: n } = this.deps;
|
|
@@ -1355,7 +931,7 @@ var vr = class {
|
|
|
1355
931
|
record: null,
|
|
1356
932
|
dropped: "level"
|
|
1357
933
|
};
|
|
1358
|
-
let l = e.trace ?? e.snapshot?.trace ?? i.resolve(), u = e.snapshot ? e.snapshot.journey : a.current(), d =
|
|
934
|
+
let l = e.trace ?? e.snapshot?.trace ?? i.resolve(), u = e.snapshot ? e.snapshot.journey : a.current(), d = st({
|
|
1359
935
|
level: e.level,
|
|
1360
936
|
type: e.type,
|
|
1361
937
|
namespace: e.namespace,
|
|
@@ -1367,71 +943,96 @@ var vr = class {
|
|
|
1367
943
|
record: null,
|
|
1368
944
|
dropped: "sampling"
|
|
1369
945
|
};
|
|
1370
|
-
let f = o.next(), p = e.snapshot?.url ??
|
|
946
|
+
let f = o.next(), p = e.snapshot?.url ?? He(r), m = n.metadata.pageUrl ? Be(p, n.capture.fullUrls, n.capture.urlTransform, r) : "", h, g = 0;
|
|
1371
947
|
try {
|
|
1372
|
-
let t =
|
|
948
|
+
let t = N(e.snapshot?.context ?? this.deps.context.getAll(), s, r), n = N(this.provided(), s, r), i = N(e.scoped ?? {}, s, r), a = N(e.payload ?? {}, s, r);
|
|
1373
949
|
g = t.bytes + n.bytes + i.bytes + a.bytes, h = {
|
|
1374
|
-
...
|
|
1375
|
-
...
|
|
1376
|
-
...
|
|
1377
|
-
...
|
|
950
|
+
...W(t.value),
|
|
951
|
+
...W(n.value),
|
|
952
|
+
...W(i.value),
|
|
953
|
+
...W(a.value)
|
|
1378
954
|
};
|
|
1379
955
|
} catch (e) {
|
|
1380
|
-
r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [
|
|
956
|
+
r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [je]: !0 };
|
|
1381
957
|
}
|
|
1382
|
-
Object.assign(h, e.fixed), h[
|
|
1383
|
-
let
|
|
1384
|
-
|
|
1385
|
-
let
|
|
1386
|
-
timeUnixNano: e.snapshot?.timeUnixNano ??
|
|
958
|
+
Object.assign(h, e.fixed), h[S] = e.type, h[C] = f, h[v] = e.namespace, h[T] = m, u && (h[x] = u.id, h[ve] = u.name, u.parentId !== void 0 && (h[fe] = u.parentId));
|
|
959
|
+
let ee = Xe(e.body, s.maxBodyChars);
|
|
960
|
+
ee !== e.body && r.count("record.truncated");
|
|
961
|
+
let _ = {
|
|
962
|
+
timeUnixNano: e.snapshot?.timeUnixNano ?? Pe(),
|
|
1387
963
|
traceId: l.traceId,
|
|
1388
964
|
spanId: l.spanId,
|
|
1389
965
|
traceFlags: l.traceFlags,
|
|
1390
|
-
severityNumber:
|
|
966
|
+
severityNumber: te[e.level],
|
|
1391
967
|
severityText: e.level,
|
|
1392
|
-
body:
|
|
968
|
+
body: ee,
|
|
1393
969
|
attributes: h,
|
|
1394
970
|
resource: this.resource()
|
|
1395
|
-
},
|
|
1396
|
-
if (
|
|
1397
|
-
let t = this.applyHooks(
|
|
971
|
+
}, ne = this.hookStages();
|
|
972
|
+
if (ne.length > 0) {
|
|
973
|
+
let t = this.applyHooks(_, ne, e.fixed);
|
|
1398
974
|
if (typeof t == "string") return {
|
|
1399
975
|
record: null,
|
|
1400
976
|
dropped: t
|
|
1401
977
|
};
|
|
1402
|
-
({record:
|
|
1403
|
-
}
|
|
1404
|
-
if (g > s.maxRecordBytes) {
|
|
1405
|
-
r.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
|
|
1406
|
-
bytes: g,
|
|
1407
|
-
body: v.body
|
|
1408
|
-
});
|
|
1409
|
-
let t = {
|
|
1410
|
-
[ve]: e.type,
|
|
1411
|
-
[ye]: f,
|
|
1412
|
-
[ue]: e.namespace,
|
|
1413
|
-
[je]: !0,
|
|
1414
|
-
[Te]: g
|
|
1415
|
-
};
|
|
1416
|
-
for (let e of mr) e in v.attributes && (t[e] = v.attributes[e]);
|
|
1417
|
-
for (let [e, n] of Object.entries(v.attributes)) e.startsWith(pr) && (t[e] = n);
|
|
1418
|
-
let n = k(t, s, r).bytes;
|
|
1419
|
-
n > s.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, me), n = k(t, s, r).bytes);
|
|
1420
|
-
let i = v.attributes[b];
|
|
1421
|
-
if (i !== void 0) {
|
|
1422
|
-
let e = k(i, s, r).bytes;
|
|
1423
|
-
n + e <= s.maxRecordBytes && (t[b] = i);
|
|
1424
|
-
}
|
|
1425
|
-
Object.assign(t, e.fixed), v.attributes = t;
|
|
978
|
+
({record: _, bytes: g} = t);
|
|
1426
979
|
}
|
|
1427
|
-
|
|
980
|
+
let re = {
|
|
981
|
+
[S]: e.type,
|
|
982
|
+
[C]: f,
|
|
983
|
+
[v]: e.namespace
|
|
984
|
+
};
|
|
985
|
+
return { record: this.fit(_, g, re, e.fixed) };
|
|
1428
986
|
}
|
|
1429
987
|
redactForwarded(e) {
|
|
1430
988
|
let { redact: t } = this.deps.config;
|
|
1431
989
|
if (!t) return e;
|
|
1432
|
-
let n = [[t, "redact"]], r = this.applyHooks(e, n,
|
|
990
|
+
let n = [[t, "redact"]], r = this.applyHooks(e, n, _n(e.attributes));
|
|
1433
991
|
return typeof r == "string" ? null : r.record;
|
|
1434
992
|
}
|
|
993
|
+
rehook(e) {
|
|
994
|
+
let { config: t, diagnostics: n, limits: r, remote: i, debug: a } = this.deps, { attributes: o } = e, s = String(o[v]), c = this.passesLevel(e.severityText, s, o[S]), l = c && it(e, t, i.sampling?.current() ?? null), u = t.metadata.pageUrl ? Be(String(o[T]), t.capture.fullUrls, t.capture.urlTransform, n) : "", d = Xe(e.body, r.maxBodyChars);
|
|
995
|
+
d !== e.body && n.count("record.truncated");
|
|
996
|
+
let f = _n(o), p = {
|
|
997
|
+
...e,
|
|
998
|
+
body: d,
|
|
999
|
+
attributes: {
|
|
1000
|
+
...o,
|
|
1001
|
+
[T]: u
|
|
1002
|
+
},
|
|
1003
|
+
resource: this.resource()
|
|
1004
|
+
}, m = this.applyHooks(p, this.hookStages(), f), h = typeof m == "string" ? null : this.fit(m.record, m.bytes, o, f);
|
|
1005
|
+
return l ? h : (n.count(c ? "record.dropped_by_sampling" : "record.dropped_by_level"), h && a && t.enabled && t.debugBuffer.enabled && a.push(h), null);
|
|
1006
|
+
}
|
|
1007
|
+
fit(e, t, n, r) {
|
|
1008
|
+
let { diagnostics: i, limits: a } = this.deps;
|
|
1009
|
+
if (t <= a.maxRecordBytes) return e;
|
|
1010
|
+
i.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
|
|
1011
|
+
bytes: t,
|
|
1012
|
+
body: e.body
|
|
1013
|
+
});
|
|
1014
|
+
let o = {
|
|
1015
|
+
[S]: n[S],
|
|
1016
|
+
[C]: n[C],
|
|
1017
|
+
[v]: n[v],
|
|
1018
|
+
[Se]: !0,
|
|
1019
|
+
[he]: t
|
|
1020
|
+
};
|
|
1021
|
+
for (let t of tn) t in e.attributes && (o[t] = e.attributes[t]);
|
|
1022
|
+
for (let [t, n] of Object.entries(e.attributes)) t.startsWith(en) && (o[t] = n);
|
|
1023
|
+
let s = N(o, a, i).bytes;
|
|
1024
|
+
s > a.maxRecordBytes && "error.data" in o && (Reflect.deleteProperty(o, se), s = N(o, a, i).bytes);
|
|
1025
|
+
let c = e.attributes[y];
|
|
1026
|
+
if (c !== void 0) {
|
|
1027
|
+
let e = N(c, a, i).bytes;
|
|
1028
|
+
s + e <= a.maxRecordBytes && (o[y] = c);
|
|
1029
|
+
}
|
|
1030
|
+
return Object.assign(o, r), e.attributes = o, e;
|
|
1031
|
+
}
|
|
1032
|
+
hookStages() {
|
|
1033
|
+
let { processors: e, redact: t } = this.deps.config, n = e.map((e) => [e, "processor"]);
|
|
1034
|
+
return t && n.push([t, "redact"]), n;
|
|
1035
|
+
}
|
|
1435
1036
|
applyHooks(e, t, n) {
|
|
1436
1037
|
let r = e;
|
|
1437
1038
|
for (let [e, n] of t) {
|
|
@@ -1439,7 +1040,7 @@ var vr = class {
|
|
|
1439
1040
|
if (typeof t == "string") return t;
|
|
1440
1041
|
r = t;
|
|
1441
1042
|
}
|
|
1442
|
-
let { diagnostics: i, limits: a } = this.deps, o =
|
|
1043
|
+
let { diagnostics: i, limits: a } = this.deps, o = N(r.attributes, a, i), s = W(o.value);
|
|
1443
1044
|
return Object.assign(s, n), {
|
|
1444
1045
|
record: {
|
|
1445
1046
|
...r,
|
|
@@ -1449,60 +1050,60 @@ var vr = class {
|
|
|
1449
1050
|
};
|
|
1450
1051
|
}
|
|
1451
1052
|
runHook(e, t, n) {
|
|
1452
|
-
let { diagnostics: r } = this.deps, { label: i, code: a } =
|
|
1053
|
+
let { diagnostics: r } = this.deps, { label: i, code: a, refused: o } = nn[t], s;
|
|
1453
1054
|
try {
|
|
1454
|
-
|
|
1055
|
+
s = e(n);
|
|
1455
1056
|
} catch (e) {
|
|
1456
1057
|
return r.report(a, `${i} threw an error. The library dropped the record.`, void 0, e), t;
|
|
1457
1058
|
}
|
|
1458
|
-
if (
|
|
1459
|
-
let
|
|
1460
|
-
return
|
|
1461
|
-
...
|
|
1462
|
-
severityNumber:
|
|
1463
|
-
} : (r.report("record.dropped_malformed", `${i} set a severityText that is not a log level. The library dropped the record.`), "malformed") :
|
|
1059
|
+
if (s === null) return e === F ? r.report(a, o) : r.count(a), t;
|
|
1060
|
+
let c = s ?? n;
|
|
1061
|
+
return Ne(c) ? Fe(c.severityText) ? {
|
|
1062
|
+
...c,
|
|
1063
|
+
severityNumber: te[c.severityText]
|
|
1064
|
+
} : (r.report("record.dropped_malformed", `${i} set a severityText that is not a log level. The library dropped the record.`), "malformed") : c === n ? (r.report("record.dropped_malformed", `${i} changed the record to a shape that is not a record. The library dropped it.`), "malformed") : (r.report(a, `${i} returned a value that is not a record. The library dropped the record.`), t);
|
|
1464
1065
|
}
|
|
1465
1066
|
provided() {
|
|
1466
1067
|
let e = this.deps.config.contextProvider;
|
|
1467
1068
|
if (!e) return {};
|
|
1468
1069
|
let { diagnostics: t } = this.deps, n = t.guard("handler.threw", "The contextProvider threw an error. The record has no attributes from it.", () => {
|
|
1469
1070
|
let t = e();
|
|
1470
|
-
return t === void 0 ? {} :
|
|
1071
|
+
return t === void 0 ? {} : D(t) && typeof t.then != "function" ? t : null;
|
|
1471
1072
|
});
|
|
1472
1073
|
return n === null && t.report("config.invalid", "contextProvider must return an object of attributes. The library ignores the value."), n ?? {};
|
|
1473
1074
|
}
|
|
1474
1075
|
resource() {
|
|
1475
1076
|
if (this.resourceCache) return this.resourceCache;
|
|
1476
|
-
let { config: t, identity: n, platform:
|
|
1077
|
+
let { config: t, identity: n, platform: a } = this.deps;
|
|
1477
1078
|
return this.resourceCache = {
|
|
1478
|
-
[
|
|
1479
|
-
[
|
|
1480
|
-
[
|
|
1481
|
-
[
|
|
1482
|
-
[
|
|
1483
|
-
[
|
|
1484
|
-
[
|
|
1485
|
-
[
|
|
1486
|
-
[
|
|
1487
|
-
[
|
|
1488
|
-
...t.metadata.userAgent ? { [
|
|
1489
|
-
...!t.metadata.openfin ||
|
|
1490
|
-
...!t.metadata.openfin ||
|
|
1079
|
+
[oe]: t.serviceName,
|
|
1080
|
+
[ke]: t.serviceVersion,
|
|
1081
|
+
[ce]: t.environment,
|
|
1082
|
+
[i]: e,
|
|
1083
|
+
[r]: b,
|
|
1084
|
+
[_]: g,
|
|
1085
|
+
[ie]: a.platform,
|
|
1086
|
+
[ee]: n.sessionId,
|
|
1087
|
+
[Oe]: n.tabId,
|
|
1088
|
+
[le]: n.contextId,
|
|
1089
|
+
...t.metadata.userAgent ? { [pe]: a.userAgent } : {},
|
|
1090
|
+
...!t.metadata.openfin || a.openfinUuid === void 0 ? {} : { [Me]: a.openfinUuid },
|
|
1091
|
+
...!t.metadata.openfin || a.openfinName === void 0 ? {} : { [De]: a.openfinName }
|
|
1491
1092
|
}, this.resourceCache;
|
|
1492
1093
|
}
|
|
1493
|
-
},
|
|
1094
|
+
}, yn = 1e3, bn = {
|
|
1494
1095
|
start: "ui.start",
|
|
1495
1096
|
interaction: "ui.interaction",
|
|
1496
1097
|
navigation: "ui.navigation",
|
|
1497
1098
|
explicit: "ui.trace",
|
|
1498
1099
|
maxAge: "ui.trace"
|
|
1499
1100
|
};
|
|
1500
|
-
function
|
|
1501
|
-
return `${String(Math.round(e *
|
|
1101
|
+
function xn(e) {
|
|
1102
|
+
return `${String(Math.round(e * yn))}000`;
|
|
1502
1103
|
}
|
|
1503
|
-
function
|
|
1104
|
+
function Sn(e) {
|
|
1504
1105
|
return {
|
|
1505
|
-
name:
|
|
1106
|
+
name: bn[e.reason],
|
|
1506
1107
|
kind: "internal",
|
|
1507
1108
|
traceId: e.traceId,
|
|
1508
1109
|
spanId: e.spanId,
|
|
@@ -1513,191 +1114,166 @@ function Sr(e) {
|
|
|
1513
1114
|
attributes: {}
|
|
1514
1115
|
};
|
|
1515
1116
|
}
|
|
1516
|
-
function
|
|
1117
|
+
function Cn(e) {
|
|
1517
1118
|
return {
|
|
1518
|
-
[
|
|
1519
|
-
[
|
|
1520
|
-
[
|
|
1521
|
-
[
|
|
1522
|
-
[
|
|
1119
|
+
[s.kind]: e.kind,
|
|
1120
|
+
[s.parentId]: e.parentSpanId,
|
|
1121
|
+
[s.start]: xn(e.startMs),
|
|
1122
|
+
[s.end]: xn(e.endMs),
|
|
1123
|
+
[s.status]: e.error ? "error" : "unset",
|
|
1523
1124
|
...e.link ? {
|
|
1524
|
-
[
|
|
1525
|
-
[
|
|
1125
|
+
[s.linkTraceId]: e.link.traceId,
|
|
1126
|
+
[s.linkSpanId]: e.link.spanId
|
|
1526
1127
|
} : {}
|
|
1527
1128
|
};
|
|
1528
1129
|
}
|
|
1529
1130
|
// src/core/runtime.ts
|
|
1530
|
-
var
|
|
1531
|
-
errors: async () => (await import("./errors-
|
|
1532
|
-
network: async () => (await import("./network-
|
|
1533
|
-
interactions: async () => (await import("./interactions-
|
|
1534
|
-
webVitals: async () => (await import("./web-vitals-
|
|
1535
|
-
longFrames: async () => (await import("./long-frames-
|
|
1536
|
-
console: async () => (await import("./console-
|
|
1537
|
-
uncleanExit: async () => (await import("./unclean-exit-
|
|
1538
|
-
userTiming: async () => (await import("./user-timing-
|
|
1539
|
-
reports: async () => (await import("./reports-
|
|
1540
|
-
resourceTiming: async () => (await import("./resource-timing-
|
|
1541
|
-
lifecycle: async () => (await import("./lifecycle-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
transportWorker: void 0
|
|
1556
|
-
}, Mr = Object.keys(jr), Nr = /* @__PURE__ */ new Set([
|
|
1131
|
+
var wn = {
|
|
1132
|
+
errors: async () => (await import("./errors-BE_EZV7Q.js")).ErrorCapture,
|
|
1133
|
+
network: async () => (await import("./network-on2zZT6H.js")).NetworkCapture,
|
|
1134
|
+
interactions: async () => (await import("./interactions-DiFvCosX.js")).InteractionCapture,
|
|
1135
|
+
webVitals: async () => (await import("./web-vitals-4pWACwaR.js")).WebVitalsCapture,
|
|
1136
|
+
longFrames: async () => (await import("./long-frames-DNFaRnC3.js")).LongFrameCapture,
|
|
1137
|
+
console: async () => (await import("./console-BGgGnjSi.js")).ConsoleCapture,
|
|
1138
|
+
uncleanExit: async () => (await import("./unclean-exit-DQD1cT7c.js")).UncleanExitCapture,
|
|
1139
|
+
userTiming: async () => (await import("./user-timing-BePqb1uN.js")).UserTimingCapture,
|
|
1140
|
+
reports: async () => (await import("./reports-C-thq-bk.js")).ReportCapture,
|
|
1141
|
+
resourceTiming: async () => (await import("./resource-timing-eUl2dNgC.js")).ResourceTimingCapture,
|
|
1142
|
+
lifecycle: async () => (await import("./lifecycle-22CUCrc9.js")).LifecycleCapture,
|
|
1143
|
+
framePhases: async () => (await import("./profiler-frames-cJMx9wNM.js")).FramePhasesCapture,
|
|
1144
|
+
framePacing: async () => (await import("./profiler-frames-cJMx9wNM.js")).FramePacingCapture,
|
|
1145
|
+
replay: async () => (await import("./replay-Ds-ANH34.js")).ReplayCapture
|
|
1146
|
+
}, Tn = /* @__PURE__ */ new WeakMap(), En = 0;
|
|
1147
|
+
function G(e) {
|
|
1148
|
+
let t = Tn.get(e);
|
|
1149
|
+
return t === void 0 && (t = ++En, Tn.set(e, t)), t;
|
|
1150
|
+
}
|
|
1151
|
+
var Dn = Symbol.for(f), On = Symbol.for(p), kn = ["batching", "retention"], An = [
|
|
1152
|
+
"log",
|
|
1153
|
+
"event",
|
|
1154
|
+
"action"
|
|
1155
|
+
], jn = "configure() could not read its options. The library drops each record and installs no capture until a configure() call sets redact to a function or null.", Mn = "shutdown() got invalid options. The library discards the records in memory. An invalid clearStorage removes the \"context\" scope.", Nn = "flush() got invalid options. The library waits the default 5000 ms.", Pn = /* @__PURE__ */ new Set([
|
|
1557
1156
|
"bus.role_resolved",
|
|
1558
1157
|
"config.reconfigured",
|
|
1559
1158
|
"security.rotated",
|
|
1560
1159
|
"journey.adopted",
|
|
1561
1160
|
"journey.expired"
|
|
1562
1161
|
]);
|
|
1563
|
-
function
|
|
1162
|
+
function Fn(e) {
|
|
1564
1163
|
return JSON.stringify({
|
|
1565
1164
|
...e,
|
|
1566
|
-
urlTransform: e.urlTransform ?
|
|
1567
|
-
|
|
1165
|
+
urlTransform: e.urlTransform ? G(e.urlTransform) : void 0,
|
|
1166
|
+
webVitals: typeof e.webVitals == "object" ? { loader: e.webVitals.loader !== void 0 } : e.webVitals,
|
|
1568
1167
|
ignoreUrls: e.ignoreUrls.map(String),
|
|
1569
1168
|
propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String),
|
|
1570
|
-
|
|
1571
|
-
plugins: e.plugins.map(
|
|
1169
|
+
userTiming: typeof e.userTiming == "object" ? { include: e.userTiming.include?.map(String) } : e.userTiming,
|
|
1170
|
+
plugins: e.plugins.map(G)
|
|
1572
1171
|
});
|
|
1573
1172
|
}
|
|
1574
|
-
function
|
|
1575
|
-
if (!
|
|
1173
|
+
function In(e) {
|
|
1174
|
+
if (!D(e)) return e;
|
|
1576
1175
|
let t = { ...e };
|
|
1577
1176
|
for (let e of ["url", "endpoint"]) {
|
|
1578
1177
|
let n = t[e];
|
|
1579
|
-
typeof n == "string" && (t[e] =
|
|
1178
|
+
typeof n == "string" && (t[e] = Be(n, !1));
|
|
1580
1179
|
}
|
|
1581
1180
|
return t;
|
|
1582
1181
|
}
|
|
1583
|
-
function
|
|
1182
|
+
function Ln(e) {
|
|
1584
1183
|
return {
|
|
1585
1184
|
...e,
|
|
1586
1185
|
endpoint: null,
|
|
1587
|
-
metricsEndpoint:
|
|
1588
|
-
tracesEndpoint:
|
|
1589
|
-
transport:
|
|
1590
|
-
transportOnExit:
|
|
1591
|
-
transportWorker:
|
|
1186
|
+
metricsEndpoint: null,
|
|
1187
|
+
tracesEndpoint: null,
|
|
1188
|
+
transport: null,
|
|
1189
|
+
transportOnExit: null,
|
|
1190
|
+
transportWorker: null,
|
|
1592
1191
|
bus: {
|
|
1593
1192
|
...e.bus,
|
|
1594
1193
|
mode: "off"
|
|
1595
1194
|
}
|
|
1596
1195
|
};
|
|
1597
1196
|
}
|
|
1598
|
-
function
|
|
1599
|
-
return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport
|
|
1197
|
+
function Rn(e) {
|
|
1198
|
+
return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || !!e.transport || !!e.transportWorker;
|
|
1199
|
+
}
|
|
1200
|
+
function zn(e, t) {
|
|
1201
|
+
return {
|
|
1202
|
+
status: e,
|
|
1203
|
+
accepted: 0,
|
|
1204
|
+
stored: 0,
|
|
1205
|
+
dropped: 0,
|
|
1206
|
+
forwarded: 0,
|
|
1207
|
+
pending: 0,
|
|
1208
|
+
...t
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
function K(e) {
|
|
1212
|
+
return zn(e.pending > 0 ? "timeout" : "complete", e);
|
|
1600
1213
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return e.sdkVersion ===
|
|
1214
|
+
function Bn(e) {
|
|
1215
|
+
return e.sdkVersion === b;
|
|
1603
1216
|
}
|
|
1604
1217
|
var q = class e {
|
|
1605
|
-
rotating = !1;
|
|
1606
|
-
closingContext = !1;
|
|
1607
|
-
mismatchVersion = null;
|
|
1608
|
-
contextMismatch = !1;
|
|
1609
|
-
rotation;
|
|
1610
|
-
memoryStorage;
|
|
1611
|
-
storagePersistence = "off";
|
|
1612
|
-
recordingDiagnostic = !1;
|
|
1613
|
-
diagnosticLogger = new F(() => this, Oe);
|
|
1614
|
-
debugBuffer = new ar(() => this.config.debugBuffer);
|
|
1615
|
-
explicitSecurityContext;
|
|
1616
|
-
ownerAdopted = !1;
|
|
1617
1218
|
isRotating() {
|
|
1618
1219
|
return this.rotating;
|
|
1619
1220
|
}
|
|
1620
1221
|
setConfigurationLocked(e) {
|
|
1621
1222
|
typeof e == "boolean" && (this.config.lockConfiguration = e);
|
|
1622
1223
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
userTiming: !1
|
|
1667
|
-
};
|
|
1668
|
-
bootBuffer = new lr((e) => {
|
|
1669
|
-
this.dropHeld(e);
|
|
1670
|
-
});
|
|
1671
|
-
forwardBuffer = [];
|
|
1672
|
-
forwardScheduled = !1;
|
|
1673
|
-
roleResolved = !1;
|
|
1674
|
-
started = Promise.resolve();
|
|
1675
|
-
ready = !1;
|
|
1676
|
-
destroyed = !1;
|
|
1677
|
-
lastGapAt = 0;
|
|
1678
|
-
limits;
|
|
1679
|
-
journeyOptions;
|
|
1680
|
-
tunablesLocked = !0;
|
|
1681
|
-
degraded;
|
|
1682
|
-
serverReported = !1;
|
|
1683
|
-
onPageHide = () => {
|
|
1684
|
-
N(this), this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
|
|
1685
|
-
};
|
|
1686
|
-
constructor(e, t = !1) {
|
|
1687
|
-
this.diagnostics = new or(e.onDiagnostic), this.platform = Ke(this.diagnostics), this.degraded = t || this.onServer(), this.config = G(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= A(this.diagnostics), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" || this.onServer() ? et() : nt, this.identity = tt(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new Qe(this.diagnostics, this.stores, this.config.correlation.sessionTouchMs, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Yt(this.config.capturePolicy.breadcrumbs);
|
|
1688
|
-
let n = (e) => lt(e, this.config.sampling.defaultRate);
|
|
1689
|
-
this.tracing = new Jt(this.diagnostics, this.config.correlation.traceMaxAgeMs || Infinity, this.config.otelLoader, {
|
|
1690
|
-
enabled: () => this.config.tracesEndpoint !== "",
|
|
1224
|
+
constructor(e, t) {
|
|
1225
|
+
k(this, "rotating", !1), k(this, "rotationSeq", 0), k(this, "profilerOn", !1), k(this, "closingContext", !1), k(this, "mismatchVersion", null), k(this, "contextMismatch", !1), k(this, "rotation", void 0), k(this, "memoryStorage", void 0), k(this, "storagePersistence", "off"), k(this, "recordingDiagnostic", !1), k(this, "diagnosticLogger", new B(() => this, c)), k(this, "debugBuffer", new Xt(() => this.config.debugBuffer)), k(this, "explicitSecurityContext", void 0), k(this, "ownerAdopted", !1), k(this, "sdkVersion", b), k(this, "protocol", d), k(this, "diagnostics", void 0), k(this, "config", void 0), k(this, "platform", void 0), k(this, "identity", void 0), k(this, "backing", Ke()), k(this, "stores", {
|
|
1226
|
+
local: () => this.backing.local(),
|
|
1227
|
+
session: () => this.backing.session()
|
|
1228
|
+
}), k(this, "identityBuiltAs", void 0), k(this, "sessionTouch", void 0), k(this, "context", new Yt()), k(this, "breadcrumbs", void 0), k(this, "tracing", void 0), k(this, "sequence", new qt()), k(this, "journey", void 0), k(this, "builder", void 0), k(this, "remote", {
|
|
1229
|
+
sampling: null,
|
|
1230
|
+
changed: () => {
|
|
1231
|
+
this.refreshCaptures();
|
|
1232
|
+
}
|
|
1233
|
+
}), k(this, "identityEpoch", 0), k(this, "errorHook", void 0), k(this, "replayConsent", void 0), k(this, "replay", void 0), k(this, "remoteCaptureTimer", void 0), k(this, "installedCaptureKey", ""), k(this, "replayBuiltKey", ""), k(this, "console", void 0), k(this, "drops", void 0), k(this, "meter", void 0), k(this, "bus", null), k(this, "busBuilt", void 0), k(this, "busLoad", void 0), k(this, "sender", void 0), k(this, "senderLoad", void 0), k(this, "pendingRecords", new $t((e) => {
|
|
1234
|
+
this.dropHeld(e);
|
|
1235
|
+
})), k(this, "pausedLoss", /* @__PURE__ */ new WeakSet()), k(this, "carried", []), k(this, "sessionPicked", !1), k(this, "deliveryClosed", !1), k(this, "parkedSender", void 0), k(this, "retiring", void 0), k(this, "startFailed", !1), k(this, "running", !1), k(this, "openGate", void 0), k(this, "startGate", new Promise((e) => {
|
|
1236
|
+
this.openGate = e;
|
|
1237
|
+
})), k(this, "captures", []), k(this, "captureGeneration", 0), k(this, "captureOnce", {
|
|
1238
|
+
webVitals: !1,
|
|
1239
|
+
navigationTiming: !1,
|
|
1240
|
+
longFrames: !1,
|
|
1241
|
+
uncleanExit: !1,
|
|
1242
|
+
userTiming: !1
|
|
1243
|
+
}), k(this, "bootBuffer", new $t((e) => {
|
|
1244
|
+
this.dropHeld(e);
|
|
1245
|
+
})), k(this, "forwardBuffer", []), k(this, "forwardScheduled", !1), k(this, "roleResolved", !1), k(this, "started", Promise.resolve()), k(this, "ready", !1), k(this, "destroyed", !1), k(this, "stopping", void 0), k(this, "lastSendAt", null), k(this, "lastGapAt", 0), k(this, "limits", void 0), k(this, "journeyOptions", void 0), k(this, "tunablesLocked", !1), k(this, "degraded", void 0), k(this, "serverReported", !1), k(this, "onPageHide", () => {
|
|
1246
|
+
R(this), this.dropPaused(), this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
|
|
1247
|
+
}), k(this, "busCanAccept", (e, t) => this.bus?.isRegistered(e, t) ?? !1), k(this, "busAccept", (e, t, n) => {
|
|
1248
|
+
this.destroyed || this.ensureBus().then((r) => {
|
|
1249
|
+
r && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
|
|
1250
|
+
r.acceptDirect(e, t, n);
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
}), k(this, "reportLoss", (e, t, n, r) => {
|
|
1254
|
+
this.drops.add(e, t, n, r);
|
|
1255
|
+
}), k(this, "reportGap", (e, t) => {
|
|
1256
|
+
this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
|
|
1257
|
+
let n = Date.now();
|
|
1258
|
+
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new B(() => this, o).warn("stored records were dropped before delivery", {
|
|
1259
|
+
"gap.batches": e.batches,
|
|
1260
|
+
"gap.records": e.records,
|
|
1261
|
+
"gap.reason": e.reason
|
|
1262
|
+
}));
|
|
1263
|
+
}), this.diagnostics = new V(typeof e.onDiagnostic == "function" ? e.onDiagnostic : void 0), this.platform = Ve(this.diagnostics), this.degraded = t || this.onServer(), this.config = P(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= A(this.diagnostics), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.identityBuiltAs = this.config.identity, this.identity = qe(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new We(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Jt(this.config.captureLimits.breadcrumbs);
|
|
1264
|
+
let n = (e) => at(e, this.config.sampling.defaultRate);
|
|
1265
|
+
this.tracing = new Ot(this.diagnostics, this.config.correlation.traceMaxAgeMs ?? Infinity, this.config.otelLoader, {
|
|
1266
|
+
enabled: () => this.config.tracesEndpoint !== null,
|
|
1691
1267
|
keeps: n,
|
|
1692
1268
|
onEnd: (e) => {
|
|
1693
|
-
n(e.traceId) && this.recordSpan(
|
|
1269
|
+
n(e.traceId) && this.recordSpan(Sn(e));
|
|
1694
1270
|
}
|
|
1695
|
-
}), this.
|
|
1696
|
-
...
|
|
1271
|
+
}), this.limits = { ...this.config.limits }, this.console = new Kt(this.config.consoleOutput, this.diagnostics, this.limits), this.drops = new Qt(this.config, this.diagnostics), this.journeyOptions = {
|
|
1272
|
+
...rt,
|
|
1697
1273
|
maxAgeMs: this.config.journey.maxAgeMs
|
|
1698
|
-
}, this.journey = new
|
|
1274
|
+
}, this.journey = new nt(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
|
|
1699
1275
|
this.bus?.broadcastJourney(e);
|
|
1700
|
-
}, this.stores), this.builder = new
|
|
1276
|
+
}, this.stores), this.builder = new vn({
|
|
1701
1277
|
remote: this.remote,
|
|
1702
1278
|
config: this.config,
|
|
1703
1279
|
limits: this.limits,
|
|
@@ -1709,9 +1285,9 @@ var q = class e {
|
|
|
1709
1285
|
identity: this.identity,
|
|
1710
1286
|
platform: this.platform,
|
|
1711
1287
|
debug: this.debugBuffer
|
|
1712
|
-
}), this.meter = new
|
|
1288
|
+
}), this.meter = new Wt(() => this.config.metrics.intervalMs, (e, t, n) => {
|
|
1713
1289
|
this.emitPoint(e, t, n);
|
|
1714
|
-
}, this.diagnostics, this.config.metrics), this.diagnostics.setHandler(this.diagnosticHandler());
|
|
1290
|
+
}, this.diagnostics, this.config.metrics), this.diagnostics.setHandler(this.diagnosticHandler()), this.syncProfiler();
|
|
1715
1291
|
}
|
|
1716
1292
|
diagnosticHandler() {
|
|
1717
1293
|
return this.config.diagnostics.records === !1 ? this.config.onDiagnostic : (e) => {
|
|
@@ -1723,10 +1299,10 @@ var q = class e {
|
|
|
1723
1299
|
if ((t === !0 || t !== !1 && t.includes(e.code)) && !this.recordingDiagnostic) {
|
|
1724
1300
|
this.recordingDiagnostic = !0;
|
|
1725
1301
|
try {
|
|
1726
|
-
(
|
|
1302
|
+
(Pn.has(e.code) ? this.diagnosticLogger.info : this.diagnosticLogger.warn)(e.message, {
|
|
1727
1303
|
"diagnostic.code": e.code,
|
|
1728
1304
|
"diagnostic.count": e.count,
|
|
1729
|
-
"diagnostic.detail":
|
|
1305
|
+
"diagnostic.detail": In(e.detail)
|
|
1730
1306
|
});
|
|
1731
1307
|
} finally {
|
|
1732
1308
|
this.recordingDiagnostic = !1;
|
|
@@ -1738,21 +1314,21 @@ var q = class e {
|
|
|
1738
1314
|
let n = {
|
|
1739
1315
|
t: Date.now(),
|
|
1740
1316
|
category: "custom",
|
|
1741
|
-
message:
|
|
1317
|
+
message: Xe(String(e), this.limits.maxBodyChars)
|
|
1742
1318
|
};
|
|
1743
1319
|
if (t !== void 0) {
|
|
1744
|
-
let e =
|
|
1745
|
-
n.data =
|
|
1320
|
+
let e = Ze(t, this.limits, this.diagnostics);
|
|
1321
|
+
n.data = D(e) ? e : { value: e };
|
|
1746
1322
|
}
|
|
1747
1323
|
this.breadcrumbs.push(n);
|
|
1748
1324
|
});
|
|
1749
1325
|
}
|
|
1750
1326
|
recordMetric(e, t, n) {
|
|
1751
|
-
!this.destroyed && !this.rotating && this.meter.record(e, t, n);
|
|
1327
|
+
!this.destroyed && !this.rotating && this.config.enabled && this.meter.record(e, t, n);
|
|
1752
1328
|
}
|
|
1753
1329
|
startMeasure(e, t) {
|
|
1754
|
-
let n = this.identityEpoch, r = () => !this.destroyed && !this.rotating && (!this.config.securityContext.isolation || this.identityEpoch === n);
|
|
1755
|
-
return
|
|
1330
|
+
let n = this.identityEpoch, r = () => !this.destroyed && !this.rotating && (!this.config.securityContext.isolation || this.identityEpoch === n), i = this.diagnostics.guard("record.sanitize_failed", "The library could not read the attributes of the measure.", () => ({ ...t }));
|
|
1331
|
+
return jt(this.diagnostics.guard("record.sanitize_failed", "The library could not read the name of the measure.", () => `${e}`) ?? "", i ?? {}, this.tracing.request().span, {
|
|
1756
1332
|
metric: (e, t, n) => {
|
|
1757
1333
|
r() && this.recordMetric(e, t, n);
|
|
1758
1334
|
},
|
|
@@ -1762,14 +1338,14 @@ var q = class e {
|
|
|
1762
1338
|
});
|
|
1763
1339
|
}
|
|
1764
1340
|
recordSpan(e) {
|
|
1765
|
-
if (this.config.tracesEndpoint ===
|
|
1341
|
+
if (this.config.tracesEndpoint === null) return;
|
|
1766
1342
|
let { record: t } = this.builder.build({
|
|
1767
1343
|
level: "INFO",
|
|
1768
1344
|
type: "span",
|
|
1769
1345
|
body: e.name,
|
|
1770
|
-
namespace:
|
|
1346
|
+
namespace: be,
|
|
1771
1347
|
payload: e.attributes,
|
|
1772
|
-
fixed:
|
|
1348
|
+
fixed: Cn(e),
|
|
1773
1349
|
trace: {
|
|
1774
1350
|
traceId: e.traceId,
|
|
1775
1351
|
spanId: e.spanId,
|
|
@@ -1778,64 +1354,110 @@ var q = class e {
|
|
|
1778
1354
|
});
|
|
1779
1355
|
this.emit(t);
|
|
1780
1356
|
}
|
|
1781
|
-
emitPoint(e, t,
|
|
1782
|
-
|
|
1357
|
+
emitPoint(e, t, r) {
|
|
1358
|
+
if (this.destroyed) return;
|
|
1359
|
+
let { record: i } = this.builder.build({
|
|
1783
1360
|
level: "INFO",
|
|
1784
1361
|
type: "metric",
|
|
1785
1362
|
body: e,
|
|
1786
|
-
namespace:
|
|
1363
|
+
namespace: n,
|
|
1787
1364
|
payload: t,
|
|
1788
|
-
fixed:
|
|
1365
|
+
fixed: r,
|
|
1789
1366
|
aggregated: !0
|
|
1790
1367
|
});
|
|
1791
|
-
this.emit(
|
|
1368
|
+
this.emit(i);
|
|
1369
|
+
}
|
|
1370
|
+
syncProfiler() {
|
|
1371
|
+
let e = this.config.profiler.enabled && this.config.enabled;
|
|
1372
|
+
if (e === this.profilerOn) return;
|
|
1373
|
+
this.profilerOn = e;
|
|
1374
|
+
let t = j();
|
|
1375
|
+
if (!e) {
|
|
1376
|
+
t.collect(!1), t.detach();
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
let n = {
|
|
1380
|
+
capacity: this.config.profiler.maxProbes,
|
|
1381
|
+
intervalMs: () => this.config.metrics.intervalMs,
|
|
1382
|
+
emit: (e, t, n) => {
|
|
1383
|
+
this.emitPoint(e, t, n);
|
|
1384
|
+
},
|
|
1385
|
+
diagnostics: this.diagnostics,
|
|
1386
|
+
ready: () => !this.rotating || this.closingContext,
|
|
1387
|
+
outlier: (e, t) => {
|
|
1388
|
+
this.breadcrumbs.push({
|
|
1389
|
+
t: Date.now(),
|
|
1390
|
+
category: "profile",
|
|
1391
|
+
message: `${e} ${String(Math.round(t))} ms`
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
t.attach(n);
|
|
1396
|
+
}
|
|
1397
|
+
setReplay(e) {
|
|
1398
|
+
this.replayConsent = e, e ? this.replay?.start() : this.replay?.stop();
|
|
1399
|
+
}
|
|
1400
|
+
collectPoints() {
|
|
1401
|
+
this.meter.collect(), this.profilerOn && j().collect(!1);
|
|
1402
|
+
}
|
|
1403
|
+
advanceIdentity() {
|
|
1404
|
+
this.identityEpoch++, this.profilerOn && this.config.securityContext.isolation && j().reset(), this.remote.sampling = null, this.refreshCaptures();
|
|
1792
1405
|
}
|
|
1793
|
-
busCanAccept = (e, t) => this.bus?.isRegistered(e, t) ?? !1;
|
|
1794
|
-
busAccept = (e, t, n) => {
|
|
1795
|
-
this.destroyed || this.ensureBus().then((r) => {
|
|
1796
|
-
r && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
|
|
1797
|
-
r.acceptDirect(e, t, n);
|
|
1798
|
-
});
|
|
1799
|
-
});
|
|
1800
|
-
};
|
|
1801
1406
|
static pinned() {
|
|
1802
|
-
return globalThis[
|
|
1407
|
+
return globalThis[Dn] ?? null;
|
|
1803
1408
|
}
|
|
1804
1409
|
static current() {
|
|
1805
1410
|
let t = e.local;
|
|
1806
1411
|
if (t) return t.destroyed ? null : t;
|
|
1807
1412
|
let n = e.pinned();
|
|
1808
|
-
return n &&
|
|
1413
|
+
return n && Bn(n) ? n : null;
|
|
1809
1414
|
}
|
|
1810
1415
|
static stopped() {
|
|
1811
1416
|
let t = e.local;
|
|
1812
1417
|
if (t?.destroyed) return t;
|
|
1813
|
-
let n = globalThis[
|
|
1814
|
-
return n &&
|
|
1418
|
+
let n = globalThis[On];
|
|
1419
|
+
return n && Bn(n) ? n : null;
|
|
1815
1420
|
}
|
|
1816
1421
|
isDestroyed() {
|
|
1817
1422
|
return this.destroyed;
|
|
1818
1423
|
}
|
|
1819
1424
|
static configure(t, n = !1) {
|
|
1425
|
+
try {
|
|
1426
|
+
return e.startOrUpdate(t, n);
|
|
1427
|
+
} catch (t) {
|
|
1428
|
+
let n = e.current();
|
|
1429
|
+
if (n?.tunablesLocked) return n.diagnostics.report("config.invalid", "configure() could not read its options. The library keeps the current settings.", void 0, t), n;
|
|
1430
|
+
let r = n ?? e.startOrUpdate({}, !0);
|
|
1431
|
+
return r.refuse(t), r;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
refuse(e) {
|
|
1435
|
+
this.startFailed = !0;
|
|
1436
|
+
let t = P({ redact: F }, new V(), this.config);
|
|
1437
|
+
$e(this.config, t), M(() => {
|
|
1438
|
+
console.warn(`${de} ${jn}`);
|
|
1439
|
+
}), this.diagnostics.report("config.invalid", jn, void 0, e), this.rehookHeld();
|
|
1440
|
+
}
|
|
1441
|
+
static startOrUpdate(t, n) {
|
|
1820
1442
|
let r = e.local;
|
|
1821
1443
|
if (r && !r.destroyed) return r.reconfigure(t), r;
|
|
1822
1444
|
e.local = null;
|
|
1823
1445
|
let i = e.pinned();
|
|
1824
1446
|
if (i) {
|
|
1825
|
-
if (!
|
|
1447
|
+
if (!Bn(i)) return e.startDegraded(t, i.sdkVersion, n);
|
|
1826
1448
|
if (!i.destroyed) return i.reconfigure(t), i;
|
|
1827
1449
|
}
|
|
1828
|
-
let a = new e(t);
|
|
1829
|
-
return
|
|
1830
|
-
}
|
|
1831
|
-
static startDegraded(t, n) {
|
|
1832
|
-
let
|
|
1833
|
-
e.local =
|
|
1834
|
-
let
|
|
1835
|
-
return
|
|
1836
|
-
found:
|
|
1837
|
-
own:
|
|
1838
|
-
}), r.
|
|
1450
|
+
let a = new e(t, !1);
|
|
1451
|
+
return globalThis[Dn] = a, Reflect.deleteProperty(globalThis, On), n || a.launch(), a;
|
|
1452
|
+
}
|
|
1453
|
+
static startDegraded(t, n, r) {
|
|
1454
|
+
let i = new e(t, !0);
|
|
1455
|
+
e.local = i;
|
|
1456
|
+
let a = typeof n == "string" ? n : "before 0.9.0";
|
|
1457
|
+
return i.mismatchVersion = a, i.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${a}, owns the page runtime. This copy, version ${b}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
|
|
1458
|
+
found: a,
|
|
1459
|
+
own: b
|
|
1460
|
+
}), r || i.launch(), i;
|
|
1839
1461
|
}
|
|
1840
1462
|
reconfigure(e) {
|
|
1841
1463
|
if (this.rotating) {
|
|
@@ -1843,69 +1465,85 @@ var q = class e {
|
|
|
1843
1465
|
return;
|
|
1844
1466
|
}
|
|
1845
1467
|
if (this.config.lockConfiguration) {
|
|
1846
|
-
let t =
|
|
1468
|
+
let t = P(e, this.diagnostics, this.config);
|
|
1847
1469
|
J(this.config, t) || this.diagnostics.report("config.locked", "Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.");
|
|
1848
1470
|
return;
|
|
1849
1471
|
}
|
|
1850
|
-
|
|
1472
|
+
R(this);
|
|
1851
1473
|
let t = this.keepDestination(this.keepRouting(this.allowed(e)));
|
|
1852
1474
|
!this.tunablesLocked && t.securityContext?.id && (this.explicitSecurityContext = !0);
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
...t[e]
|
|
1856
|
-
}, this.config[e]) && (this.diagnostics.report("config.invalid", `${e} cannot change after startup.`), Object.assign(t, { [e]: this.config[e] }));
|
|
1857
|
-
let n = G(t, this.diagnostics, this.config);
|
|
1475
|
+
let n = P(t, this.diagnostics, this.config), r = this.tunablesLocked ? ["correlation", "storage"] : [];
|
|
1476
|
+
for (let e of r) J(n[e], this.config[e]) || (this.diagnostics.report("config.invalid", `${e} cannot change after startup. The library keeps the current settings.`), Object.assign(n, { [e]: this.config[e] }));
|
|
1858
1477
|
this.keepStartupTunables(n);
|
|
1859
|
-
let { redact:
|
|
1860
|
-
|
|
1478
|
+
let { redact: i, processors: a, enabled: o } = this.config;
|
|
1479
|
+
o && !n.enabled && this.collectPoints(), $e(this.config, n), this.config.redact !== F && (this.startFailed = !1), (this.config.redact !== i || this.config.processors !== a) && this.debugBuffer.clear(), this.breadcrumbs.resize(this.config.captureLimits.breadcrumbs), this.diagnostics.setHandler(this.diagnosticHandler()), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.builder.invalidateResource(), this.console.update(this.config.consoleOutput), this.keepBuiltIdentity(), this.syncProfiler(), this.launch(), this.running && o !== this.config.enabled && this.sender?.hold(!this.config.enabled), this.refreshCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
|
|
1861
1480
|
}
|
|
1862
1481
|
onServer() {
|
|
1863
1482
|
return this.platform.platform === "node";
|
|
1864
1483
|
}
|
|
1865
1484
|
allowed(e) {
|
|
1866
|
-
return this.degraded ? (this.onServer() && !this.serverReported &&
|
|
1485
|
+
return this.degraded ? (this.onServer() && !this.serverReported && Rn(e) && (this.serverReported = !0, this.diagnostics.report("config.invalid", "The library runs console-only on Node. It sends no record and installs no capture. It ignores endpoint, metricsEndpoint, tracesEndpoint, transport and transportWorker.")), Ln(e)) : e;
|
|
1867
1486
|
}
|
|
1868
1487
|
keepRouting(e) {
|
|
1869
1488
|
if (!this.tunablesLocked || this.degraded || !this.config.securityContext.isolation) return e;
|
|
1870
|
-
let
|
|
1871
|
-
if (
|
|
1872
|
-
let
|
|
1873
|
-
for (let e of
|
|
1874
|
-
if (
|
|
1489
|
+
let n = P(e, new V(), this.config), r = t.filter((e) => !J(n[e], this.config[e]));
|
|
1490
|
+
if (n.securityContext.id !== this.config.securityContext.id && r.push("securityContext.id"), r.length === 0) return e;
|
|
1491
|
+
let i = { ...e };
|
|
1492
|
+
for (let e of t) r.includes(e) && Reflect.deleteProperty(i, e);
|
|
1493
|
+
if (r.includes("securityContext.id")) {
|
|
1875
1494
|
let t = { ...e.securityContext };
|
|
1876
|
-
Reflect.deleteProperty(t, "id"),
|
|
1495
|
+
Reflect.deleteProperty(t, "id"), i.securityContext = t;
|
|
1877
1496
|
}
|
|
1878
|
-
return this.diagnostics.report("config.invalid", `Isolation refuses changes to ${
|
|
1497
|
+
return this.diagnostics.report("config.invalid", `Isolation refuses changes to ${r.join(", ")}. Use rotateSecurityContext() for these changes. To permit them, set securityContext.isolation: false in a separate configure() call. The other settings apply.`), i;
|
|
1879
1498
|
}
|
|
1880
1499
|
keepStartupTunables(e) {
|
|
1881
|
-
if (this.senderLoad !== void 0 && this.keepSections(e,
|
|
1882
|
-
|
|
1500
|
+
if (this.senderLoad !== void 0 && this.keepSections(e, kn), !this.tunablesLocked) {
|
|
1501
|
+
Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
|
|
1883
1502
|
return;
|
|
1884
1503
|
}
|
|
1885
1504
|
this.keepSections(e, ["limits"]);
|
|
1505
|
+
for (let t of ["mode", "openFinRole"]) e.bus[t] !== this.config.bus[t] && (this.diagnostics.report("config.invalid", `bus.${t} cannot change after startup. The library keeps "${this.config.bus[t]}".`, { requested: e.bus[t] }), Object.assign(e.bus, { [t]: this.config.bus[t] }));
|
|
1886
1506
|
let { maxAgeMs: t } = this.config.journey;
|
|
1887
1507
|
e.journey.maxAgeMs !== t && (this.diagnostics.report("config.invalid", `journey.maxAgeMs cannot change after startup. It stays ${String(t)}.`, { requested: e.journey.maxAgeMs }), e.journey.maxAgeMs = t);
|
|
1508
|
+
let { maxProbes: n } = this.config.profiler;
|
|
1509
|
+
e.profiler.maxProbes !== n && (this.diagnostics.report("config.invalid", `profiler.maxProbes cannot change after startup. It stays ${String(n)}.`, { requested: e.profiler.maxProbes }), e.profiler.maxProbes = n);
|
|
1888
1510
|
}
|
|
1889
1511
|
keepSections(e, t) {
|
|
1890
|
-
for (let n of t) J(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values
|
|
1891
|
-
}
|
|
1892
|
-
keepBuiltStorage() {
|
|
1893
|
-
let e = this.storageBuiltAs;
|
|
1894
|
-
e !== void 0 && this.config.storage !== e && (this.diagnostics.report("config.invalid", `storage cannot change after startup. It stays ${e}.`, { requested: this.config.storage }), this.config.storage = e);
|
|
1512
|
+
for (let n of t) J(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The current values stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
|
|
1895
1513
|
}
|
|
1896
1514
|
keepDestination(e) {
|
|
1897
1515
|
if (this.senderLoad === void 0) return e;
|
|
1898
1516
|
let t = e;
|
|
1899
|
-
for (let n of ["transport", "transportWorker"])
|
|
1900
|
-
|
|
1517
|
+
for (let n of ["transport", "transportWorker"]) {
|
|
1518
|
+
let r = e[n], i = typeof r == "function" && this.config[n] === void 0, a = r === null && this.config[n] !== void 0;
|
|
1519
|
+
(i || a) && (this.diagnostics.report("config.invalid", `You cannot add or remove ${n} after the delivery stack loads. The current transport stays.`), t = { ...t }, Reflect.deleteProperty(t, n));
|
|
1520
|
+
}
|
|
1521
|
+
return (t.endpoint === null || t.endpoint === "") && this.config.transport === void 0 && (this.diagnostics.report("config.invalid", "You cannot remove the endpoint after the delivery stack loads. The current endpoint stays."), t = {
|
|
1901
1522
|
...t,
|
|
1902
1523
|
endpoint: void 0
|
|
1903
1524
|
}), t;
|
|
1904
1525
|
}
|
|
1905
1526
|
keepBuiltIdentity() {
|
|
1527
|
+
if (!this.tunablesLocked) {
|
|
1528
|
+
this.identityBuiltAs = this.config.identity;
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1906
1531
|
let e = this.identityBuiltAs;
|
|
1907
1532
|
this.config.identity !== e && (this.diagnostics.report("config.invalid", `identity cannot change after startup. It stays ${e}.`, { requested: this.config.identity }), this.config.identity = e);
|
|
1908
1533
|
}
|
|
1534
|
+
launch() {
|
|
1535
|
+
this.startFailed || (this.tunablesLocked || (this.tunablesLocked = !0, this.config.enabled || this.drops.add("disabled", this.rehookHeld())), !this.running && this.config.enabled && this.start());
|
|
1536
|
+
}
|
|
1537
|
+
start() {
|
|
1538
|
+
this.running = !0, this.identityBuiltAs === "storage" && !this.onServer() && (this.backing = Je);
|
|
1539
|
+
let { sessionIdleMs: e, traceMaxAgeMs: t } = this.config.correlation, { sessionId: n, tabId: r } = qe(this.diagnostics, this.stores, e);
|
|
1540
|
+
this.sessionTouch = new We(this.diagnostics, this.stores, e), this.sessionPicked ? this.sessionTouch.restart(this.identity.sessionId) : this.identity.sessionId = n, this.identity.tabId = r, this.builder.invalidateResource(), this.breadcrumbs.retain((e) => !An.includes(e.category)), this.tracing.setup(t ?? Infinity, this.config.otelLoader), this.tracing.loadOtel();
|
|
1541
|
+
for (let e of this.rehookHeld()) this.bootBuffer.push(e, this.config.buffering.maxHeldRecords);
|
|
1542
|
+
this.openGate(), this.init();
|
|
1543
|
+
}
|
|
1544
|
+
rehookHeld() {
|
|
1545
|
+
return this.bootBuffer.take().map((e) => this.builder.rehook(e)).filter((e) => e !== null);
|
|
1546
|
+
}
|
|
1909
1547
|
async init() {
|
|
1910
1548
|
this.degraded || addEventListener("pagehide", this.onPageHide);
|
|
1911
1549
|
let e = this.installCaptures();
|
|
@@ -1938,22 +1576,23 @@ var q = class e {
|
|
|
1938
1576
|
}
|
|
1939
1577
|
async buildBus() {
|
|
1940
1578
|
try {
|
|
1941
|
-
|
|
1579
|
+
await this.startGate;
|
|
1580
|
+
let { Bus: e } = await import("./bus-C39wspFV.js");
|
|
1942
1581
|
if (this.destroyed) return null;
|
|
1943
1582
|
let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
|
|
1944
1583
|
onSecurityContext: (e) => {
|
|
1945
1584
|
if (this.explicitSecurityContext && this.config.securityContext.id !== e) return this.contextMismatch = !0, this.diagnostics.report("security.context_mismatch", "The configured security context differs from the upstream owner."), !1;
|
|
1946
1585
|
if (this.contextMismatch = !1, this.config.securityContext.id !== e) {
|
|
1947
1586
|
if (this.ownerAdopted) {
|
|
1948
|
-
|
|
1587
|
+
R(this), this.drops.add("security_context", [
|
|
1949
1588
|
...this.bootBuffer.take(),
|
|
1950
1589
|
...this.pendingRecords.take(),
|
|
1951
1590
|
...this.forwardBuffer
|
|
1952
1591
|
]), this.forwardBuffer = [], this.context.clear(), this.breadcrumbs.clear();
|
|
1953
1592
|
let e = this.rotating;
|
|
1954
|
-
this.rotating = !0, this.
|
|
1593
|
+
this.rotating = !0, this.collectPoints(), this.profilerOn && j().reset();
|
|
1955
1594
|
let t = this.sessionTouch.stored();
|
|
1956
|
-
this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : A(this.diagnostics)), this.rotating = e, this.
|
|
1595
|
+
this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : A(this.diagnostics)), this.rotating = e, this.advanceIdentity();
|
|
1957
1596
|
}
|
|
1958
1597
|
this.config.securityContext.id = e;
|
|
1959
1598
|
}
|
|
@@ -1962,6 +1601,7 @@ var q = class e {
|
|
|
1962
1601
|
onRecords: (e) => {
|
|
1963
1602
|
this.ingestForwarded(e);
|
|
1964
1603
|
},
|
|
1604
|
+
paused: () => !this.config.enabled,
|
|
1965
1605
|
onJourney: (e) => {
|
|
1966
1606
|
this.journey.applyRemote(e);
|
|
1967
1607
|
},
|
|
@@ -1969,6 +1609,7 @@ var q = class e {
|
|
|
1969
1609
|
onTabConflict: () => {
|
|
1970
1610
|
this.regenerateTabId();
|
|
1971
1611
|
},
|
|
1612
|
+
onFlush: (e) => this.flushFor(e, !1),
|
|
1972
1613
|
remote: this.remote
|
|
1973
1614
|
});
|
|
1974
1615
|
return this.bus = t, t;
|
|
@@ -1980,7 +1621,7 @@ var q = class e {
|
|
|
1980
1621
|
return this.bus?.getRole() ?? "sender";
|
|
1981
1622
|
}
|
|
1982
1623
|
syncSender() {
|
|
1983
|
-
return !this.hasDestination() || this.role() !== "sender" ? Promise.resolve() : this.loadSender();
|
|
1624
|
+
return !this.running || !this.config.enabled || this.deliveryClosed || this.destroyed || !this.hasDestination() || this.role() !== "sender" ? Promise.resolve() : this.loadSender();
|
|
1984
1625
|
}
|
|
1985
1626
|
hasDestination() {
|
|
1986
1627
|
return !!this.config.endpoint || this.config.transport !== void 0;
|
|
@@ -1989,9 +1630,8 @@ var q = class e {
|
|
|
1989
1630
|
return this.senderLoad ??= this.buildSender(), this.senderLoad;
|
|
1990
1631
|
}
|
|
1991
1632
|
async buildSender() {
|
|
1992
|
-
this.storageBuiltAs = this.config.storage;
|
|
1993
1633
|
try {
|
|
1994
|
-
let { Sender: e } = await import("./sender-
|
|
1634
|
+
let { Sender: e } = await import("./sender-Dv8rAmpV.js"), t = this.destroyed ? null : await e.create({
|
|
1995
1635
|
storage: this.memoryStorage,
|
|
1996
1636
|
onStorage: (e) => {
|
|
1997
1637
|
e.name === "memory" && (this.memoryStorage = e);
|
|
@@ -2005,29 +1645,65 @@ var q = class e {
|
|
|
2005
1645
|
onLoss: this.reportLoss,
|
|
2006
1646
|
remote: this.remote,
|
|
2007
1647
|
beforeExit: () => {
|
|
2008
|
-
|
|
1648
|
+
R(this), this.collectPoints(), this.tracing.end();
|
|
1649
|
+
},
|
|
1650
|
+
onSent: (e) => {
|
|
1651
|
+
this.lastSendAt = e;
|
|
2009
1652
|
}
|
|
2010
1653
|
});
|
|
2011
1654
|
if (!t || this.destroyed) {
|
|
2012
|
-
await t?.
|
|
1655
|
+
await t?.discard();
|
|
2013
1656
|
return;
|
|
2014
1657
|
}
|
|
2015
|
-
this.
|
|
1658
|
+
if (this.deliveryClosed) {
|
|
1659
|
+
await this.parkSender(t);
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
this.sender = t, this.config.enabled || t.hold(!0);
|
|
2016
1663
|
} catch (e) {
|
|
2017
1664
|
this.senderLoad = void 0, this.diagnostics.report("pipeline.crashed", "The delivery stack did not load. The library does not send records.", { held: this.pendingRecords.length }, e), this.drops.add("load_failed", this.pendingRecords.records);
|
|
2018
1665
|
}
|
|
2019
1666
|
for (let e of this.pendingRecords.take()) this.sender?.push(e);
|
|
1667
|
+
let e = this.carried;
|
|
1668
|
+
this.carried = [], this.sender && e.length > 0 && await this.adoptStored(this.sender, e);
|
|
1669
|
+
}
|
|
1670
|
+
async adoptStored(e, t) {
|
|
1671
|
+
await this.diagnostics.guardAsync("storage.degraded", "The library could not store the carried batches under the new context.", () => e.adopt(t, this.config.securityContext.id));
|
|
2020
1672
|
}
|
|
2021
1673
|
refreshCaptures() {
|
|
2022
1674
|
if (clearTimeout(this.remoteCaptureTimer), this.remoteCaptureTimer = void 0, this.destroyed) return;
|
|
2023
1675
|
let e = this.remote.sampling?.wire();
|
|
2024
1676
|
e && (this.remoteCaptureTimer = setTimeout(() => {
|
|
2025
1677
|
this.refreshCaptures();
|
|
2026
|
-
}, e.ttlMs),
|
|
1678
|
+
}, e.ttlMs), O(this.remoteCaptureTimer)), this.captureState(this.effectiveCapture()) !== this.installedCaptureKey && this.installCaptures();
|
|
1679
|
+
}
|
|
1680
|
+
captureState(e) {
|
|
1681
|
+
let { enabled: t, framePhases: n, framePacing: r } = this.config.profiler;
|
|
1682
|
+
return `${String(this.config.enabled)}${Fn(e)}${String(t && n)}${String(t && r)}${this.replayState(e)}`;
|
|
1683
|
+
}
|
|
1684
|
+
replayState(e) {
|
|
1685
|
+
let { replay: t } = this.config;
|
|
1686
|
+
return t.enabled ? JSON.stringify([
|
|
1687
|
+
t.loader && G(t.loader),
|
|
1688
|
+
t.onSegment && G(t.onSegment),
|
|
1689
|
+
G(t.recordOptions),
|
|
1690
|
+
t.endpoint,
|
|
1691
|
+
t.requireConsent,
|
|
1692
|
+
t.mode,
|
|
1693
|
+
t.maskText,
|
|
1694
|
+
t.maskInputs,
|
|
1695
|
+
t.maskSelectors,
|
|
1696
|
+
t.blockSelectors,
|
|
1697
|
+
t.recordCanvas,
|
|
1698
|
+
t.bufferMs,
|
|
1699
|
+
t.plugins.map(G),
|
|
1700
|
+
e.fullUrls,
|
|
1701
|
+
e.ignoreUrls.map(String)
|
|
1702
|
+
]) : "";
|
|
2027
1703
|
}
|
|
2028
1704
|
effectiveCapture() {
|
|
2029
1705
|
let e = { ...this.config.capture }, t = this.remote.sampling?.current()?.capture;
|
|
2030
|
-
for (let n of
|
|
1706
|
+
for (let n of Ce) {
|
|
2031
1707
|
let r = t?.[n];
|
|
2032
1708
|
if (e.remoteToggles.includes(n) && r !== void 0) {
|
|
2033
1709
|
if (r && typeof e[n] == "object") continue;
|
|
@@ -2037,21 +1713,26 @@ var q = class e {
|
|
|
2037
1713
|
return e;
|
|
2038
1714
|
}
|
|
2039
1715
|
async installCaptures() {
|
|
2040
|
-
if (this.degraded) return;
|
|
1716
|
+
if (this.degraded || !this.running) return;
|
|
2041
1717
|
let e = ++this.captureGeneration, t = this.effectiveCapture();
|
|
2042
|
-
this.installedCaptureKey =
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
1718
|
+
if (this.installedCaptureKey = this.captureState(t), !this.config.enabled) {
|
|
1719
|
+
this.uninstallCaptures();
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
let n = this.replayState(t);
|
|
1723
|
+
n !== this.replayBuiltKey && (this.replayBuiltKey = "");
|
|
1724
|
+
let r = n !== "" && n === this.replayBuiltKey ? this.replay : void 0, i = [], { profiler: a } = this.config;
|
|
1725
|
+
(t.errors || t.rejections || t.resourceErrors) && i.push("errors"), (t.fetch || t.xhr) && i.push("network"), (t.interactions || t.navigation) && i.push("interactions"), t.webVitals && i.push("webVitals"), t.longFrames && i.push("longFrames"), (typeof t.console == "object" ? t.console.levels?.length !== 0 : t.console) && i.push("console"), t.uncleanExit && i.push("uncleanExit"), t.userTiming && i.push("userTiming"), t.reports && i.push("reports"), t.resourceTiming && i.push("resourceTiming"), t.lifecycle && i.push("lifecycle"), a.enabled && a.framePhases && i.push("framePhases"), a.enabled && a.framePacing && i.push("framePacing"), this.config.replay.enabled && !r && i.push("replay");
|
|
1726
|
+
let [o, s] = await Promise.all([Promise.all(i.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
|
|
2046
1727
|
if (e !== this.captureGeneration || this.destroyed) return;
|
|
2047
|
-
this.uninstallCaptures();
|
|
2048
|
-
let
|
|
1728
|
+
this.uninstallCaptures(r);
|
|
1729
|
+
let c = {
|
|
2049
1730
|
isActive: () => !this.destroyed && !this.rotating,
|
|
2050
1731
|
config: Object.assign(Object.create(this.config), { capture: t }),
|
|
2051
1732
|
diagnostics: this.diagnostics,
|
|
2052
1733
|
breadcrumbs: this.breadcrumbs,
|
|
2053
1734
|
tracing: this.tracing,
|
|
2054
|
-
logger: new
|
|
1735
|
+
logger: new vt(() => this, h),
|
|
2055
1736
|
once: this.captureOnce,
|
|
2056
1737
|
recordMetric: (e, t, n) => {
|
|
2057
1738
|
this.recordMetric(e, t, n);
|
|
@@ -2059,40 +1740,54 @@ var q = class e {
|
|
|
2059
1740
|
recordSpan: (e) => {
|
|
2060
1741
|
this.recordSpan(e);
|
|
2061
1742
|
},
|
|
2062
|
-
sessionId: () => this.identity.sessionId
|
|
1743
|
+
sessionId: () => this.identity.sessionId,
|
|
1744
|
+
onError: (e) => {
|
|
1745
|
+
this.errorHook = e;
|
|
1746
|
+
},
|
|
1747
|
+
setContext: (e, t) => {
|
|
1748
|
+
this.context.merge({ [e]: t ?? null });
|
|
1749
|
+
},
|
|
1750
|
+
replayConsent: () => this.replayConsent
|
|
2063
1751
|
};
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
1752
|
+
o.forEach((e, t) => {
|
|
1753
|
+
if (e) {
|
|
1754
|
+
let r = new e(c);
|
|
1755
|
+
this.captures.push(r), i[t] === "replay" && (this.replay = r, this.replayBuiltKey = n);
|
|
1756
|
+
}
|
|
1757
|
+
});
|
|
1758
|
+
let l = s ? [...t.plugins, new s(this.diagnostics, c.config)] : t.plugins;
|
|
1759
|
+
for (let e of l) this.captures.push(this.pluginCapture(e));
|
|
2067
1760
|
for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
|
|
2068
1761
|
e.install();
|
|
2069
1762
|
});
|
|
2070
1763
|
}
|
|
2071
|
-
uninstallCaptures() {
|
|
2072
|
-
for (let
|
|
2073
|
-
|
|
1764
|
+
uninstallCaptures(e) {
|
|
1765
|
+
for (let t of this.captures) t !== e && this.diagnostics.guard("capture.install_failed", `The library could not uninstall the ${t.name} capture.`, () => {
|
|
1766
|
+
t.uninstall();
|
|
2074
1767
|
});
|
|
2075
|
-
this.captures.length = 0;
|
|
1768
|
+
this.captures.length = 0, this.replay = e, e && this.captures.push(e);
|
|
2076
1769
|
}
|
|
2077
1770
|
loadWebSocket() {
|
|
2078
|
-
return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-
|
|
1771
|
+
return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-DSHgDiZ6.js")).WebSocketCapture);
|
|
2079
1772
|
}
|
|
2080
1773
|
pluginCapture(e) {
|
|
2081
1774
|
let { name: t } = e, n = (e, t, n) => {
|
|
2082
1775
|
this.recordMetric(e, t, n);
|
|
2083
|
-
}, r = {
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
1776
|
+
}, r = (e) => {
|
|
1777
|
+
this.diagnostics.report("config.invalid", Ae, void 0, e);
|
|
1778
|
+
}, i = {
|
|
1779
|
+
logger: new B(() => this, `${h}.${t}`),
|
|
1780
|
+
counter: (e, t = {}) => Vt(e, t, n, r),
|
|
1781
|
+
histogram: (e, t = {}) => Ut(e, t, n, r),
|
|
2087
1782
|
addBreadcrumb: (e, t) => {
|
|
2088
1783
|
this.addBreadcrumb(e, t);
|
|
2089
1784
|
},
|
|
2090
|
-
ownRequest:
|
|
1785
|
+
ownRequest: Qe
|
|
2091
1786
|
};
|
|
2092
1787
|
return {
|
|
2093
1788
|
name: t,
|
|
2094
1789
|
install: () => {
|
|
2095
|
-
e.install(
|
|
1790
|
+
e.install(i);
|
|
2096
1791
|
},
|
|
2097
1792
|
uninstall: () => {
|
|
2098
1793
|
e.uninstall();
|
|
@@ -2100,7 +1795,7 @@ var q = class e {
|
|
|
2100
1795
|
};
|
|
2101
1796
|
}
|
|
2102
1797
|
loadCapture(e) {
|
|
2103
|
-
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`,
|
|
1798
|
+
return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, wn[e]);
|
|
2104
1799
|
}
|
|
2105
1800
|
registerWorker(e, t = {}) {
|
|
2106
1801
|
let n = !1, r;
|
|
@@ -2120,23 +1815,85 @@ var q = class e {
|
|
|
2120
1815
|
n = !0, r?.();
|
|
2121
1816
|
};
|
|
2122
1817
|
}
|
|
2123
|
-
async destroy() {
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1818
|
+
async destroy(e) {
|
|
1819
|
+
let { discard: t, scope: n } = this.shutdownRule(e);
|
|
1820
|
+
this.stopping ??= this.stop(t), await this.stopping, n !== void 0 && await this.clearStorage(n);
|
|
1821
|
+
}
|
|
1822
|
+
async stop(t) {
|
|
1823
|
+
t || (R(this), this.collectPoints(), this.tracing.end()), this.profilerOn && (this.profilerOn = !1, j().detach()), this.destroyed = !0, this.backing = Ke(), dt(this), this.collectPoints(), clearTimeout(this.remoteCaptureTimer), this.remoteCaptureTimer = void 0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
|
|
1824
|
+
let n = t ? this.discardHeld() : this.flushHeld();
|
|
1825
|
+
this.journey.destroy(), this.bus?.destroy(), await n, await this.senderLoad, await this.rotation?.catch(() => void 0);
|
|
1826
|
+
let r = this.parkedSender;
|
|
1827
|
+
this.parkedSender = void 0, await this.diagnostics.guardAsync("pipeline.crashed", "The delivery stack of the old context did not stop at shutdown. The library leaves its stored batches in storage.", async () => {
|
|
1828
|
+
await (t ? r?.discard() : r?.retire("retain", 0, this.config.securityContext.id));
|
|
1829
|
+
}), await this.memoryStorage?.close(), e.pinned() === this && (Reflect.deleteProperty(globalThis, Dn), globalThis[On] = this);
|
|
1830
|
+
}
|
|
1831
|
+
shutdownRule(e) {
|
|
1832
|
+
let t = this.readOptions(e, Mn);
|
|
1833
|
+
if (t === void 0) return { discard: !0 };
|
|
1834
|
+
let { pending: n, clearStorage: r } = t, i = r == null, a = i || r === "context" || r === "namespace", o;
|
|
1835
|
+
i || (o = r === "namespace" ? "namespace" : "context");
|
|
1836
|
+
let s = n === void 0 || n === "flush";
|
|
1837
|
+
return (!a || !(s || n === "discard") || n === "flush" && o) && this.diagnostics.report("config.invalid", Mn), {
|
|
1838
|
+
discard: !s || o !== void 0,
|
|
1839
|
+
scope: o
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
async flushHeld() {
|
|
1843
|
+
this.dropPaused();
|
|
1844
|
+
let e = this.sender?.destroy();
|
|
1845
|
+
this.sendForwarded(), this.drops.add("load_failed", this.unreported(this.pendingRecords.take())), await e;
|
|
1846
|
+
}
|
|
1847
|
+
async discardHeld() {
|
|
1848
|
+
let e = [
|
|
1849
|
+
...this.bootBuffer.take(),
|
|
1850
|
+
...this.pendingRecords.take(),
|
|
1851
|
+
...this.forwardBuffer
|
|
1852
|
+
];
|
|
1853
|
+
this.forwardBuffer = [], this.breadcrumbs.clear(), this.debugBuffer.clear(), this.context.clear(), this.journey.applyRemote(null);
|
|
1854
|
+
let t = await this.sender?.discard() ?? [];
|
|
1855
|
+
this.drops.add("discarded", this.unreported([...e, ...t]));
|
|
1856
|
+
}
|
|
1857
|
+
async clearStorage(e) {
|
|
1858
|
+
this.tunablesLocked && await this.diagnostics.guardAsync("storage.degraded", "The library could not remove the stored batches at shutdown.", async () => {
|
|
1859
|
+
let { clearStored: t } = await import("./stored-context-B2EzVuYm.js"), n = this.carried.map((e) => e.id);
|
|
1860
|
+
this.carried = [], await t(this.storeAccess(), e, n, this.identityBuiltAs === "storage" && !this.onServer());
|
|
1861
|
+
});
|
|
2128
1862
|
}
|
|
2129
1863
|
emit(e) {
|
|
2130
|
-
if (!e || this.destroyed
|
|
1864
|
+
if (!e || this.destroyed) return;
|
|
1865
|
+
if (this.rotating && !this.closingContext) {
|
|
1866
|
+
this.drops.add("security_context", [e]);
|
|
1867
|
+
return;
|
|
1868
|
+
}
|
|
2131
1869
|
this.sessionTouch.touch(this.identity.sessionId);
|
|
2132
|
-
let t = e.severityText === "ERROR" || e.severityText === "FATAL" ? [...this.debugBuffer.drain(), e] : [e];
|
|
2133
|
-
|
|
1870
|
+
let t = e.severityText === "ERROR" || e.severityText === "FATAL", n = t ? [...this.debugBuffer.drain(), e] : [e];
|
|
1871
|
+
t && this.errorHook?.(e);
|
|
1872
|
+
for (let e of n) this.ready ? this.route(e) : this.bootBuffer.push(e, this.config.buffering.maxHeldRecords);
|
|
2134
1873
|
}
|
|
2135
1874
|
route(e) {
|
|
2136
1875
|
this.role() === "forwarder" ? this.forward(e) : this.deliver(e);
|
|
2137
1876
|
}
|
|
2138
1877
|
deliver(e) {
|
|
2139
|
-
|
|
1878
|
+
if (this.deliveryClosed) {
|
|
1879
|
+
this.drops.add("security_context", [e]);
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
if (this.sender) {
|
|
1883
|
+
this.sender.push(e);
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
let t = !this.config.enabled && this.hasDestination();
|
|
1887
|
+
!this.senderLoad && !t ? (this.diagnostics.count("record.dropped_no_destination"), this.hasDestination() && this.drops.add("load_failed", [e])) : this.pendingRecords.push(e, this.config.buffering.maxHeldRecords);
|
|
1888
|
+
}
|
|
1889
|
+
dropPaused() {
|
|
1890
|
+
if (this.config.enabled) return;
|
|
1891
|
+
let e = this.unreported([...this.pendingRecords.records, ...this.sender?.records() ?? []]);
|
|
1892
|
+
for (let t of e) this.pausedLoss.add(t);
|
|
1893
|
+
this.drops.add("disabled", e);
|
|
1894
|
+
}
|
|
1895
|
+
unreported(e) {
|
|
1896
|
+
return e.filter((e) => !this.pausedLoss.has(e));
|
|
2140
1897
|
}
|
|
2141
1898
|
dropHeld(e) {
|
|
2142
1899
|
this.diagnostics.count("record.dropped_boot_buffer_full"), this.drops.add("buffer_full", [e]);
|
|
@@ -2148,7 +1905,9 @@ var q = class e {
|
|
|
2148
1905
|
}
|
|
2149
1906
|
sendForwarded() {
|
|
2150
1907
|
let e = this.forwardBuffer;
|
|
2151
|
-
this.forwardBuffer = []
|
|
1908
|
+
this.forwardBuffer = [];
|
|
1909
|
+
let { bus: t } = this;
|
|
1910
|
+
return e.length === 0 || !t ? 0 : t.sendRecords(e);
|
|
2152
1911
|
}
|
|
2153
1912
|
ingestForwarded(e) {
|
|
2154
1913
|
if (this.destroyed) return;
|
|
@@ -2158,11 +1917,11 @@ var q = class e {
|
|
|
2158
1917
|
}
|
|
2159
1918
|
let t = [];
|
|
2160
1919
|
for (let n of e) {
|
|
2161
|
-
if (!
|
|
1920
|
+
if (!Ne(n)) {
|
|
2162
1921
|
this.diagnostics.count("record.dropped_malformed");
|
|
2163
1922
|
continue;
|
|
2164
1923
|
}
|
|
2165
|
-
if (n.attributes["uiobs.debug_buffer"] !== !0 && !
|
|
1924
|
+
if (n.attributes["uiobs.debug_buffer"] !== !0 && !it(n, this.config, this.remote.sampling?.current() ?? null)) {
|
|
2166
1925
|
this.diagnostics.count("record.dropped_by_sampling");
|
|
2167
1926
|
continue;
|
|
2168
1927
|
}
|
|
@@ -2170,108 +1929,118 @@ var q = class e {
|
|
|
2170
1929
|
e && t.push(e);
|
|
2171
1930
|
}
|
|
2172
1931
|
if (this.rotating) this.drops.add("security_context", t);
|
|
1932
|
+
else if (!this.config.enabled) this.drops.add("disabled", t);
|
|
2173
1933
|
else for (let e of t) this.deliver(e);
|
|
2174
1934
|
}
|
|
2175
1935
|
releaseBootBuffer() {
|
|
2176
1936
|
let e = this.bootBuffer.take(), { processors: t, redact: n } = this.config, r = t.length === 0 && n === void 0 ? this.journey.current() : null;
|
|
2177
1937
|
for (let t of e) r && !t.attributes["journey.id"] && (t.attributes["journey.id"] = r.id, t.attributes["journey.name"] = r.name), this.route(t);
|
|
2178
1938
|
}
|
|
2179
|
-
reportLoss = (e, t, n) => {
|
|
2180
|
-
this.drops.add(e, t, n);
|
|
2181
|
-
};
|
|
2182
|
-
reportGap = (e, t) => {
|
|
2183
|
-
this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
|
|
2184
|
-
let n = Date.now();
|
|
2185
|
-
n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, Ie).warn("stored records were dropped before delivery", {
|
|
2186
|
-
"gap.batches": e.batches,
|
|
2187
|
-
"gap.records": e.records,
|
|
2188
|
-
"gap.reason": e.reason
|
|
2189
|
-
}));
|
|
2190
|
-
};
|
|
2191
1939
|
regenerateTabId() {
|
|
2192
1940
|
let e = A(this.diagnostics);
|
|
2193
1941
|
this.diagnostics.report("bus.role_resolved", "Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.", {
|
|
2194
1942
|
was: this.identity.tabId,
|
|
2195
1943
|
now: e
|
|
2196
|
-
}), this.identity.tabId = e,
|
|
1944
|
+
}), this.identity.tabId = e, Ue(e, this.diagnostics, this.stores), this.builder.invalidateResource();
|
|
2197
1945
|
}
|
|
2198
1946
|
newSession() {
|
|
2199
|
-
this.destroyed || (
|
|
1947
|
+
this.destroyed || (R(this), this.resetSession(A(this.diagnostics)));
|
|
2200
1948
|
}
|
|
2201
1949
|
resetSession(e) {
|
|
2202
|
-
this.
|
|
1950
|
+
this.sessionPicked = !0, this.collectPoints(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear(), this.debugBuffer.clear(), this.replay?.reset(), this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
|
|
2203
1951
|
}
|
|
2204
1952
|
rotateSecurityContext(e, t = {}) {
|
|
2205
|
-
if (this.
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
1953
|
+
if (this.destroyed) return Promise.reject(/* @__PURE__ */ Error("The runtime has stopped."));
|
|
1954
|
+
if (!this.tunablesLocked) return Promise.reject(/* @__PURE__ */ Error("The runtime is not configured. Call configure() before rotateSecurityContext()."));
|
|
1955
|
+
R(this), this.rotating = !0;
|
|
1956
|
+
let n = ++this.rotationSeq, r = (this.rotation ?? Promise.resolve()).catch(() => void 0).then(() => this.runRotation(e, t, n));
|
|
1957
|
+
this.rotation = r;
|
|
1958
|
+
let i = () => {
|
|
1959
|
+
this.rotation === r && (this.rotation = void 0, this.rotating = !1, this.retiring = void 0);
|
|
1960
|
+
};
|
|
1961
|
+
return r.then(i, i), r;
|
|
1962
|
+
}
|
|
1963
|
+
async runRotation(e, t, n) {
|
|
1964
|
+
if (this.destroyed) throw Error("The runtime has stopped.");
|
|
2217
1965
|
if (await this.started, this.role() === "forwarder") throw Error("Rotate the security context on the upstream owner, or use bus.mode: sender for an independent identity.");
|
|
2218
|
-
|
|
2219
|
-
let r = this.config.securityContext.id, i = e.id ?? A(this.diagnostics);
|
|
2220
|
-
if (i === r) throw Error("A rotation requires a different security-context id.");
|
|
2221
|
-
let a = {
|
|
2222
|
-
...jr,
|
|
2223
|
-
...e.delivery
|
|
2224
|
-
}, o = this.diagnostics.snapshot()["config.invalid"] ?? 0, s = G(this.allowed({
|
|
2225
|
-
...a,
|
|
2226
|
-
securityContext: { id: i }
|
|
2227
|
-
}), this.diagnostics, {
|
|
2228
|
-
...this.config,
|
|
2229
|
-
...jr
|
|
2230
|
-
});
|
|
2231
|
-
if ((this.diagnostics.snapshot()["config.invalid"] ?? 0) !== o) throw Error("Invalid delivery settings for the next security context.");
|
|
2232
|
-
let c = e.context ? Object.fromEntries(Object.entries(e.context)) : void 0, l = /* @__PURE__ */ new Set([
|
|
2233
|
-
this.config.endpoint,
|
|
2234
|
-
this.config.metricsEndpoint,
|
|
2235
|
-
this.config.tracesEndpoint
|
|
2236
|
-
]), u = /* @__PURE__ */ new Set([
|
|
2237
|
-
s.endpoint,
|
|
2238
|
-
s.metricsEndpoint,
|
|
2239
|
-
s.tracesEndpoint
|
|
2240
|
-
]);
|
|
2241
|
-
s.capture.ignoreUrls = s.capture.ignoreUrls.filter((e) => !l.has(e) || u.has(e)), this.closingContext = !0;
|
|
1966
|
+
let r;
|
|
2242
1967
|
try {
|
|
2243
|
-
|
|
2244
|
-
}
|
|
2245
|
-
this.
|
|
1968
|
+
r = (await import("./rotation-Cwct4ckk.js")).rotateContext;
|
|
1969
|
+
} catch (e) {
|
|
1970
|
+
throw this.diagnostics.report("pipeline.crashed", "The library could not load the security-context rotation.", void 0, e), await this.closeDelivery(), e;
|
|
2246
1971
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
1972
|
+
if (this.isDestroyed()) throw Error("The runtime has stopped.");
|
|
1973
|
+
await r(this.rotationHost(), e, t, n);
|
|
1974
|
+
}
|
|
1975
|
+
rotationHost() {
|
|
1976
|
+
return {
|
|
1977
|
+
runtime: this,
|
|
1978
|
+
quiet: new V(),
|
|
1979
|
+
senderLoaded: async () => {
|
|
1980
|
+
await this.senderLoad;
|
|
1981
|
+
},
|
|
1982
|
+
allowed: (e) => this.allowed(e),
|
|
1983
|
+
closeDelivery: () => this.closeDelivery(),
|
|
1984
|
+
closeContext: () => {
|
|
1985
|
+
this.closingContext = !0;
|
|
1986
|
+
try {
|
|
1987
|
+
this.collectPoints(), this.tracing.end(), this.journey.end();
|
|
1988
|
+
} finally {
|
|
1989
|
+
this.closingContext = !1;
|
|
1990
|
+
}
|
|
1991
|
+
},
|
|
1992
|
+
takeOld: () => {
|
|
1993
|
+
let e = [
|
|
1994
|
+
...this.bootBuffer.take(),
|
|
1995
|
+
...this.pendingRecords.take(),
|
|
1996
|
+
...this.forwardBuffer
|
|
1997
|
+
], t = this.sender ?? this.parkedSender;
|
|
1998
|
+
this.retiring = t;
|
|
1999
|
+
let n = this.carried;
|
|
2000
|
+
return this.forwardBuffer = [], this.carried = [], this.sender = void 0, this.senderLoad = void 0, this.parkedSender = void 0, {
|
|
2001
|
+
held: e,
|
|
2002
|
+
sender: t,
|
|
2003
|
+
closed: this.deliveryClosed,
|
|
2004
|
+
carried: n
|
|
2005
|
+
};
|
|
2006
|
+
},
|
|
2007
|
+
drop: (e) => {
|
|
2008
|
+
this.drops.add("security_context", this.unreported(e));
|
|
2009
|
+
},
|
|
2010
|
+
storeAccess: () => this.storeAccess(),
|
|
2011
|
+
advanceIdentity: () => {
|
|
2012
|
+
this.advanceIdentity();
|
|
2013
|
+
},
|
|
2014
|
+
openDelivery: async () => {
|
|
2015
|
+
this.deliveryClosed = !1, await this.syncSender(), this.bus?.rotateContext();
|
|
2016
|
+
},
|
|
2017
|
+
endRotation: (e) => {
|
|
2018
|
+
this.rotating = e !== this.rotationSeq;
|
|
2019
|
+
},
|
|
2020
|
+
route: (e) => {
|
|
2021
|
+
this.route(e);
|
|
2022
|
+
},
|
|
2023
|
+
adopt: async (e) => {
|
|
2024
|
+
this.config.enabled ? await this.sender?.adopt(e, this.config.securityContext.id) : this.carried = [...e];
|
|
2025
|
+
}
|
|
2258
2026
|
};
|
|
2259
|
-
if (this.destroyed) return;
|
|
2260
|
-
let m = [...d, ...p.buffered], h = p.stored.flatMap((e) => e.records);
|
|
2261
|
-
t !== "retain" && t !== "carry" && this.drops.add("security_context", [...m, ...h]), s.lockConfiguration = this.config.lockConfiguration, rr(this.config, s), this.identityEpoch++, this.remote.sampling = null, this.refreshCaptures(), this.context.clear(), c && this.context.setMany(c), this.breadcrumbs.clear(), this.newSession(), this.builder.invalidateResource(), await this.syncSender(), this.bus?.rotateContext(), this.rotating = !1, t === "carry" && await this.carry(m, p.stored), this.diagnostics.report("security.rotated", "The runtime rotated its security context.", { pending: t });
|
|
2262
2027
|
}
|
|
2263
|
-
async
|
|
2264
|
-
|
|
2265
|
-
|
|
2028
|
+
async closeDelivery() {
|
|
2029
|
+
this.deliveryClosed = !0, this.diagnostics.report("security.rotation_failed", "The security-context rotation failed. The library sends no record until a rotation succeeds."), await this.senderLoad;
|
|
2030
|
+
let e = this.sender;
|
|
2031
|
+
this.sender = void 0, this.senderLoad = void 0, e && await this.parkSender(e), this.drops.add("security_context", this.unreported(this.pendingRecords.take()));
|
|
2032
|
+
}
|
|
2033
|
+
async parkSender(e) {
|
|
2034
|
+
this.parkedSender = e, await this.diagnostics.guardAsync("pipeline.crashed", "The delivery stack of the old context did not stop. The next rotation that succeeds retires it.", () => e.pause(this.config.securityContext.id));
|
|
2266
2035
|
}
|
|
2267
2036
|
async debugBundle(e) {
|
|
2268
|
-
let { configSummary: t } = await import("./debug-bundle-
|
|
2037
|
+
let { configSummary: t } = await import("./debug-bundle-CRpYV_ui.js"), { record: n } = this.builder.build({
|
|
2269
2038
|
level: "INFO",
|
|
2270
2039
|
type: "system",
|
|
2271
2040
|
body: "debug bundle",
|
|
2272
|
-
namespace:
|
|
2273
|
-
payload: { [
|
|
2274
|
-
}, !0), r = n?.attributes ?? {}, i = r[
|
|
2041
|
+
namespace: c,
|
|
2042
|
+
payload: { [y]: this.breadcrumbs.snapshot() }
|
|
2043
|
+
}, !0), r = n?.attributes ?? {}, i = r[y], a = r[T];
|
|
2275
2044
|
return {
|
|
2276
2045
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2277
2046
|
sdkVersion: this.sdkVersion,
|
|
@@ -2285,72 +2054,114 @@ var q = class e {
|
|
|
2285
2054
|
};
|
|
2286
2055
|
}
|
|
2287
2056
|
async health() {
|
|
2288
|
-
let e = this.sender?.stats()
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
this.mismatchVersion && t.push("runtime.version_mismatch"), this.contextMismatch && t.push("security.context_mismatch"), this.ready && this.hasDestination() && this.role() === "sender" && !this.sender && t.push("sender.unavailable");
|
|
2294
|
-
let { sourcePolicy: n, validation: r, maxMessageBytes: i, maxRecordsPerMessage: a, maxMessagesPerSecond: o, maxTrackedSources: s } = this.config.bus;
|
|
2057
|
+
let e = this.sender?.stats(), t = [];
|
|
2058
|
+
this.mismatchVersion && t.push("runtime.version_mismatch"), this.contextMismatch && t.push("security.context_mismatch");
|
|
2059
|
+
let { redact: n, processors: r } = this.config;
|
|
2060
|
+
(n === F || r.includes(F)) && t.push("records.refused"), this.deliveryClosed ? t.push("security.rotation_failed") : this.ready && this.config.enabled && this.hasDestination() && this.role() === "sender" && !this.sender && t.push("sender.unavailable");
|
|
2061
|
+
let { sourcePolicy: i, maxMessageBytes: a, maxRecordsPerMessage: o, maxMessagesPerSecond: s } = this.config.bus;
|
|
2295
2062
|
return {
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2063
|
+
delivery: {
|
|
2064
|
+
pending: (e?.pending ?? 0) + this.heldRecords(),
|
|
2065
|
+
inFlight: e?.inFlight ?? 0,
|
|
2066
|
+
stored: await this.storedBatches(),
|
|
2067
|
+
lastSendAt: this.lastSendAt,
|
|
2068
|
+
lastFailureAt: e?.lastFailureAt ?? null,
|
|
2069
|
+
consecutiveFailures: e?.consecutiveFailures ?? 0,
|
|
2070
|
+
throttledUntil: e?.throttledUntil ?? null,
|
|
2071
|
+
dropped: this.drops.counts()
|
|
2072
|
+
},
|
|
2299
2073
|
sdkVersion: this.sdkVersion,
|
|
2300
2074
|
owningSdkVersion: this.mismatchVersion,
|
|
2301
|
-
status: this.destroyed ? "stopped" : this.rotating ? "rotating" : t.length ? "degraded" : this.ready ? "ready" : "starting",
|
|
2075
|
+
status: this.destroyed ? "stopped" : this.tunablesLocked ? this.config.enabled ? this.rotating ? "rotating" : t.length ? "degraded" : this.ready ? "ready" : "starting" : "disabled" : "unconfigured",
|
|
2302
2076
|
mode: this.role() === "forwarder" ? "forwarder" : this.hasDestination() ? "sender" : "console-only",
|
|
2303
|
-
senderReady: this.sender !== void 0 && !this.destroyed && !this.rotating,
|
|
2077
|
+
senderReady: this.sender !== void 0 && this.config.enabled && !this.destroyed && !this.rotating && !this.deliveryClosed,
|
|
2304
2078
|
configurationLocked: this.config.lockConfiguration,
|
|
2305
2079
|
issues: t,
|
|
2306
2080
|
securityContext: { ...this.config.securityContext },
|
|
2307
2081
|
storagePersistence: this.storagePersistence,
|
|
2308
2082
|
bus: {
|
|
2309
|
-
sourcePolicy:
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
maxMessagesPerSecond: o,
|
|
2314
|
-
maxTrackedSources: s
|
|
2083
|
+
sourcePolicy: i,
|
|
2084
|
+
maxMessageBytes: a,
|
|
2085
|
+
maxRecordsPerMessage: o,
|
|
2086
|
+
maxMessagesPerSecond: s
|
|
2315
2087
|
}
|
|
2316
2088
|
};
|
|
2317
2089
|
}
|
|
2318
|
-
|
|
2319
|
-
let e = await this.queueDepth(), t = this.sender?.stats() ?? {
|
|
2320
|
-
pending: 0,
|
|
2321
|
-
inFlight: 0,
|
|
2322
|
-
lastSendAt: null
|
|
2323
|
-
}, n = this.bootBuffer.length + this.pendingRecords.length + this.forwardBuffer.length;
|
|
2090
|
+
storeAccess() {
|
|
2324
2091
|
return {
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2092
|
+
config: this.config,
|
|
2093
|
+
diagnostics: this.diagnostics,
|
|
2094
|
+
memory: this.memoryStorage
|
|
2328
2095
|
};
|
|
2329
2096
|
}
|
|
2330
|
-
async
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2097
|
+
async storedBatches() {
|
|
2098
|
+
return await (this.sender ?? this.parkedSender)?.queueDepth() ?? 0;
|
|
2099
|
+
}
|
|
2100
|
+
flush(e) {
|
|
2101
|
+
return this.flushFor(this.flushTimeout(e), !0);
|
|
2102
|
+
}
|
|
2103
|
+
async flushFor(e, t) {
|
|
2104
|
+
R(this), t && this.collectPoints();
|
|
2105
|
+
let n = this.idle();
|
|
2106
|
+
if (n) return n;
|
|
2107
|
+
let r = Date.now() + e, i, a = new Promise((t) => {
|
|
2108
|
+
let n = setTimeout(t, e);
|
|
2109
|
+
O(n), i = () => {
|
|
2110
|
+
clearTimeout(n);
|
|
2111
|
+
};
|
|
2112
|
+
});
|
|
2341
2113
|
try {
|
|
2342
|
-
|
|
2114
|
+
return await this.flushBefore(r, a);
|
|
2343
2115
|
} finally {
|
|
2344
|
-
|
|
2116
|
+
i();
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
async flushBefore(e, t) {
|
|
2120
|
+
let n = this.heldRecords(), r = this.ready ? this.senderLoad : this.started;
|
|
2121
|
+
if (r && (!this.ready || !this.sender) && !await Promise.race([r.then(() => !0), t.then(() => !1)])) return K({ pending: this.waiting() });
|
|
2122
|
+
let { bus: i } = this, a = i?.getRole() === "forwarder", o = this.idle();
|
|
2123
|
+
if (o) return o;
|
|
2124
|
+
if (a) {
|
|
2125
|
+
let n = this.forwardBuffer.length, r = this.sendForwarded(), a = n - r, o = Math.floor(Math.max(0, e - Date.now()) * xe), s = await i.requestFlush(o, t);
|
|
2126
|
+
return s ? {
|
|
2127
|
+
...s,
|
|
2128
|
+
forwarded: r,
|
|
2129
|
+
dropped: s.dropped + a
|
|
2130
|
+
} : K({
|
|
2131
|
+
forwarded: r,
|
|
2132
|
+
pending: r,
|
|
2133
|
+
dropped: a
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
let { sender: s } = this;
|
|
2137
|
+
return s ? K(await s.flushUntil(t)) : this.rotating ? K({ pending: n + this.waiting() }) : zn("complete", { dropped: n });
|
|
2138
|
+
}
|
|
2139
|
+
idle() {
|
|
2140
|
+
return this.tunablesLocked && this.config.enabled && !this.destroyed ? null : zn("inactive", { pending: this.destroyed ? 0 : this.waiting() });
|
|
2141
|
+
}
|
|
2142
|
+
heldRecords() {
|
|
2143
|
+
return this.bootBuffer.length + this.pendingRecords.length + this.forwardBuffer.length;
|
|
2144
|
+
}
|
|
2145
|
+
waiting() {
|
|
2146
|
+
let e = this.heldRecords();
|
|
2147
|
+
for (let t of [this.sender, this.retiring]) {
|
|
2148
|
+
let n = t?.stats();
|
|
2149
|
+
e += n ? n.pending + n.inFlight : 0;
|
|
2345
2150
|
}
|
|
2151
|
+
return e;
|
|
2346
2152
|
}
|
|
2347
|
-
|
|
2348
|
-
|
|
2153
|
+
readOptions(e, t) {
|
|
2154
|
+
if (typeof e != "object" && e !== void 0) this.diagnostics.report("config.invalid", t);
|
|
2155
|
+
else return this.diagnostics.guard("config.invalid", t, () => ({ ...e }));
|
|
2349
2156
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2157
|
+
flushTimeout(e) {
|
|
2158
|
+
let t = this.readOptions(e, Nn);
|
|
2159
|
+
if (!t) return ae;
|
|
2160
|
+
let n = t.timeoutMs ?? 5e3;
|
|
2161
|
+
return typeof n == "number" && n >= 0 && n <= 6e5 ? n : (this.diagnostics.report("config.invalid", Nn), ae);
|
|
2352
2162
|
}
|
|
2353
2163
|
};
|
|
2164
|
+
k(q, "local", null);
|
|
2354
2165
|
function J(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
2355
2166
|
if (Object.is(e, t)) return !0;
|
|
2356
2167
|
if (e instanceof RegExp && t instanceof RegExp) return String(e) === String(t);
|
|
@@ -2358,38 +2169,38 @@ function J(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
|
2358
2169
|
if (n.has(e)) return n.get(e) === t;
|
|
2359
2170
|
n.set(e, t);
|
|
2360
2171
|
let r = Object.keys(e), i = Object.keys(t);
|
|
2361
|
-
return r.length === i.length && r.every((r) =>
|
|
2172
|
+
return r.length === i.length && r.every((r) => ze(t, r) && J(Reflect.get(e, r), Reflect.get(t, r), n));
|
|
2362
2173
|
}
|
|
2363
2174
|
// src/transport/worker-entry.ts
|
|
2364
2175
|
var Y;
|
|
2365
|
-
function
|
|
2176
|
+
function Vn(e = {}) {
|
|
2366
2177
|
if (Y) return Y;
|
|
2367
|
-
let
|
|
2368
|
-
if (typeof document < "u" || typeof addEventListener != "function") return
|
|
2369
|
-
let
|
|
2370
|
-
|
|
2371
|
-
let
|
|
2372
|
-
if (!
|
|
2373
|
-
let
|
|
2374
|
-
|
|
2375
|
-
|
|
2178
|
+
let t = new V(e.onDiagnostic);
|
|
2179
|
+
if (typeof document < "u" || typeof addEventListener != "function") return t.report("config.invalid", "Call serveTransportWorker() in a dedicated worker."), () => void 0;
|
|
2180
|
+
let n = !1, r, i, a = (e) => {
|
|
2181
|
+
t.guard("transport.http_error", "The transport worker could not read its connection.", () => {
|
|
2182
|
+
let a = e.data;
|
|
2183
|
+
if (!D(a) || a.p !== "ui-observability.transport/1" || a.t !== we.connect || e.ports.length === 0) return;
|
|
2184
|
+
let o = e.ports[0];
|
|
2185
|
+
r || a.v !== "1.0.0" ? (o.postMessage(_e), o.close()) : (r = o, import("./worker-server-iUVSjH8L.js").then((e) => {
|
|
2186
|
+
n || (i = e.serveWorkerPort(o, t));
|
|
2376
2187
|
}).catch((e) => {
|
|
2377
|
-
|
|
2378
|
-
|
|
2188
|
+
t.report("transport.http_error", "The transport worker delivery module could not load.", void 0, e), t.guard("transport.http_error", "The failed transport port could not be closed.", () => {
|
|
2189
|
+
o.postMessage(_e), o.close();
|
|
2379
2190
|
});
|
|
2380
2191
|
}));
|
|
2381
2192
|
});
|
|
2382
|
-
},
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
}),
|
|
2386
|
-
|
|
2193
|
+
}, o = () => {
|
|
2194
|
+
n || (n = !0, Y = void 0, removeEventListener("message", a), i?.(), t.guard("transport.http_error", "The transport service could not close its port.", () => {
|
|
2195
|
+
r?.postMessage(_e);
|
|
2196
|
+
}), t.guard("transport.http_error", "The transport port could not close.", () => {
|
|
2197
|
+
r?.close();
|
|
2387
2198
|
}));
|
|
2388
2199
|
};
|
|
2389
|
-
return addEventListener("message",
|
|
2200
|
+
return addEventListener("message", a), Y = o, o;
|
|
2390
2201
|
}
|
|
2391
2202
|
// src/transport/memory-transport.ts
|
|
2392
|
-
function
|
|
2203
|
+
function Hn() {
|
|
2393
2204
|
let e = [], t = [], n = { status: 200 };
|
|
2394
2205
|
return {
|
|
2395
2206
|
transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
|
|
@@ -2411,19 +2222,16 @@ var X = /* @__PURE__ */ new Map();
|
|
|
2411
2222
|
function Z() {
|
|
2412
2223
|
return (q.current() ?? q.stopped()) || q.configure({}, !0);
|
|
2413
2224
|
}
|
|
2414
|
-
function
|
|
2415
|
-
return ["context", "namespace"].includes(e) ? Z().clearPersisted(e) : Promise.reject(/* @__PURE__ */ Error("Invalid persistence scope."));
|
|
2416
|
-
}
|
|
2417
|
-
function Hr(e) {
|
|
2225
|
+
function Un(e) {
|
|
2418
2226
|
q.configure(e), Q();
|
|
2419
2227
|
}
|
|
2420
|
-
function
|
|
2228
|
+
function Wn(e) {
|
|
2421
2229
|
Z().setConfigurationLocked(e);
|
|
2422
2230
|
}
|
|
2423
|
-
function
|
|
2231
|
+
function Gn(e, t) {
|
|
2424
2232
|
return Z().rotateSecurityContext(e, t);
|
|
2425
2233
|
}
|
|
2426
|
-
async function
|
|
2234
|
+
async function Kn() {
|
|
2427
2235
|
let e = Z();
|
|
2428
2236
|
return Q(), {
|
|
2429
2237
|
...await e.health(),
|
|
@@ -2433,8 +2241,8 @@ async function Gr() {
|
|
|
2433
2241
|
}
|
|
2434
2242
|
};
|
|
2435
2243
|
}
|
|
2436
|
-
async function
|
|
2437
|
-
let e = await
|
|
2244
|
+
async function qn() {
|
|
2245
|
+
let e = await Kn();
|
|
2438
2246
|
return Z().debugBundle(e);
|
|
2439
2247
|
}
|
|
2440
2248
|
function Q() {
|
|
@@ -2445,118 +2253,125 @@ function Q() {
|
|
|
2445
2253
|
}
|
|
2446
2254
|
return t;
|
|
2447
2255
|
}
|
|
2448
|
-
function
|
|
2256
|
+
function Jn(e, t) {
|
|
2449
2257
|
let n = Q();
|
|
2450
|
-
if (t || n === 0) return new
|
|
2258
|
+
if (t || n === 0) return new B(Z, e, t);
|
|
2451
2259
|
let r = X.get(e);
|
|
2452
|
-
return r ??= new
|
|
2260
|
+
return r ??= new B(Z, e), X.delete(e), X.set(e, r), Q(), r;
|
|
2453
2261
|
}
|
|
2454
2262
|
function $() {
|
|
2455
|
-
return
|
|
2263
|
+
return Jn("app");
|
|
2456
2264
|
}
|
|
2457
|
-
function
|
|
2265
|
+
function Yn(e, t) {
|
|
2458
2266
|
$().trace(e, t);
|
|
2459
2267
|
}
|
|
2460
|
-
function
|
|
2268
|
+
function Xn(e, t) {
|
|
2461
2269
|
$().debug(e, t);
|
|
2462
2270
|
}
|
|
2463
|
-
function
|
|
2271
|
+
function Zn(e, t) {
|
|
2464
2272
|
$().info(e, t);
|
|
2465
2273
|
}
|
|
2466
|
-
function
|
|
2274
|
+
function Qn(e, t) {
|
|
2467
2275
|
$().warn(e, t);
|
|
2468
2276
|
}
|
|
2469
|
-
function
|
|
2277
|
+
function $n(e, t, n) {
|
|
2470
2278
|
$().error(e, t, n);
|
|
2471
2279
|
}
|
|
2472
|
-
function
|
|
2280
|
+
function er(e, t, n) {
|
|
2473
2281
|
$().fatal(e, t, n);
|
|
2474
2282
|
}
|
|
2475
|
-
function
|
|
2283
|
+
function tr(e, t) {
|
|
2476
2284
|
$().logAction(e, t);
|
|
2477
2285
|
}
|
|
2478
|
-
function
|
|
2286
|
+
function nr(e, t) {
|
|
2479
2287
|
$().logEvent(e, t);
|
|
2480
2288
|
}
|
|
2481
|
-
function
|
|
2482
|
-
|
|
2289
|
+
function rr(e) {
|
|
2290
|
+
q.current()?.diagnostics.report("config.invalid", Ae, void 0, e);
|
|
2483
2291
|
}
|
|
2484
|
-
function
|
|
2485
|
-
return
|
|
2292
|
+
function ir(e, t = {}) {
|
|
2293
|
+
return Vt(e, t, (e, t, n) => {
|
|
2486
2294
|
Z().recordMetric(e, t, n);
|
|
2487
|
-
});
|
|
2295
|
+
}, rr);
|
|
2488
2296
|
}
|
|
2489
|
-
function
|
|
2490
|
-
return
|
|
2297
|
+
function ar(e, t = {}) {
|
|
2298
|
+
return Ht(e, t, (e, t, n) => {
|
|
2491
2299
|
Z().recordMetric(e, t, n);
|
|
2492
|
-
});
|
|
2300
|
+
}, rr);
|
|
2493
2301
|
}
|
|
2494
|
-
function
|
|
2302
|
+
function or(e, t = {}) {
|
|
2303
|
+
return Ut(e, t, (e, t, n) => {
|
|
2304
|
+
Z().recordMetric(e, t, n);
|
|
2305
|
+
}, rr);
|
|
2306
|
+
}
|
|
2307
|
+
function sr(e, t) {
|
|
2495
2308
|
return Z().startMeasure(e, t);
|
|
2496
2309
|
}
|
|
2497
|
-
function
|
|
2498
|
-
|
|
2310
|
+
function cr(e, t, n) {
|
|
2311
|
+
let r = Z();
|
|
2312
|
+
return Mt(r.startMeasure(e, n), t, r.diagnostics);
|
|
2499
2313
|
}
|
|
2500
|
-
function
|
|
2501
|
-
|
|
2314
|
+
function lr() {
|
|
2315
|
+
Z().setReplay(!0);
|
|
2502
2316
|
}
|
|
2503
|
-
function
|
|
2504
|
-
Z().
|
|
2317
|
+
function ur() {
|
|
2318
|
+
Z().setReplay(!1);
|
|
2505
2319
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2320
|
+
var dr = {
|
|
2321
|
+
probe: (e, t) => j().probe(e, t, q.current()?.diagnostics),
|
|
2322
|
+
time: (e, t) => j().time(e, t, q.current()?.diagnostics)
|
|
2323
|
+
};
|
|
2324
|
+
function fr(e, t) {
|
|
2325
|
+
Z().addBreadcrumb(e, t);
|
|
2508
2326
|
}
|
|
2509
|
-
function
|
|
2510
|
-
Z()
|
|
2327
|
+
function pr(e) {
|
|
2328
|
+
let t = Z();
|
|
2329
|
+
D(e) ? t.diagnostics.guard("record.sanitize_failed", "The library could not read the values of setContext().", () => {
|
|
2330
|
+
t.context.merge(e);
|
|
2331
|
+
}) : t.diagnostics.report("config.invalid", "setContext() takes an object. The library keeps the current context.");
|
|
2511
2332
|
}
|
|
2512
|
-
function
|
|
2333
|
+
function mr(e) {
|
|
2513
2334
|
Z().context.remove(e);
|
|
2514
2335
|
}
|
|
2515
|
-
function
|
|
2336
|
+
function hr(e, t) {
|
|
2516
2337
|
return Z().journey.start(e, t);
|
|
2517
2338
|
}
|
|
2518
|
-
function
|
|
2339
|
+
function gr() {
|
|
2519
2340
|
Z().journey.end();
|
|
2520
2341
|
}
|
|
2521
|
-
function
|
|
2342
|
+
function _r() {
|
|
2522
2343
|
return Z().journey.current();
|
|
2523
2344
|
}
|
|
2524
|
-
function
|
|
2345
|
+
function vr() {
|
|
2525
2346
|
return Z().journey.getToken();
|
|
2526
2347
|
}
|
|
2527
|
-
function
|
|
2348
|
+
function yr(e) {
|
|
2528
2349
|
return Z().journey.adopt(e, "manual", !0);
|
|
2529
2350
|
}
|
|
2530
|
-
function
|
|
2351
|
+
function br(e, t) {
|
|
2531
2352
|
return Z().registerWorker(e, t);
|
|
2532
2353
|
}
|
|
2533
|
-
function
|
|
2354
|
+
function xr(e, t) {
|
|
2534
2355
|
return Z().registerFrame(e, t);
|
|
2535
2356
|
}
|
|
2536
|
-
function
|
|
2357
|
+
function Sr() {
|
|
2537
2358
|
Z().tracing.rotate("explicit");
|
|
2538
2359
|
}
|
|
2539
|
-
function
|
|
2360
|
+
function Cr() {
|
|
2540
2361
|
return Z().tracing.headers();
|
|
2541
2362
|
}
|
|
2542
|
-
function
|
|
2543
|
-
return Z().flush();
|
|
2544
|
-
}
|
|
2545
|
-
function Si() {
|
|
2546
|
-
return Z().queueDepth();
|
|
2547
|
-
}
|
|
2548
|
-
function Ci() {
|
|
2549
|
-
return Z().stats();
|
|
2363
|
+
function wr(e) {
|
|
2364
|
+
return Z().flush(e);
|
|
2550
2365
|
}
|
|
2551
|
-
function
|
|
2366
|
+
function Tr() {
|
|
2552
2367
|
Z().newSession();
|
|
2553
2368
|
}
|
|
2554
|
-
function
|
|
2369
|
+
function Er() {
|
|
2555
2370
|
return Z().diagnostics.snapshot();
|
|
2556
2371
|
}
|
|
2557
|
-
async function
|
|
2558
|
-
await q.current()?.destroy();
|
|
2372
|
+
async function Dr(e) {
|
|
2373
|
+
await (q.current() ?? q.stopped())?.destroy(e);
|
|
2559
2374
|
}
|
|
2560
|
-
export {
|
|
2375
|
+
export { fr as addBreadcrumb, yr as adoptJourney, qn as collectDebugBundle, Un as configure, ir as counter, Hn as createMemoryTransport, _r as currentJourney, Xn as debug, gr as endJourney, $n as error, er as fatal, wr as flush, ar as gauge, Er as getDiagnosticCounters, Kn as getHealth, vr as getJourneyToken, Jn as getLogger, Cr as getTraceHeaders, or as histogram, Zn as info, tr as logAction, nr as logEvent, cr as measure, Tr as newSession, Sr as newTrace, dr as profiler, xr as registerFrame, br as registerWorker, mr as removeContext, Gn as rotateSecurityContext, Vn as serveTransportWorker, Wn as setConfigurationLocked, pr as setContext, Dr as shutdown, hr as startJourney, sr as startMeasure, lr as startReplay, ur as stopReplay, Yn as trace, Qn as warn };
|
|
2561
2376
|
|
|
2562
2377
|
//# sourceMappingURL=index.js.map
|