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