@utk09/ui-observability 0.11.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +481 -0
- package/README.md +73 -669
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
- package/dist/batch-CXmPmTse.js.map +1 -0
- package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
- package/dist/batch-mmPigCpi.cjs.map +1 -0
- package/dist/bus/bus.d.cts +331 -0
- package/dist/bus/bus.d.ts +108 -57
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +22 -7
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +11 -2
- package/dist/bus-C39wspFV.js +775 -0
- package/dist/bus-C39wspFV.js.map +1 -0
- package/dist/bus-_EaOVPGq.cjs +2 -0
- package/dist/bus-_EaOVPGq.cjs.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +11 -11
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +7 -7
- package/dist/capture/interactions.d.cts +48 -0
- package/dist/capture/interactions.d.ts +15 -15
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +4 -4
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +7 -7
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +18 -18
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +45 -0
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +79 -0
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +3 -3
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +2 -2
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +7 -7
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +54 -41
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +9 -9
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +4 -4
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +14 -14
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +21 -8
- package/dist/compression-CvED_Jel.cjs +2 -0
- package/dist/compression-CvED_Jel.cjs.map +1 -0
- package/dist/compression-tVtXwVjX.js +11 -0
- package/dist/compression-tVtXwVjX.js.map +1 -0
- package/dist/config-DUs7uHHt.cjs +2 -0
- package/dist/config-DUs7uHHt.cjs.map +1 -0
- package/dist/config-SgQcCP1_.js +560 -0
- package/dist/config-SgQcCP1_.js.map +1 -0
- package/dist/console-BGgGnjSi.js +81 -0
- package/dist/console-BGgGnjSi.js.map +1 -0
- package/dist/console-CSZ5_Vx5.cjs +2 -0
- package/dist/console-CSZ5_Vx5.cjs.map +1 -0
- package/dist/constants-CUyd9cTZ.js +357 -0
- package/dist/constants-CUyd9cTZ.js.map +1 -0
- package/dist/constants-CqdJhTxH.cjs +2 -0
- package/dist/constants-CqdJhTxH.cjs.map +1 -0
- package/dist/constants.d.cts +751 -0
- package/dist/constants.d.ts +231 -116
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +21 -15
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +33 -5
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +8 -13
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +13 -13
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +6 -6
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +4 -4
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +25 -22
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +22 -12
- package/dist/core/hold-buffer.d.cts +36 -0
- package/dist/core/hold-buffer.d.ts +16 -7
- package/dist/core/journey.d.cts +148 -0
- package/dist/core/journey.d.ts +28 -29
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +45 -51
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +21 -10
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +38 -28
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +114 -50
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +67 -35
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +7 -7
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +24 -23
- package/dist/core/rotation.d.cts +75 -0
- package/dist/core/rotation.d.ts +75 -0
- package/dist/core/runtime.d.cts +765 -0
- package/dist/core/runtime.d.ts +430 -186
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +22 -22
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +80 -34
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +6 -6
- package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
- package/dist/deadline-C4ccAuk5.js.map +1 -0
- package/dist/deadline-CUGbto-y.cjs +2 -0
- package/dist/deadline-CUGbto-y.cjs.map +1 -0
- package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
- package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
- package/dist/debug-bundle-CRpYV_ui.js +35 -0
- package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +19 -6
- package/dist/doctor.js +180 -53
- package/dist/doctor.js.map +1 -1
- package/dist/error-like-B11pB4aL.js.map +1 -1
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/errors-BE_EZV7Q.js +86 -0
- package/dist/errors-BE_EZV7Q.js.map +1 -0
- package/dist/errors-CNPbesMs.cjs +3 -0
- package/dist/errors-CNPbesMs.cjs.map +1 -0
- package/dist/factory-CTi0Is3F.js +404 -0
- package/dist/factory-CTi0Is3F.js.map +1 -0
- package/dist/factory-hRrH32v5.cjs +2 -0
- package/dist/factory-hRrH32v5.cjs.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/global-scope-D9I8s-oN.js.map +1 -1
- package/dist/guards-BlYGRK4l.js +10 -0
- package/dist/guards-BlYGRK4l.js.map +1 -0
- package/dist/guards-EjG3ahFp.cjs +2 -0
- package/dist/guards-EjG3ahFp.cjs.map +1 -0
- package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
- package/dist/identity-DdhKgrpk.js.map +1 -0
- package/dist/identity-DlWRIuwy.cjs +2 -0
- package/dist/identity-DlWRIuwy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -0
- package/dist/index.d.ts +165 -141
- package/dist/index.js +1283 -1468
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
- package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
- package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
- package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
- package/dist/interactions-CUkzK8sR.cjs +2 -0
- package/dist/interactions-CUkzK8sR.cjs.map +1 -0
- package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
- package/dist/interactions-DiFvCosX.js.map +1 -0
- package/dist/journey-B4Adltjm.cjs +2 -0
- package/dist/journey-B4Adltjm.cjs.map +1 -0
- package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
- package/dist/journey-D2_sia57.js.map +1 -0
- package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
- package/dist/library-console-Btrzt814.js.map +1 -0
- package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
- package/dist/library-console-CPW6bvZH.cjs.map +1 -0
- package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
- package/dist/library-request-BJ9PLRaD.js.map +1 -0
- package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
- package/dist/library-request-D7OvTxZV.cjs.map +1 -0
- package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
- package/dist/lifecycle-22CUCrc9.js.map +1 -0
- package/dist/lifecycle-IaAm1mOC.cjs +2 -0
- package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
- package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
- package/dist/log-record-BNiLfqtL.js.map +1 -0
- package/dist/log-record-CkivuiEl.cjs +2 -0
- package/dist/log-record-CkivuiEl.cjs.map +1 -0
- package/dist/long-frames-BUUbXd-B.cjs +2 -0
- package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
- package/dist/long-frames-DNFaRnC3.js +62 -0
- package/dist/long-frames-DNFaRnC3.js.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +16 -17
- package/dist/models/bus.d.cts +158 -0
- package/dist/models/bus.d.ts +46 -26
- package/dist/models/config.d.cts +1540 -0
- package/dist/models/config.d.ts +692 -405
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +29 -14
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +119 -23
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +94 -18
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +16 -16
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.cts +23 -0
- package/dist/models/serializer.d.ts +3 -4
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +17 -14
- package/dist/network-CGMLQ-mA.cjs +2 -0
- package/dist/network-CGMLQ-mA.cjs.map +1 -0
- package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
- package/dist/network-on2zZT6H.js.map +1 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-BENHf3g9.cjs +2 -0
- package/dist/otlp-BENHf3g9.cjs.map +1 -0
- package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
- package/dist/otlp-DimfrRor.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/patch-UdPz1ea8.js.map +1 -1
- package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
- package/dist/platform-BaaFIPCU.js.map +1 -0
- package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
- package/dist/platform-CfA3-7sJ.cjs.map +1 -0
- package/dist/profiler-BAZoh7A4.js +292 -0
- package/dist/profiler-BAZoh7A4.js.map +1 -0
- package/dist/profiler-D4tJpDRc.cjs +2 -0
- package/dist/profiler-D4tJpDRc.cjs.map +1 -0
- package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
- package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
- package/dist/profiler-frames-cJMx9wNM.js +78 -0
- package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
- package/dist/remote-rules-Dz9MRAsB.js +95 -0
- package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
- package/dist/remote-rules-_tY0zj5o.cjs +2 -0
- package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
- package/dist/replay-B3gFXIZd.cjs +2 -0
- package/dist/replay-B3gFXIZd.cjs.map +1 -0
- package/dist/replay-Ds-ANH34.js +310 -0
- package/dist/replay-Ds-ANH34.js.map +1 -0
- package/dist/reports-BDSe4dFH.cjs +2 -0
- package/dist/reports-BDSe4dFH.cjs.map +1 -0
- package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
- package/dist/reports-C-thq-bk.js.map +1 -0
- package/dist/resource-timing-C576gFIQ.cjs +2 -0
- package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
- package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
- package/dist/resource-timing-eUl2dNgC.js.map +1 -0
- package/dist/response-body-YdNl-HkR.cjs +3 -0
- package/dist/response-body-YdNl-HkR.cjs.map +1 -0
- package/dist/response-body-eoSQpLiH.js +331 -0
- package/dist/response-body-eoSQpLiH.js.map +1 -0
- package/dist/rotation-Cwct4ckk.js +94 -0
- package/dist/rotation-Cwct4ckk.js.map +1 -0
- package/dist/rotation-D4qUAHAu.cjs +2 -0
- package/dist/rotation-D4qUAHAu.cjs.map +1 -0
- package/dist/sampling-BlrI8jor.js +63 -0
- package/dist/sampling-BlrI8jor.js.map +1 -0
- package/dist/sampling-mXt4dstx.cjs +2 -0
- package/dist/sampling-mXt4dstx.cjs.map +1 -0
- package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
- package/dist/sanitize-Ba0KqU06.js.map +1 -0
- package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
- package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
- package/dist/sender-BdRuNVhF.cjs +2 -0
- package/dist/sender-BdRuNVhF.cjs.map +1 -0
- package/dist/sender-Dv8rAmpV.js +979 -0
- package/dist/sender-Dv8rAmpV.js.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +38 -37
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +13 -13
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +13 -13
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +11 -10
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +9 -9
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +32 -33
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +38 -31
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +9 -9
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +49 -42
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +25 -25
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +3 -3
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-B2EzVuYm.js +51 -0
- package/dist/stored-context-B2EzVuYm.js.map +1 -0
- package/dist/stored-context-CXt7eHZL.cjs +2 -0
- package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
- package/dist/storm-C-zYSdDX.cjs +2 -0
- package/dist/storm-C-zYSdDX.cjs.map +1 -0
- package/dist/storm-DjKetLKZ.js +9 -0
- package/dist/storm-DjKetLKZ.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/custom-transport.d.cts +22 -0
- package/dist/transport/custom-transport.d.ts +6 -5
- package/dist/transport/errors.d.cts +31 -0
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +62 -45
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +4 -4
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +48 -35
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +8 -8
- package/dist/transport/response-body.d.cts +49 -0
- package/dist/transport/response-body.d.ts +49 -0
- package/dist/transport/retry-engine.d.cts +129 -0
- package/dist/transport/retry-engine.d.ts +62 -43
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +2 -2
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +2 -2
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +18 -18
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +11 -11
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +45 -28
- package/dist/transport/worker-client.d.cts +23 -0
- package/dist/transport/worker-client.d.ts +12 -3
- package/dist/transport/worker-entry.d.cts +5 -0
- package/dist/transport/worker-entry.d.ts +1 -1
- package/dist/transport/worker-protocol.d.cts +38 -0
- package/dist/transport/worker-protocol.d.ts +7 -5
- package/dist/transport/worker-server.d.cts +3 -0
- package/dist/transport/worker-server.d.ts +1 -1
- package/dist/transport/worker-transport.d.cts +10 -0
- package/dist/transport/worker-transport.d.ts +5 -4
- package/dist/types-BAerHgCq.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
- package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
- package/dist/unclean-exit-py99ApzT.cjs +2 -0
- package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
- package/dist/unref-CU9Nyz_9.cjs +2 -0
- package/dist/unref-CU9Nyz_9.cjs.map +1 -0
- package/dist/unref-DgHPQeWv.js +7 -0
- package/dist/unref-DgHPQeWv.js.map +1 -0
- package/dist/{user-timing-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
- package/dist/user-timing-BePqb1uN.js.map +1 -0
- package/dist/user-timing-D6XTmpuM.cjs +2 -0
- package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +6 -6
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +10 -2
- package/dist/utils/identity.d.cts +109 -0
- package/dist/utils/identity.d.ts +20 -21
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +11 -10
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +15 -13
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +5 -5
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +49 -42
- package/dist/utils/unref.d.cts +9 -0
- package/dist/utils/unref.d.ts +3 -3
- package/dist/web-socket-CoIUBM3C.cjs +2 -0
- package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
- package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
- package/dist/web-socket-DSHgDiZ6.js.map +1 -0
- package/dist/web-vitals-4pWACwaR.js +71 -0
- package/dist/web-vitals-4pWACwaR.js.map +1 -0
- package/dist/web-vitals-__X7t4pj.cjs +2 -0
- package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
- package/dist/worker-protocol-QbvqNazn.cjs +2 -0
- package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
- package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
- package/dist/worker-protocol-x074Rpet.js.map +1 -0
- package/dist/worker-server-CFe4nvos.cjs +2 -0
- package/dist/worker-server-CFe4nvos.cjs.map +1 -0
- package/dist/worker-server-iUVSjH8L.js +94 -0
- package/dist/worker-server-iUVSjH8L.js.map +1 -0
- package/dist/worker-transport-CRAX-09c.cjs +2 -0
- package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
- package/dist/worker-transport-Dy1KMA7t.js +190 -0
- package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
- package/llms.txt +397 -0
- package/package.json +55 -41
- package/dist/batch-C8OcWR2L.cjs.map +0 -1
- package/dist/batch-CL9uWYY3.js.map +0 -1
- package/dist/bus-BZ0GldpT.js +0 -660
- package/dist/bus-BZ0GldpT.js.map +0 -1
- package/dist/bus-VWlmM5xs.cjs +0 -2
- package/dist/bus-VWlmM5xs.cjs.map +0 -1
- package/dist/console-BPZCuSLc.cjs +0 -2
- package/dist/console-BPZCuSLc.cjs.map +0 -1
- package/dist/console-BeCF7n59.js +0 -82
- package/dist/console-BeCF7n59.js.map +0 -1
- package/dist/constants-DqKJH_MP.cjs +0 -2
- package/dist/constants-DqKJH_MP.cjs.map +0 -1
- package/dist/constants-zyrqveN4.js +0 -304
- package/dist/constants-zyrqveN4.js.map +0 -1
- package/dist/context-storage-BjzeBSxH.cjs +0 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
- package/dist/context-storage-BzkoHzkQ.js +0 -51
- package/dist/context-storage-BzkoHzkQ.js.map +0 -1
- package/dist/deadline-BOjOxNHj.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
- package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
- package/dist/debug-bundle-C7UkHZ-q.js +0 -25
- package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
- package/dist/emergency-queue-CNTRui5t.cjs +0 -2
- package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
- package/dist/emergency-queue-Zy6lNafo.js +0 -67
- package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
- package/dist/errors-Dh7kef0i.js +0 -92
- package/dist/errors-Dh7kef0i.js.map +0 -1
- package/dist/errors-tfEr48bS.cjs +0 -3
- package/dist/errors-tfEr48bS.cjs.map +0 -1
- package/dist/factory-BonqI3NL.js +0 -276
- package/dist/factory-BonqI3NL.js.map +0 -1
- package/dist/factory-CJXVYp0R.cjs +0 -2
- package/dist/factory-CJXVYp0R.cjs.map +0 -1
- package/dist/guards-Cidk71ME.js +0 -7
- package/dist/guards-Cidk71ME.js.map +0 -1
- package/dist/guards-nJ70syPt.cjs +0 -2
- package/dist/guards-nJ70syPt.cjs.map +0 -1
- package/dist/identity-Cxgj6pZX.cjs +0 -2
- package/dist/identity-Cxgj6pZX.cjs.map +0 -1
- package/dist/identity-DT5VmvXy.js.map +0 -1
- package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
- package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
- package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
- package/dist/interactions-DTgKy_6K.js.map +0 -1
- package/dist/interactions-fEN6FbVo.cjs +0 -2
- package/dist/interactions-fEN6FbVo.cjs.map +0 -1
- package/dist/journey-CuJrHzEg.js.map +0 -1
- package/dist/journey-pffMVMfa.cjs +0 -2
- package/dist/journey-pffMVMfa.cjs.map +0 -1
- package/dist/keys-BHhw_0Wh.cjs +0 -2
- package/dist/keys-BHhw_0Wh.cjs.map +0 -1
- package/dist/keys-BU9j5YqW.js +0 -16
- package/dist/keys-BU9j5YqW.js.map +0 -1
- package/dist/library-console-C1m6g1BR.js.map +0 -1
- package/dist/library-console-D2GY9Or6.cjs.map +0 -1
- package/dist/library-request-1BX_UlaX.cjs.map +0 -1
- package/dist/library-request-BQBT9N9Q.js.map +0 -1
- package/dist/lifecycle-2EtUaRpo.cjs +0 -2
- package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
- package/dist/lifecycle-BaKx_-32.js.map +0 -1
- package/dist/log-record-CAoGBBf3.js.map +0 -1
- package/dist/log-record-i9zOTkpQ.cjs +0 -2
- package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
- package/dist/long-frames-BVg4i5SC.cjs +0 -2
- package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
- package/dist/long-frames-Czk7IupC.js +0 -64
- package/dist/long-frames-Czk7IupC.js.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-DBNwApoF.js.map +0 -1
- package/dist/network-xbbuvG_6.cjs +0 -2
- package/dist/network-xbbuvG_6.cjs.map +0 -1
- package/dist/otlp-BDvFrLnc.cjs +0 -2
- package/dist/otlp-BDvFrLnc.cjs.map +0 -1
- package/dist/otlp-BTJdIa6F.js.map +0 -1
- package/dist/platform-C2Ez5kDc.cjs.map +0 -1
- package/dist/platform-DkcuXwe-.js.map +0 -1
- package/dist/remote-rules-Cfb4K-Nl.js +0 -98
- package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
- package/dist/remote-rules-vzvk7aKf.cjs +0 -2
- package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
- package/dist/reports-Dk2YhKIh.cjs +0 -2
- package/dist/reports-Dk2YhKIh.cjs.map +0 -1
- package/dist/reports-TA-zInnq.js.map +0 -1
- package/dist/resource-timing-BLv3EA2A.js.map +0 -1
- package/dist/resource-timing-Cysw1S1f.cjs +0 -2
- package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
- package/dist/sampling-C4VV-1MS.js +0 -60
- package/dist/sampling-C4VV-1MS.js.map +0 -1
- package/dist/sampling-Ckh2yW9k.cjs +0 -2
- package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
- package/dist/sanitize-6ymPlVvP.js.map +0 -1
- package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
- package/dist/select-ZF4by-lF.cjs +0 -3
- package/dist/select-ZF4by-lF.cjs.map +0 -1
- package/dist/select-xtQaenIi.js +0 -270
- package/dist/select-xtQaenIi.js.map +0 -1
- package/dist/sender-CiMHC9YG.js +0 -856
- package/dist/sender-CiMHC9YG.js.map +0 -1
- package/dist/sender-D5wBoXA8.cjs +0 -2
- package/dist/sender-D5wBoXA8.cjs.map +0 -1
- package/dist/storage-BA9RqRO-.cjs +0 -2
- package/dist/storage-BA9RqRO-.cjs.map +0 -1
- package/dist/storage-DZwed89z.js +0 -16
- package/dist/storage-DZwed89z.js.map +0 -1
- package/dist/storm-CYi9Swpx.cjs +0 -2
- package/dist/storm-CYi9Swpx.cjs.map +0 -1
- package/dist/storm-VR024_QN.js +0 -9
- package/dist/storm-VR024_QN.js.map +0 -1
- package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
- package/dist/unclean-exit-DFUN57wY.cjs +0 -2
- package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
- package/dist/user-timing-C9kfRq3J.cjs +0 -2
- package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
- package/dist/user-timing-_jZIhDKI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BWUoqBh8.cjs +0 -2
- package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
- package/dist/web-socket-CV7yIMnm.js.map +0 -1
- package/dist/web-vitals-Bq4WFHQo.js +0 -52
- package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
- package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
- package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
- package/dist/worker-protocol-Bai7GAIA.cjs +0 -2
- package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
- package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
- package/dist/worker-server-BrIYkfoa.cjs +0 -2
- package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
- package/dist/worker-server-Dp5HYm4b.js +0 -83
- package/dist/worker-server-Dp5HYm4b.js.map +0 -1
- package/dist/worker-transport-Bwej4N2e.cjs +0 -2
- package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
- package/dist/worker-transport-D6jtgpqN.js +0 -199
- package/dist/worker-transport-D6jtgpqN.js.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import type { OtelLoader } from "../models/config.cjs";
|
|
3
|
+
/** W3C trace context fields attached to log records and network headers. */
|
|
4
|
+
export interface TraceContext {
|
|
5
|
+
/** Hexadecimal 32-character W3C trace identifier. */
|
|
6
|
+
traceId: string;
|
|
7
|
+
/** Hexadecimal 16-character W3C span identifier. */
|
|
8
|
+
spanId: string;
|
|
9
|
+
/** Bitfield byte containing W3C trace flags. */
|
|
10
|
+
traceFlags: number;
|
|
11
|
+
}
|
|
12
|
+
/** Why the ambient trace context rotated. */
|
|
13
|
+
export type RotateReason = "start" | "interaction" | "navigation" | "explicit" | "maxAge";
|
|
14
|
+
/** An ambient trace that ended. Its root span covers it. */
|
|
15
|
+
export interface EndedTrace {
|
|
16
|
+
/** Trace ID. */
|
|
17
|
+
traceId: string;
|
|
18
|
+
/** Span ID of the root span. */
|
|
19
|
+
spanId: string;
|
|
20
|
+
/** Why the trace started. */
|
|
21
|
+
reason: RotateReason;
|
|
22
|
+
/** Start time in epoch milliseconds. */
|
|
23
|
+
startedAt: number;
|
|
24
|
+
/** End time in epoch milliseconds. */
|
|
25
|
+
endedAt: number;
|
|
26
|
+
}
|
|
27
|
+
/** The client span that a traceparent header names. */
|
|
28
|
+
export interface ClientSpan {
|
|
29
|
+
/** Trace ID. */
|
|
30
|
+
traceId: string;
|
|
31
|
+
/** Span ID of the client span. */
|
|
32
|
+
spanId: string;
|
|
33
|
+
/** Span ID of the trace's root span. */
|
|
34
|
+
parentSpanId: string;
|
|
35
|
+
}
|
|
36
|
+
/** One request's headers, and the client span they name. */
|
|
37
|
+
export interface RequestTrace {
|
|
38
|
+
/** Header map containing traceparent. */
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
/** The request's client span. Undefined when the library records no span for it. */
|
|
41
|
+
span?: ClientSpan;
|
|
42
|
+
}
|
|
43
|
+
/** The runtime's span decisions. */
|
|
44
|
+
export interface SpanHooks {
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether the library records spans.
|
|
47
|
+
* @returns True when there is a traces endpoint.
|
|
48
|
+
*/
|
|
49
|
+
enabled(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks whether sampling keeps a trace's spans.
|
|
52
|
+
* @param traceId Trace ID.
|
|
53
|
+
* @returns True if the library sends the trace's spans.
|
|
54
|
+
*/
|
|
55
|
+
keeps(traceId: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Receives an ambient trace that ended.
|
|
58
|
+
* @param ended The trace.
|
|
59
|
+
*/
|
|
60
|
+
onEnd(ended: EndedTrace): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generates a random 32-character hex string in the W3C trace ID format. Use it to start
|
|
64
|
+
* your own trace. The backend drops an id with the wrong width without reporting an error.
|
|
65
|
+
* @returns 32-character hexadecimal trace ID.
|
|
66
|
+
*/
|
|
67
|
+
export declare function newTraceId(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Generates a random 16-character hex string conforming to W3C span ID format.
|
|
70
|
+
* @returns 16-character hexadecimal span ID.
|
|
71
|
+
*/
|
|
72
|
+
export declare function newSpanId(): string;
|
|
73
|
+
/** Manages ambient distributed trace contexts and resolves active OpenTelemetry spans. */
|
|
74
|
+
export declare class TraceEngine {
|
|
75
|
+
private readonly diagnostics;
|
|
76
|
+
private maxAgeMs;
|
|
77
|
+
private load?;
|
|
78
|
+
private readonly spans?;
|
|
79
|
+
/**
|
|
80
|
+
* The active ambient trace context. This state lives on the instance, not the module,
|
|
81
|
+
* because two runtimes in one document must not share a trace id.
|
|
82
|
+
*/
|
|
83
|
+
private ambient;
|
|
84
|
+
/** The optional peer, once loaded. Undefined while it loads or when it is absent. */
|
|
85
|
+
private otel;
|
|
86
|
+
/**
|
|
87
|
+
* @param diagnostics Diagnostics reporter.
|
|
88
|
+
* @param maxAgeMs Maximum lifetime of an un-rotated ambient trace in milliseconds.
|
|
89
|
+
* @param load Loader for the OpenTelemetry API. If it isn't set, OTel is off.
|
|
90
|
+
* Do not import the peer by name, because the Vite dev server fails if the peer isn't
|
|
91
|
+
* installed.
|
|
92
|
+
* @param spans The runtime's span decisions. Without them, the library records no span.
|
|
93
|
+
*/
|
|
94
|
+
constructor(diagnostics: Diagnostics, maxAgeMs?: number, load?: OtelLoader | undefined, spans?: SpanHooks | undefined);
|
|
95
|
+
/**
|
|
96
|
+
* Sets the trace age and the OpenTelemetry loader from the app's startup call. A log call
|
|
97
|
+
* before configure() builds the engine before those settings exist.
|
|
98
|
+
* @param maxAgeMs Maximum lifetime of an un-rotated ambient trace in milliseconds.
|
|
99
|
+
* @param load Loader for the OpenTelemetry API. If it isn't set, OTel is off.
|
|
100
|
+
*/
|
|
101
|
+
setup(maxAgeMs: number, load: OtelLoader | undefined): void;
|
|
102
|
+
/**
|
|
103
|
+
* Loads the OpenTelemetry API. Until the load completes, records use the ambient trace.
|
|
104
|
+
* If there is no loader or the load fails, all records use the ambient trace.
|
|
105
|
+
* @returns A promise that resolves when the attempt settles.
|
|
106
|
+
*/
|
|
107
|
+
loadOtel(): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Resolves trace context, prioritizing active OpenTelemetry spans over the ambient trace.
|
|
110
|
+
* @returns Active TraceContext.
|
|
111
|
+
*/
|
|
112
|
+
resolve(): TraceContext;
|
|
113
|
+
/**
|
|
114
|
+
* Reads the ambient trace, rotating it first if it is too old.
|
|
115
|
+
* @returns The ambient TraceContext.
|
|
116
|
+
*/
|
|
117
|
+
private ambientContext;
|
|
118
|
+
/**
|
|
119
|
+
* Reads the host's active span, if the peer module loaded and a span is running.
|
|
120
|
+
* @returns The active span's trace context, or undefined.
|
|
121
|
+
*/
|
|
122
|
+
private activeSpanContext;
|
|
123
|
+
/**
|
|
124
|
+
* Rotates the ambient trace context to mark the start of a new logical operation, and ends
|
|
125
|
+
* the old trace's root span.
|
|
126
|
+
* @param reason The event that triggers the rotation.
|
|
127
|
+
* @returns The newly created TraceContext.
|
|
128
|
+
*/
|
|
129
|
+
rotate(reason: RotateReason): TraceContext;
|
|
130
|
+
/**
|
|
131
|
+
* Ends the ambient trace's root span, once. Later records can still use the trace. The exit
|
|
132
|
+
* flush calls this, because a closing document has no later rotation.
|
|
133
|
+
*/
|
|
134
|
+
end(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Ends a trace's root span, once.
|
|
137
|
+
* @param ambient The trace to end.
|
|
138
|
+
*/
|
|
139
|
+
private finish;
|
|
140
|
+
/**
|
|
141
|
+
* Generates W3C traceparent headers with the registered OpenTelemetry propagators. Falls
|
|
142
|
+
* back to the ambient trace when OpenTelemetry provides no traceparent.
|
|
143
|
+
* @returns Header map containing traceparent.
|
|
144
|
+
*/
|
|
145
|
+
headers(): Record<string, string>;
|
|
146
|
+
/**
|
|
147
|
+
* Generates the headers for one request from the network capture. With spans on, the
|
|
148
|
+
* traceparent names a new client span of the ambient trace.
|
|
149
|
+
* @returns The headers, and the client span that the library records.
|
|
150
|
+
*/
|
|
151
|
+
request(): RequestTrace;
|
|
152
|
+
/**
|
|
153
|
+
* Generates the trace headers.
|
|
154
|
+
* @param client True to name a new client span in the traceparent.
|
|
155
|
+
* @returns The headers, and the client span that the library records.
|
|
156
|
+
*/
|
|
157
|
+
private trace;
|
|
158
|
+
}
|
package/dist/utils/tracing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import type { OtelLoader } from "../models/config";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import type { OtelLoader } from "../models/config.js";
|
|
3
3
|
/** W3C trace context fields attached to log records and network headers. */
|
|
4
4
|
export interface TraceContext {
|
|
5
5
|
/** Hexadecimal 32-character W3C trace identifier. */
|
|
@@ -9,48 +9,48 @@ export interface TraceContext {
|
|
|
9
9
|
/** Bitfield byte containing W3C trace flags. */
|
|
10
10
|
traceFlags: number;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
12
|
+
/** Why the ambient trace context rotated. */
|
|
13
13
|
export type RotateReason = "start" | "interaction" | "navigation" | "explicit" | "maxAge";
|
|
14
|
-
/**
|
|
14
|
+
/** An ambient trace that ended. Its root span covers it. */
|
|
15
15
|
export interface EndedTrace {
|
|
16
16
|
/** Trace ID. */
|
|
17
17
|
traceId: string;
|
|
18
18
|
/** Span ID of the root span. */
|
|
19
19
|
spanId: string;
|
|
20
|
-
/**
|
|
20
|
+
/** Why the trace started. */
|
|
21
21
|
reason: RotateReason;
|
|
22
22
|
/** Start time in epoch milliseconds. */
|
|
23
23
|
startedAt: number;
|
|
24
24
|
/** End time in epoch milliseconds. */
|
|
25
25
|
endedAt: number;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/** The client span that a traceparent header names. */
|
|
28
28
|
export interface ClientSpan {
|
|
29
29
|
/** Trace ID. */
|
|
30
30
|
traceId: string;
|
|
31
31
|
/** Span ID of the client span. */
|
|
32
32
|
spanId: string;
|
|
33
|
-
/** Span ID of the root span
|
|
33
|
+
/** Span ID of the trace's root span. */
|
|
34
34
|
parentSpanId: string;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
36
|
+
/** One request's headers, and the client span they name. */
|
|
37
37
|
export interface RequestTrace {
|
|
38
38
|
/** Header map containing traceparent. */
|
|
39
39
|
headers: Record<string, string>;
|
|
40
|
-
/**
|
|
40
|
+
/** The request's client span. Undefined when the library records no span for it. */
|
|
41
41
|
span?: ClientSpan;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
43
|
+
/** The runtime's span decisions. */
|
|
44
44
|
export interface SpanHooks {
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @returns True
|
|
46
|
+
* Checks whether the library records spans.
|
|
47
|
+
* @returns True when there is a traces endpoint.
|
|
48
48
|
*/
|
|
49
49
|
enabled(): boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Checks whether sampling keeps a trace's spans.
|
|
52
52
|
* @param traceId Trace ID.
|
|
53
|
-
* @returns True if the library sends the spans
|
|
53
|
+
* @returns True if the library sends the trace's spans.
|
|
54
54
|
*/
|
|
55
55
|
keeps(traceId: string): boolean;
|
|
56
56
|
/**
|
|
@@ -60,9 +60,8 @@ export interface SpanHooks {
|
|
|
60
60
|
onEnd(ended: EndedTrace): void;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Generates a random 32-character hex string in the W3C trace ID format.
|
|
64
|
-
*
|
|
65
|
-
* and reports no error.
|
|
63
|
+
* Generates a random 32-character hex string in the W3C trace ID format. Use it to start
|
|
64
|
+
* your own trace. The backend drops an id with the wrong width without reporting an error.
|
|
66
65
|
* @returns 32-character hexadecimal trace ID.
|
|
67
66
|
*/
|
|
68
67
|
export declare function newTraceId(): string;
|
|
@@ -74,28 +73,36 @@ export declare function newSpanId(): string;
|
|
|
74
73
|
/** Manages ambient distributed trace contexts and resolves active OpenTelemetry spans. */
|
|
75
74
|
export declare class TraceEngine {
|
|
76
75
|
private readonly diagnostics;
|
|
77
|
-
private
|
|
78
|
-
private
|
|
76
|
+
private maxAgeMs;
|
|
77
|
+
private load?;
|
|
79
78
|
private readonly spans?;
|
|
80
79
|
/**
|
|
81
|
-
*
|
|
82
|
-
* runtimes in one document must not share a trace id.
|
|
80
|
+
* The active ambient trace context. This state lives on the instance, not the module,
|
|
81
|
+
* because two runtimes in one document must not share a trace id.
|
|
83
82
|
*/
|
|
84
83
|
private ambient;
|
|
85
|
-
/** The optional peer
|
|
84
|
+
/** The optional peer, once loaded. Undefined while it loads or when it is absent. */
|
|
86
85
|
private otel;
|
|
87
86
|
/**
|
|
88
87
|
* @param diagnostics Diagnostics reporter.
|
|
89
88
|
* @param maxAgeMs Maximum lifetime of an un-rotated ambient trace in milliseconds.
|
|
90
|
-
* @param load Loader for the OpenTelemetry API. If it
|
|
91
|
-
* Do not import the peer by name
|
|
92
|
-
*
|
|
89
|
+
* @param load Loader for the OpenTelemetry API. If it isn't set, OTel is off.
|
|
90
|
+
* Do not import the peer by name, because the Vite dev server fails if the peer isn't
|
|
91
|
+
* installed.
|
|
92
|
+
* @param spans The runtime's span decisions. Without them, the library records no span.
|
|
93
93
|
*/
|
|
94
94
|
constructor(diagnostics: Diagnostics, maxAgeMs?: number, load?: OtelLoader | undefined, spans?: SpanHooks | undefined);
|
|
95
|
+
/**
|
|
96
|
+
* Sets the trace age and the OpenTelemetry loader from the app's startup call. A log call
|
|
97
|
+
* before configure() builds the engine before those settings exist.
|
|
98
|
+
* @param maxAgeMs Maximum lifetime of an un-rotated ambient trace in milliseconds.
|
|
99
|
+
* @param load Loader for the OpenTelemetry API. If it isn't set, OTel is off.
|
|
100
|
+
*/
|
|
101
|
+
setup(maxAgeMs: number, load: OtelLoader | undefined): void;
|
|
95
102
|
/**
|
|
96
103
|
* Loads the OpenTelemetry API. Until the load completes, records use the ambient trace.
|
|
97
104
|
* If there is no loader or the load fails, all records use the ambient trace.
|
|
98
|
-
* @returns
|
|
105
|
+
* @returns A promise that resolves when the attempt settles.
|
|
99
106
|
*/
|
|
100
107
|
loadOtel(): Promise<void>;
|
|
101
108
|
/**
|
|
@@ -104,41 +111,41 @@ export declare class TraceEngine {
|
|
|
104
111
|
*/
|
|
105
112
|
resolve(): TraceContext;
|
|
106
113
|
/**
|
|
107
|
-
* Reads the ambient trace
|
|
108
|
-
* @returns
|
|
114
|
+
* Reads the ambient trace, rotating it first if it is too old.
|
|
115
|
+
* @returns The ambient TraceContext.
|
|
109
116
|
*/
|
|
110
117
|
private ambientContext;
|
|
111
118
|
/**
|
|
112
|
-
* Reads the active span
|
|
113
|
-
* @returns
|
|
119
|
+
* Reads the host's active span, if the peer module loaded and a span is running.
|
|
120
|
+
* @returns The active span's trace context, or undefined.
|
|
114
121
|
*/
|
|
115
122
|
private activeSpanContext;
|
|
116
123
|
/**
|
|
117
|
-
* Rotates the ambient trace context to mark the start of a new logical operation
|
|
118
|
-
*
|
|
119
|
-
* @param reason
|
|
120
|
-
* @returns
|
|
124
|
+
* Rotates the ambient trace context to mark the start of a new logical operation, and ends
|
|
125
|
+
* the old trace's root span.
|
|
126
|
+
* @param reason The event that triggers the rotation.
|
|
127
|
+
* @returns The newly created TraceContext.
|
|
121
128
|
*/
|
|
122
129
|
rotate(reason: RotateReason): TraceContext;
|
|
123
130
|
/**
|
|
124
|
-
* Ends the
|
|
125
|
-
*
|
|
131
|
+
* Ends the ambient trace's root span, once. Later records can still use the trace. The exit
|
|
132
|
+
* flush calls this, because a closing document has no later rotation.
|
|
126
133
|
*/
|
|
127
134
|
end(): void;
|
|
128
135
|
/**
|
|
129
|
-
* Ends
|
|
130
|
-
* @param ambient
|
|
136
|
+
* Ends a trace's root span, once.
|
|
137
|
+
* @param ambient The trace to end.
|
|
131
138
|
*/
|
|
132
139
|
private finish;
|
|
133
140
|
/**
|
|
134
|
-
* Generates W3C traceparent headers with the registered OpenTelemetry propagators.
|
|
135
|
-
*
|
|
141
|
+
* Generates W3C traceparent headers with the registered OpenTelemetry propagators. Falls
|
|
142
|
+
* back to the ambient trace when OpenTelemetry provides no traceparent.
|
|
136
143
|
* @returns Header map containing traceparent.
|
|
137
144
|
*/
|
|
138
145
|
headers(): Record<string, string>;
|
|
139
146
|
/**
|
|
140
|
-
* Generates the headers
|
|
141
|
-
* names a new client span of the ambient trace.
|
|
147
|
+
* Generates the headers for one request from the network capture. With spans on, the
|
|
148
|
+
* traceparent names a new client span of the ambient trace.
|
|
142
149
|
* @returns The headers, and the client span that the library records.
|
|
143
150
|
*/
|
|
144
151
|
request(): RequestTrace;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A timer handle. A number in a browser, a Timeout object in Node. */
|
|
2
|
+
export type TimerHandle = number | {
|
|
3
|
+
unref?: () => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Unreferences a timer handle, so a pending timer doesn't keep a Node.js process alive.
|
|
7
|
+
* @param timer The timer handle returned by setTimeout.
|
|
8
|
+
*/
|
|
9
|
+
export declare function unrefTimer(timer: TimerHandle): void;
|
package/dist/utils/unref.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A timer handle. A number in a browser, a Timeout object in Node. */
|
|
2
2
|
export type TimerHandle = number | {
|
|
3
3
|
unref?: () => void;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
* Unreferences a timer handle
|
|
7
|
-
* @param timer
|
|
6
|
+
* Unreferences a timer handle, so a pending timer doesn't keep a Node.js process alive.
|
|
7
|
+
* @param timer The timer handle returned by setTimeout.
|
|
8
8
|
*/
|
|
9
9
|
export declare function unrefTimer(timer: TimerHandle): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./library-request-D7OvTxZV.cjs"),t=require("./platform-CfA3-7sJ.cjs"),n=require("./patch-BX8KrPCT.cjs"),r=require("./storm-C-zYSdDX.cjs"),i=require("./types-C7WNpnG1.cjs"),a=require("./defineProperty-X1c4tIPD.cjs");var o=`ui.websocket.messages`;function s(e,n,r){let i=new URL(e);return{target:t.i(e,!1,n.capture.urlTransform,r),server:i.hostname}}function c(t,n,r){let i=t.servers.get(n),a=r===`transmit`&&e.t();if(!t.active||i===void 0||a||t.config.securityContext.isolation&&t.contexts.get(n)!==t.config.securityContext.id)return;let o={"network.io.direction":r,"server.address":i};t.messages.add(1,o)}var l=class{constructor(e,t){a.t(this,`diagnostics`,void 0),a.t(this,`config`,void 0),a.t(this,`name`,`websocket`),a.t(this,`restore`,void 0),a.t(this,`state`,void 0),a.t(this,`window`,{start:0,count:0}),this.diagnostics=e,this.config=t}install(e){if(this.restore||typeof WebSocket>`u`)return;let t={active:!0,ctx:e,messages:e.counter(o),servers:new WeakMap,contexts:new WeakMap,config:this.config};this.state=t;let r=e=>{this.track(e,t)};this.restore=n.t(globalThis,`WebSocket`,e=>class extends e{static[Symbol.hasInstance](t){return t instanceof e}constructor(e,t){super(e,t),r(this)}send(e){super.send(e),c(t,this,`transmit`)}})}uninstall(){this.state&&(this.state.active=!1),this.restore&&!this.restore()&&this.diagnostics.report(`capture.install_failed`,`Another script wrapped WebSocket after the library. The library keeps that wrapper.`),this.restore=void 0,this.state=void 0}track(e,t){t.active&&this.diagnostics.guard(`capture.record_failed`,`The library could not track a WebSocket. The socket works without capture.`,()=>{if(i.t(e.url,this.config.capture.ignoreUrls))return;let{target:n,server:r}=s(e.url,this.config,this.diagnostics),a={"url.full":n,"server.address":r},{logger:o}=t.ctx;t.servers.set(e,r),t.contexts.set(e,this.config.securityContext.id);let l=n=>{(!this.config.securityContext.isolation||t.contexts.get(e)===this.config.securityContext.id)&&this.allow(t)&&n()};e.addEventListener(`open`,()=>{l(()=>{o.logEvent(`websocket.open`,a)})}),e.addEventListener(`error`,()=>{l(()=>{o.warn(`websocket.error`,a)})}),e.addEventListener(`close`,e=>{l(()=>{o.logEvent(`websocket.close`,{...a,"websocket.close.code":e.code,"websocket.close.clean":e.wasClean})})}),e.addEventListener(`message`,()=>{c(t,e,`receive`)})})}allow(e){return e.active&&r.t(this.window,this.config.captureLimits.webSocketPerWindow,this.diagnostics,`WebSocket events`,this.config.captureLimits.windowMs)}};exports.WebSocketCapture=l;
|
|
2
|
+
//# sourceMappingURL=web-socket-CoIUBM3C.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-socket-CoIUBM3C.cjs","names":["recordedUrl","isLibraryRequest","patch","matchesAny","allowInWindow","require_library_request","require_platform","require_patch","require_storm","require_types","require_defineProperty","MESSAGES_METRIC","socketTarget","parsed","url","config","diagnostics","count","server","state","socket","own","direction","attributes","WebSocketCapture","ctx","track","Original","value","protocols","data","target","lifecycle","write","logger","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of every WebSocket, and counts messages by direction\n// and server. It never reads message content. This is a capture plugin, so the runtime loads it\n// as a separate chunk.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** The data argument of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper left behind after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** The plugin's tools. */\n ctx: PluginContext;\n /** Message counter. */\n messages: Counter;\n /** Server host name of every tracked socket. */\n servers: WeakMap<WebSocket, string>;\n /** The delivery context that was current when each socket opened. */\n contexts: WeakMap<WebSocket, string>;\n /** Active capture settings and isolation rule. */\n config: ResolvedConfig;\n}\n\n/**\n * Strips the user info, query and fragment from a socket URL, since any of them can hold a token.\n * @param url The socket's absolute URL.\n * @param config Active capture settings.\n * @param diagnostics Diagnostics reporter, for a URL transform that throws.\n * @returns The URL to record and the server's host name.\n */\nfunction socketTarget(\n url: string,\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n // Ignore fullUrls. A browser can't set a header on a socket, so apps often put a token in\n // the query. Only urlTransform can record more of the URL.\n target: recordedUrl(url, false, config.capture.urlTransform, diagnostics),\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message on a tracked socket.\n * @param state State of the install that created the socket.\n * @param socket The socket the message belongs to.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // Don't count the library's own sends, for example a custom transport's, or one send would\n // cause the next.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (\n !state.active ||\n server === undefined ||\n own ||\n (state.config.securityContext.isolation &&\n state.contexts.get(socket) !== state.config.securityContext.id)\n ) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and message counts of every WebSocket the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined while the capture isn't installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit for the lifecycle records, so a reconnect loop can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks every socket.\n * @param ctx The plugin's tools.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n contexts: new WeakMap(),\n config: this.config,\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket the app opened before the install.\n * @param value Value to test.\n * @returns True for every native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url The server's URL.\n * @param protocols The app's sub-protocols.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data The app's data. We never read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops every tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script may have wrapped the constructor after us. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record one socket's lifecycle and received messages.\n * @param socket The app's new socket.\n * @param state State of the install that created the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // This read runs inside the app's constructor call, so a throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport may send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url, this.config, this.diagnostics);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n state.contexts.set(socket, this.config.securityContext.id);\n\n const lifecycle = (write: () => void): void => {\n if (\n (!this.config.securityContext.isolation ||\n state.contexts.get(socket) === this.config.securityContext.id) &&\n this.allow(state)\n ) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Checks whether a lifecycle record can go out.\n * @param state State of the install that created the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(\n this.window,\n this.config.captureLimits.webSocketPerWindow,\n this.diagnostics,\n \"WebSocket events\",\n this.config.captureLimits.windowMs,\n )\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { t as e } from "./library-request-
|
|
2
|
-
import { i as t } from "./platform-
|
|
1
|
+
import { t as e } from "./library-request-BJ9PLRaD.js";
|
|
2
|
+
import { i as t } from "./platform-BaaFIPCU.js";
|
|
3
3
|
import { t as n } from "./patch-UdPz1ea8.js";
|
|
4
|
-
import { t as r } from "./storm-
|
|
4
|
+
import { t as r } from "./storm-DjKetLKZ.js";
|
|
5
5
|
import { t as i } from "./types-BAerHgCq.js";
|
|
6
|
+
import { t as a } from "./defineProperty-s2S8BXUc.js";
|
|
6
7
|
// src/capture/web-socket.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var o = "ui.websocket.messages";
|
|
9
|
+
function s(e, n, r) {
|
|
9
10
|
let i = new URL(e);
|
|
10
11
|
return {
|
|
11
12
|
target: t(e, !1, n.capture.urlTransform, r),
|
|
12
13
|
server: i.hostname
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function c(t, n, r) {
|
|
16
17
|
let i = t.servers.get(n), a = r === "transmit" && e();
|
|
17
18
|
if (!t.active || i === void 0 || a || t.config.securityContext.isolation && t.contexts.get(n) !== t.config.securityContext.id) return;
|
|
18
19
|
let o = {
|
|
@@ -21,25 +22,19 @@ function s(t, n, r) {
|
|
|
21
22
|
};
|
|
22
23
|
t.messages.add(1, o);
|
|
23
24
|
}
|
|
24
|
-
var
|
|
25
|
-
diagnostics;
|
|
26
|
-
config;
|
|
27
|
-
name = "websocket";
|
|
28
|
-
restore;
|
|
29
|
-
state;
|
|
30
|
-
window = {
|
|
31
|
-
start: 0,
|
|
32
|
-
count: 0
|
|
33
|
-
};
|
|
25
|
+
var l = class {
|
|
34
26
|
constructor(e, t) {
|
|
35
|
-
this
|
|
27
|
+
a(this, "diagnostics", void 0), a(this, "config", void 0), a(this, "name", "websocket"), a(this, "restore", void 0), a(this, "state", void 0), a(this, "window", {
|
|
28
|
+
start: 0,
|
|
29
|
+
count: 0
|
|
30
|
+
}), this.diagnostics = e, this.config = t;
|
|
36
31
|
}
|
|
37
32
|
install(e) {
|
|
38
33
|
if (this.restore || typeof WebSocket > "u") return;
|
|
39
34
|
let t = {
|
|
40
35
|
active: !0,
|
|
41
36
|
ctx: e,
|
|
42
|
-
messages: e.counter(
|
|
37
|
+
messages: e.counter(o),
|
|
43
38
|
servers: /* @__PURE__ */ new WeakMap(),
|
|
44
39
|
contexts: /* @__PURE__ */ new WeakMap(),
|
|
45
40
|
config: this.config
|
|
@@ -56,7 +51,7 @@ var c = class {
|
|
|
56
51
|
super(e, t), r(this);
|
|
57
52
|
}
|
|
58
53
|
send(e) {
|
|
59
|
-
super.send(e),
|
|
54
|
+
super.send(e), c(t, this, "transmit");
|
|
60
55
|
}
|
|
61
56
|
});
|
|
62
57
|
}
|
|
@@ -66,39 +61,39 @@ var c = class {
|
|
|
66
61
|
track(e, t) {
|
|
67
62
|
t.active && this.diagnostics.guard("capture.record_failed", "The library could not track a WebSocket. The socket works without capture.", () => {
|
|
68
63
|
if (i(e.url, this.config.capture.ignoreUrls)) return;
|
|
69
|
-
let { target: n, server: r } =
|
|
64
|
+
let { target: n, server: r } = s(e.url, this.config, this.diagnostics), a = {
|
|
70
65
|
"url.full": n,
|
|
71
66
|
"server.address": r
|
|
72
|
-
}, { logger:
|
|
67
|
+
}, { logger: o } = t.ctx;
|
|
73
68
|
t.servers.set(e, r), t.contexts.set(e, this.config.securityContext.id);
|
|
74
69
|
let l = (n) => {
|
|
75
70
|
(!this.config.securityContext.isolation || t.contexts.get(e) === this.config.securityContext.id) && this.allow(t) && n();
|
|
76
71
|
};
|
|
77
72
|
e.addEventListener("open", () => {
|
|
78
73
|
l(() => {
|
|
79
|
-
|
|
74
|
+
o.logEvent("websocket.open", a);
|
|
80
75
|
});
|
|
81
76
|
}), e.addEventListener("error", () => {
|
|
82
77
|
l(() => {
|
|
83
|
-
|
|
78
|
+
o.warn("websocket.error", a);
|
|
84
79
|
});
|
|
85
80
|
}), e.addEventListener("close", (e) => {
|
|
86
81
|
l(() => {
|
|
87
|
-
|
|
82
|
+
o.logEvent("websocket.close", {
|
|
88
83
|
...a,
|
|
89
84
|
"websocket.close.code": e.code,
|
|
90
85
|
"websocket.close.clean": e.wasClean
|
|
91
86
|
});
|
|
92
87
|
});
|
|
93
88
|
}), e.addEventListener("message", () => {
|
|
94
|
-
|
|
89
|
+
c(t, e, "receive");
|
|
95
90
|
});
|
|
96
91
|
});
|
|
97
92
|
}
|
|
98
93
|
allow(e) {
|
|
99
|
-
return e.active && r(this.window, this.config.
|
|
94
|
+
return e.active && r(this.window, this.config.captureLimits.webSocketPerWindow, this.diagnostics, "WebSocket events", this.config.captureLimits.windowMs);
|
|
100
95
|
}
|
|
101
96
|
};
|
|
102
|
-
export {
|
|
97
|
+
export { l as WebSocketCapture };
|
|
103
98
|
|
|
104
|
-
//# sourceMappingURL=web-socket-
|
|
99
|
+
//# sourceMappingURL=web-socket-DSHgDiZ6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-socket-DSHgDiZ6.js","names":["isLibraryRequest","recordedUrl","patch","allowInWindow","matchesAny","_defineProperty","MESSAGES_METRIC","socketTarget","parsed","url","config","diagnostics","count","server","state","socket","own","direction","attributes","WebSocketCapture","ctx","track","Original","value","protocols","data","target","lifecycle","write","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of every WebSocket, and counts messages by direction\n// and server. It never reads message content. This is a capture plugin, so the runtime loads it\n// as a separate chunk.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** The data argument of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper left behind after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** The plugin's tools. */\n ctx: PluginContext;\n /** Message counter. */\n messages: Counter;\n /** Server host name of every tracked socket. */\n servers: WeakMap<WebSocket, string>;\n /** The delivery context that was current when each socket opened. */\n contexts: WeakMap<WebSocket, string>;\n /** Active capture settings and isolation rule. */\n config: ResolvedConfig;\n}\n\n/**\n * Strips the user info, query and fragment from a socket URL, since any of them can hold a token.\n * @param url The socket's absolute URL.\n * @param config Active capture settings.\n * @param diagnostics Diagnostics reporter, for a URL transform that throws.\n * @returns The URL to record and the server's host name.\n */\nfunction socketTarget(\n url: string,\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n // Ignore fullUrls. A browser can't set a header on a socket, so apps often put a token in\n // the query. Only urlTransform can record more of the URL.\n target: recordedUrl(url, false, config.capture.urlTransform, diagnostics),\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message on a tracked socket.\n * @param state State of the install that created the socket.\n * @param socket The socket the message belongs to.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // Don't count the library's own sends, for example a custom transport's, or one send would\n // cause the next.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (\n !state.active ||\n server === undefined ||\n own ||\n (state.config.securityContext.isolation &&\n state.contexts.get(socket) !== state.config.securityContext.id)\n ) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and message counts of every WebSocket the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined while the capture isn't installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit for the lifecycle records, so a reconnect loop can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks every socket.\n * @param ctx The plugin's tools.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n contexts: new WeakMap(),\n config: this.config,\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket the app opened before the install.\n * @param value Value to test.\n * @returns True for every native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url The server's URL.\n * @param protocols The app's sub-protocols.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data The app's data. We never read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops every tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script may have wrapped the constructor after us. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record one socket's lifecycle and received messages.\n * @param socket The app's new socket.\n * @param state State of the install that created the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // This read runs inside the app's constructor call, so a throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport may send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url, this.config, this.diagnostics);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n state.contexts.set(socket, this.config.securityContext.id);\n\n const lifecycle = (write: () => void): void => {\n if (\n (!this.config.securityContext.isolation ||\n state.contexts.get(socket) === this.config.securityContext.id) &&\n this.allow(state)\n ) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Checks whether a lifecycle record can go out.\n * @param state State of the install that created the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(\n this.window,\n this.config.captureLimits.webSocketPerWindow,\n this.diagnostics,\n \"WebSocket events\",\n this.config.captureLimits.windowMs,\n )\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t as e } from "./defineProperty-s2S8BXUc.js";
|
|
2
|
+
// src/capture/web-vitals.ts
|
|
3
|
+
var t = () => document.prerendering === !0, n = class {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
e(this, "ctx", void 0), e(this, "name", "web-vitals"), e(this, "installed", !1), e(this, "logged", /* @__PURE__ */ new Set()), this.ctx = t;
|
|
6
|
+
}
|
|
7
|
+
install() {
|
|
8
|
+
if (this.installed || (this.installed = !0, this.reportNavigationTiming(), this.ctx.once.webVitals)) return;
|
|
9
|
+
let { webVitals: e } = this.ctx.config.capture, t = typeof e == "object" ? e.loader : void 0;
|
|
10
|
+
t ? this.loadWebVitals(t) : this.ctx.diagnostics.report("config.invalid", "capture.webVitals needs capture.webVitals.loader. LCP, CLS and INP are off. Navigation timing continues.");
|
|
11
|
+
}
|
|
12
|
+
uninstall() {
|
|
13
|
+
this.installed = !1;
|
|
14
|
+
}
|
|
15
|
+
async loadWebVitals(e) {
|
|
16
|
+
let t = await this.ctx.diagnostics.guardAsync("capture.install_failed", "The library could not load web-vitals.", e);
|
|
17
|
+
if (!t) {
|
|
18
|
+
this.ctx.diagnostics.report("capture.install_failed", "The web-vitals module is not available. LCP, CLS and INP are off. Navigation timing continues.");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (this.ctx.once.webVitals) return;
|
|
22
|
+
this.ctx.once.webVitals = !0;
|
|
23
|
+
let n = (e, t) => (n) => {
|
|
24
|
+
this.ctx.logger.logMetric(`web_vitals.${e}`, Math.round(n.value * 1e3) / 1e3, t, "gauge", { "metric.rating": n.rating }, { "metric.id": n.id });
|
|
25
|
+
};
|
|
26
|
+
t.onLCP(n("lcp", "ms")), t.onCLS(n("cls", "1")), t.onINP(n("inp", "ms")), t.onFCP(n("fcp", "ms")), t.onTTFB(n("ttfb", "ms"));
|
|
27
|
+
}
|
|
28
|
+
reportNavigationTiming() {
|
|
29
|
+
this.ctx.once.navigationTiming || (this.ctx.once.navigationTiming = !0, this.guardNavigation(() => {
|
|
30
|
+
let e = performance.getEntriesByType("navigation")[0];
|
|
31
|
+
if (!e) return;
|
|
32
|
+
let n = () => {
|
|
33
|
+
this.guardNavigation(() => {
|
|
34
|
+
this.logNavigation(e);
|
|
35
|
+
});
|
|
36
|
+
}, r = () => {
|
|
37
|
+
t() ? document.addEventListener("prerenderingchange", n, { once: !0 }) : n();
|
|
38
|
+
};
|
|
39
|
+
if (e.loadEventEnd > 0) {
|
|
40
|
+
r();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let i = () => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
document.removeEventListener("visibilitychange", a), r();
|
|
46
|
+
}, 0);
|
|
47
|
+
}, a = () => {
|
|
48
|
+
document.visibilityState === "hidden" && !t() && n();
|
|
49
|
+
};
|
|
50
|
+
document.addEventListener("visibilitychange", a), document.readyState === "complete" ? i() : addEventListener("load", i, { once: !0 });
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
guardNavigation(e) {
|
|
54
|
+
this.ctx.diagnostics.guard("capture.install_failed", "The library could not read the navigation timing.", e);
|
|
55
|
+
}
|
|
56
|
+
logNavigation(e) {
|
|
57
|
+
let t = e.activationStart ?? 0, n = (e) => e > 0 ? Math.max(e - t, 0) : NaN, r = t > 0 ? "prerender" : e.type, i = {
|
|
58
|
+
"navigation.dns_ms": e.domainLookupEnd - e.domainLookupStart,
|
|
59
|
+
"navigation.tcp_ms": e.connectEnd - e.connectStart,
|
|
60
|
+
"navigation.ttfb_ms": e.responseStart - e.requestStart,
|
|
61
|
+
"navigation.response_ms": e.responseEnd - e.responseStart,
|
|
62
|
+
"navigation.dom_interactive_ms": n(e.domInteractive),
|
|
63
|
+
"navigation.dom_complete_ms": n(e.domComplete),
|
|
64
|
+
"navigation.load_ms": n(e.loadEventEnd)
|
|
65
|
+
};
|
|
66
|
+
for (let [e, t] of Object.entries(i)) Number.isFinite(t) && t >= 0 && !this.logged.has(e) && (this.logged.add(e), this.ctx.logger.logMetric(e, Math.round(t), "ms", "gauge", { "navigation.type": r }));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export { n as WebVitalsCapture };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=web-vitals-4pWACwaR.js.map
|