@utk09/ui-observability 0.10.0 → 0.12.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 +77 -1
- package/README.md +323 -113
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-BMdT9mKm.js → batch-BjQUwjA6.js} +5 -6
- package/dist/batch-BjQUwjA6.js.map +1 -0
- package/dist/{batch-BHXypM1j.cjs → batch-D5LlU4Q9.cjs} +2 -2
- package/dist/batch-D5LlU4Q9.cjs.map +1 -0
- package/dist/bus/bus.d.ts +48 -47
- package/dist/bus/links.d.ts +4 -4
- package/dist/bus/validation.d.ts +1 -1
- package/dist/bus-D_7pd7RN.cjs +2 -0
- package/dist/bus-D_7pd7RN.cjs.map +1 -0
- package/dist/{bus-DKfBaica.js → bus-ecxUNTja.js} +105 -109
- package/dist/bus-ecxUNTja.js.map +1 -0
- package/dist/capture/console.d.ts +10 -10
- package/dist/capture/errors.d.ts +6 -6
- package/dist/capture/interactions.d.ts +14 -14
- package/dist/capture/lifecycle.d.ts +3 -3
- package/dist/capture/long-frames.d.ts +6 -6
- package/dist/capture/network.d.ts +17 -17
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.ts +46 -0
- package/dist/capture/replay-upload.d.ts +74 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.ts +2 -2
- package/dist/capture/resource-timing.d.ts +1 -1
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.ts +3 -3
- package/dist/capture/types.d.ts +45 -33
- package/dist/capture/unclean-exit.d.ts +8 -8
- package/dist/capture/user-timing.d.ts +3 -3
- package/dist/capture/web-socket.d.ts +11 -11
- package/dist/capture/web-vitals.d.ts +20 -7
- package/dist/compression-AJJCMBOa.js +11 -0
- package/dist/compression-AJJCMBOa.js.map +1 -0
- package/dist/compression-lD9abCcO.cjs +2 -0
- package/dist/compression-lD9abCcO.cjs.map +1 -0
- package/dist/console-CLz_PvFn.cjs +2 -0
- package/dist/console-CLz_PvFn.cjs.map +1 -0
- package/dist/{console-BX_0UCV7.js → console-cwgHKXvM.js} +14 -15
- package/dist/console-cwgHKXvM.js.map +1 -0
- package/dist/constants-Bwl_YtQi.js +349 -0
- package/dist/constants-Bwl_YtQi.js.map +1 -0
- package/dist/constants-DakMxVB2.cjs +2 -0
- package/dist/constants-DakMxVB2.cjs.map +1 -0
- package/dist/constants.d.ts +150 -103
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
- package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
- package/dist/context-storage-BzkoHzkQ.js.map +1 -0
- package/dist/core/breadcrumbs.d.ts +16 -15
- package/dist/core/config.d.ts +3 -3
- package/dist/core/context.d.ts +7 -7
- package/dist/core/debug-buffer.d.ts +10 -10
- package/dist/core/debug-bundle.d.ts +3 -3
- package/dist/core/deferred.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +24 -21
- package/dist/core/drops.d.ts +7 -7
- package/dist/core/hold-buffer.d.ts +1 -1
- package/dist/core/journey.d.ts +22 -23
- package/dist/core/logger.d.ts +22 -21
- package/dist/core/measure.d.ts +7 -7
- package/dist/core/meter.d.ts +25 -21
- package/dist/core/pipeline.d.ts +42 -41
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.ts +23 -23
- package/dist/core/remote-rules.d.ts +4 -4
- package/dist/core/remote-sampling.d.ts +21 -20
- package/dist/core/runtime.d.ts +206 -137
- package/dist/core/sampling.d.ts +18 -18
- package/dist/core/sender.d.ts +22 -20
- package/dist/core/spans.d.ts +5 -5
- package/dist/{deadline-5_PecIl5.js → deadline-C4ccAuk5.js} +4 -9
- 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-CZZ6SQQh.js → debug-bundle-BOdYmCeV.js} +12 -6
- package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.ts +16 -6
- package/dist/doctor.js +148 -54
- package/dist/doctor.js.map +1 -1
- package/dist/{emergency-queue-Cs8-i2xw.js → emergency-queue-B9WZxanZ.js} +15 -17
- package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
- package/dist/{emergency-queue-CQ-9acZf.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
- package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
- package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
- package/dist/error-like-B11pB4aL.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/{errors-oyxrpHjY.js → errors-D6bwgJtO.js} +5 -6
- package/dist/errors-D6bwgJtO.js.map +1 -0
- package/dist/{errors-CigX45pL.cjs → errors-DCOCRdSi.cjs} +2 -2
- package/dist/errors-DCOCRdSi.cjs.map +1 -0
- package/dist/{factory-BkjNzPYL.cjs → factory-DLFDjdLv.cjs} +2 -2
- package/dist/factory-DLFDjdLv.cjs.map +1 -0
- package/dist/{factory-Bgsky_e0.js → factory-e9Qo3K0z.js} +18 -22
- package/dist/factory-e9Qo3K0z.js.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
- package/dist/global-scope-D9I8s-oN.js.map +1 -0
- package/dist/{guards-CpvOpJL6.js → guards-Cidk71ME.js} +2 -3
- package/dist/guards-Cidk71ME.js.map +1 -0
- package/dist/guards-nJ70syPt.cjs.map +1 -1
- package/dist/{identity-BMlKGHUM.cjs → identity-BlvlgjrU.cjs} +2 -2
- package/dist/identity-BlvlgjrU.cjs.map +1 -0
- package/dist/{identity-DOaHdfhT.js → identity-BrQp_5J5.js} +20 -21
- package/dist/identity-BrQp_5J5.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +112 -79
- package/dist/index.js +797 -659
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-CaXGJqDD.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
- package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
- package/dist/{indexeddb-storage-D-lUW_5P.js → indexeddb-storage-DLXQzAGh.js} +5 -6
- package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
- package/dist/{interactions-CqDNrtIR.js → interactions-B6z2I4tU.js} +10 -11
- package/dist/interactions-B6z2I4tU.js.map +1 -0
- package/dist/{interactions-8DgxtmgO.cjs → interactions-P6pz08Jn.cjs} +2 -2
- package/dist/interactions-P6pz08Jn.cjs.map +1 -0
- package/dist/{journey-DgIjhrIc.js → journey-35yCMNFo.js} +21 -21
- package/dist/journey-35yCMNFo.js.map +1 -0
- package/dist/journey-DAGh5h9k.cjs +2 -0
- package/dist/journey-DAGh5h9k.cjs.map +1 -0
- package/dist/keys-BHhw_0Wh.cjs.map +1 -1
- package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
- package/dist/keys-BU9j5YqW.js.map +1 -0
- package/dist/{library-console-g_VU-wzP.cjs → library-console-BFWEuQsl.cjs} +2 -2
- package/dist/library-console-BFWEuQsl.cjs.map +1 -0
- package/dist/library-console-Dl_Ly6DQ.js +13 -0
- package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
- package/dist/{library-request-FQaiWjCP.cjs → library-request-Da-CHKzT.cjs} +2 -2
- package/dist/library-request-Da-CHKzT.cjs.map +1 -0
- package/dist/{library-request-CyC-9IOk.js → library-request-nI6pvI6I.js} +4 -5
- package/dist/library-request-nI6pvI6I.js.map +1 -0
- package/dist/{lifecycle-C2z_d8OX.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
- package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
- package/dist/{lifecycle-BLC4VU7c.js → lifecycle-CZ6RRXc6.js} +3 -4
- package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
- package/dist/{log-record-DKvo-B-d.cjs → log-record-D7bA1RPb.cjs} +2 -2
- package/dist/log-record-D7bA1RPb.cjs.map +1 -0
- package/dist/{log-record-CndanC-p.js → log-record-DIA6McNr.js} +3 -4
- package/dist/log-record-DIA6McNr.js.map +1 -0
- package/dist/{long-frames-BQef9rXR.js → long-frames-430_85Da.js} +9 -8
- package/dist/long-frames-430_85Da.js.map +1 -0
- package/dist/long-frames-Dd8tsi2U.cjs +2 -0
- package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
- package/dist/models/batch.d.ts +14 -15
- package/dist/models/bus.d.ts +24 -24
- package/dist/models/config.d.ts +402 -216
- package/dist/models/drop.d.ts +13 -11
- package/dist/models/health.d.ts +13 -13
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.ts +82 -17
- package/dist/models/plugin.d.ts +13 -13
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.ts +2 -3
- package/dist/models/stats.d.ts +2 -2
- package/dist/models/storage.d.ts +12 -11
- package/dist/{network-CvkvYzRU.js → network-C7SkLf4v.js} +30 -32
- package/dist/network-C7SkLf4v.js.map +1 -0
- package/dist/{network-CqnQOqon.cjs → network-pEX3PAJv.cjs} +2 -2
- package/dist/network-pEX3PAJv.cjs.map +1 -0
- package/dist/openfin-Bxelt0yg.js +7 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-2MCrC3kd.cjs +2 -0
- package/dist/otlp-2MCrC3kd.cjs.map +1 -0
- package/dist/{otlp-CYIL7MOE.js → otlp-COq033e3.js} +26 -35
- package/dist/otlp-COq033e3.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
- package/dist/patch-UdPz1ea8.js.map +1 -0
- package/dist/{platform-KMWkoI-v.cjs → platform-12uR7kBQ.cjs} +2 -2
- package/dist/platform-12uR7kBQ.cjs.map +1 -0
- package/dist/{platform-wcAkkv9F.js → platform-CVewe4wQ.js} +9 -10
- package/dist/platform-CVewe4wQ.js.map +1 -0
- package/dist/profiler-BVWIOgnq.js +310 -0
- package/dist/profiler-BVWIOgnq.js.map +1 -0
- package/dist/profiler-eVCknCzS.cjs +2 -0
- package/dist/profiler-eVCknCzS.cjs.map +1 -0
- package/dist/profiler-frames-CLXlT_xL.js +86 -0
- package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
- package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
- package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
- package/dist/{remote-rules-CH_7PphT.js → remote-rules-BJGDJGwA.js} +29 -30
- package/dist/remote-rules-BJGDJGwA.js.map +1 -0
- package/dist/{remote-rules-BL8km4xk.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
- package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
- package/dist/replay-0zAJv9T3.js +338 -0
- package/dist/replay-0zAJv9T3.js.map +1 -0
- package/dist/replay-DomJpXqW.cjs +2 -0
- package/dist/replay-DomJpXqW.cjs.map +1 -0
- package/dist/{reports-Bh_-KpZ2.cjs → reports-BsbqmP8h.cjs} +2 -2
- package/dist/reports-BsbqmP8h.cjs.map +1 -0
- package/dist/{reports-BOKyY3_A.js → reports-BuXekPOS.js} +4 -5
- package/dist/reports-BuXekPOS.js.map +1 -0
- package/dist/{resource-timing-BROnEJ0E.js → resource-timing-CXGHwFRD.js} +6 -7
- package/dist/resource-timing-CXGHwFRD.js.map +1 -0
- package/dist/{resource-timing-CbgwNpog.cjs → resource-timing-DkycFGDa.cjs} +2 -2
- package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
- package/dist/{sampling-ECGVYiDD.cjs → sampling-Dd0wllyq.cjs} +2 -2
- package/dist/sampling-Dd0wllyq.cjs.map +1 -0
- package/dist/{sampling-BLO_pcV4.js → sampling-UUDbi3K0.js} +11 -12
- package/dist/sampling-UUDbi3K0.js.map +1 -0
- package/dist/{sanitize-DS0G4_ea.js → sanitize-CNmsD9r3.js} +4 -5
- package/dist/sanitize-CNmsD9r3.js.map +1 -0
- package/dist/{sanitize-Bsn8HQWC.cjs → sanitize-ChLn97Ch.cjs} +2 -2
- package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
- package/dist/{select-DWO0-w8_.cjs → select-CTk-K5mG.cjs} +3 -3
- package/dist/select-CTk-K5mG.cjs.map +1 -0
- package/dist/{select-wqt9Wxio.js → select-DPv_j6wq.js} +64 -67
- package/dist/select-DPv_j6wq.js.map +1 -0
- package/dist/{sender-BkAVt-Rq.js → sender-15zEsZpr.js} +98 -101
- package/dist/sender-15zEsZpr.js.map +1 -0
- package/dist/sender-Bfpv9tad.cjs +2 -0
- package/dist/sender-Bfpv9tad.cjs.map +1 -0
- package/dist/storage/context-storage.d.ts +34 -33
- package/dist/storage/emergency-queue.d.ts +9 -9
- package/dist/storage/eviction.d.ts +12 -12
- package/dist/storage/factory.d.ts +8 -7
- package/dist/storage/gap.d.ts +6 -6
- package/dist/storage/idb-driver.d.ts +31 -32
- package/dist/storage/indexeddb-storage.d.ts +26 -27
- package/dist/storage/keys.d.ts +7 -7
- package/dist/storage/local-storage.d.ts +38 -38
- package/dist/storage/memory-storage.d.ts +21 -22
- package/dist/storage/persistence.d.ts +1 -1
- package/dist/storage-BA9RqRO-.cjs.map +1 -1
- package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
- package/dist/storage-DZwed89z.js.map +1 -0
- package/dist/{storm-DD4cUkoL.js → storm-BTSNTIWI.js} +4 -5
- package/dist/storm-BTSNTIWI.js.map +1 -0
- package/dist/{storm-DCEsqViG.cjs → storm-D0_qZOEg.cjs} +2 -2
- package/dist/storm-D0_qZOEg.cjs.map +1 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.ts +39 -39
- package/dist/transport/headers.d.ts +2 -2
- package/dist/transport/http-transport.d.ts +28 -27
- package/dist/transport/memory-transport.d.ts +6 -6
- package/dist/transport/retry-engine.d.ts +35 -34
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
- package/dist/transport/serializers/otlp-traces.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +16 -16
- package/dist/transport/serializers/select.d.ts +7 -7
- package/dist/transport/status-transport.d.ts +20 -20
- package/dist/transport/worker-protocol.d.ts +3 -3
- package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
- package/dist/types-BAerHgCq.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwdpbUDg.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
- package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
- package/dist/{unclean-exit-BYZ5yaSI.js → unclean-exit-Cob_jyTv.js} +3 -4
- package/dist/unclean-exit-Cob_jyTv.js.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-CdYqx3PF.cjs +2 -0
- package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
- package/dist/{user-timing-Di2ra5DB.js → user-timing-DgHubxCI.js} +7 -6
- package/dist/user-timing-DgHubxCI.js.map +1 -0
- package/dist/utils/console.d.ts +2 -2
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.ts +2 -2
- package/dist/utils/identity.d.ts +17 -17
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.ts +10 -9
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.ts +13 -11
- package/dist/utils/sanitize.d.ts +4 -4
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +38 -38
- package/dist/utils/unref.d.ts +3 -3
- package/dist/{web-socket-DwBNhgre.cjs → web-socket-BTuvYoJI.cjs} +2 -2
- package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
- package/dist/{web-socket-B-5qqPy7.js → web-socket-DthJuSAg.js} +14 -15
- package/dist/web-socket-DthJuSAg.js.map +1 -0
- package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
- package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
- package/dist/web-vitals-CsGCWnUr.js +77 -0
- package/dist/web-vitals-CsGCWnUr.js.map +1 -0
- package/dist/{worker-protocol-0HMf4-kY.js → worker-protocol-B0_8rWy5.js} +6 -7
- package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
- package/dist/{worker-protocol-DXekoADQ.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
- package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
- package/dist/worker-server-4en-Lt-3.cjs +2 -0
- package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
- package/dist/{worker-server-CKcmX5m5.js → worker-server-Cne9MX9I.js} +25 -26
- package/dist/{worker-server-CKcmX5m5.js.map → worker-server-Cne9MX9I.js.map} +1 -1
- package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
- package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
- package/dist/{worker-transport-2220ghFZ.js → worker-transport-C3SjJAEC.js} +64 -65
- package/dist/worker-transport-C3SjJAEC.js.map +1 -0
- package/package.json +33 -41
- package/dist/batch-BHXypM1j.cjs.map +0 -1
- package/dist/batch-BMdT9mKm.js.map +0 -1
- package/dist/bus-DKfBaica.js.map +0 -1
- package/dist/bus-Dea9rVhy.cjs +0 -2
- package/dist/bus-Dea9rVhy.cjs.map +0 -1
- package/dist/console-BX_0UCV7.js.map +0 -1
- package/dist/console-DZEcs7FL.cjs +0 -2
- package/dist/console-DZEcs7FL.cjs.map +0 -1
- package/dist/constants-CL0ZdI2f.cjs +0 -2
- package/dist/constants-CL0ZdI2f.cjs.map +0 -1
- package/dist/constants-CU60FG4w.js +0 -305
- package/dist/constants-CU60FG4w.js.map +0 -1
- package/dist/context-storage-DxZf4Gfh.js.map +0 -1
- package/dist/deadline-5_PecIl5.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-CZZ6SQQh.js.map +0 -1
- package/dist/debug-bundle-yRkrU1ny.cjs +0 -2
- package/dist/debug-bundle-yRkrU1ny.cjs.map +0 -1
- package/dist/emergency-queue-CQ-9acZf.cjs.map +0 -1
- package/dist/emergency-queue-Cs8-i2xw.js.map +0 -1
- package/dist/error-like-Ywo5uRHo.js.map +0 -1
- package/dist/errors-CigX45pL.cjs.map +0 -1
- package/dist/errors-oyxrpHjY.js.map +0 -1
- package/dist/factory-Bgsky_e0.js.map +0 -1
- package/dist/factory-BkjNzPYL.cjs.map +0 -1
- package/dist/fixed-window-CtaFHanJ.js.map +0 -1
- package/dist/global-scope-dp2jADRl.js.map +0 -1
- package/dist/guards-CpvOpJL6.js.map +0 -1
- package/dist/identity-BMlKGHUM.cjs.map +0 -1
- package/dist/identity-DOaHdfhT.js.map +0 -1
- package/dist/indexeddb-storage-CaXGJqDD.cjs.map +0 -1
- package/dist/indexeddb-storage-D-lUW_5P.js.map +0 -1
- package/dist/interactions-8DgxtmgO.cjs.map +0 -1
- package/dist/interactions-CqDNrtIR.js.map +0 -1
- package/dist/journey-5tcxEbnG.cjs +0 -2
- package/dist/journey-5tcxEbnG.cjs.map +0 -1
- package/dist/journey-DgIjhrIc.js.map +0 -1
- package/dist/keys-D5r_GH9q.js.map +0 -1
- package/dist/library-console-CabK2j2-.js +0 -14
- package/dist/library-console-CabK2j2-.js.map +0 -1
- package/dist/library-console-g_VU-wzP.cjs.map +0 -1
- package/dist/library-request-CyC-9IOk.js.map +0 -1
- package/dist/library-request-FQaiWjCP.cjs.map +0 -1
- package/dist/lifecycle-BLC4VU7c.js.map +0 -1
- package/dist/lifecycle-C2z_d8OX.cjs.map +0 -1
- package/dist/log-record-CndanC-p.js.map +0 -1
- package/dist/log-record-DKvo-B-d.cjs.map +0 -1
- package/dist/long-frames-BQef9rXR.js.map +0 -1
- package/dist/long-frames-CV5ZG2cx.cjs +0 -2
- package/dist/long-frames-CV5ZG2cx.cjs.map +0 -1
- package/dist/network-CqnQOqon.cjs.map +0 -1
- package/dist/network-CvkvYzRU.js.map +0 -1
- package/dist/openfin-BwEN0uj4.js +0 -8
- package/dist/openfin-BwEN0uj4.js.map +0 -1
- package/dist/otlp-CYIL7MOE.js.map +0 -1
- package/dist/otlp-RVbkNQRh.cjs +0 -2
- package/dist/otlp-RVbkNQRh.cjs.map +0 -1
- package/dist/patch-CCWfuEY7.js.map +0 -1
- package/dist/platform-KMWkoI-v.cjs.map +0 -1
- package/dist/platform-wcAkkv9F.js.map +0 -1
- package/dist/remote-rules-BL8km4xk.cjs.map +0 -1
- package/dist/remote-rules-CH_7PphT.js.map +0 -1
- package/dist/reports-BOKyY3_A.js.map +0 -1
- package/dist/reports-Bh_-KpZ2.cjs.map +0 -1
- package/dist/resource-timing-BROnEJ0E.js.map +0 -1
- package/dist/resource-timing-CbgwNpog.cjs.map +0 -1
- package/dist/sampling-BLO_pcV4.js.map +0 -1
- package/dist/sampling-ECGVYiDD.cjs.map +0 -1
- package/dist/sanitize-Bsn8HQWC.cjs.map +0 -1
- package/dist/sanitize-DS0G4_ea.js.map +0 -1
- package/dist/select-DWO0-w8_.cjs.map +0 -1
- package/dist/select-wqt9Wxio.js.map +0 -1
- package/dist/sender-BkAVt-Rq.js.map +0 -1
- package/dist/sender-D82PxlCY.cjs +0 -2
- package/dist/sender-D82PxlCY.cjs.map +0 -1
- package/dist/storage-w7Tslvlq.js.map +0 -1
- package/dist/storm-DCEsqViG.cjs.map +0 -1
- package/dist/storm-DD4cUkoL.js.map +0 -1
- package/dist/types-BR9t_w28.js.map +0 -1
- package/dist/unclean-exit-BYZ5yaSI.js.map +0 -1
- package/dist/unclean-exit-CwdpbUDg.cjs.map +0 -1
- package/dist/user-timing-C1kB3JEg.cjs +0 -2
- package/dist/user-timing-C1kB3JEg.cjs.map +0 -1
- package/dist/user-timing-Di2ra5DB.js.map +0 -1
- package/dist/web-socket-B-5qqPy7.js.map +0 -1
- package/dist/web-socket-DwBNhgre.cjs.map +0 -1
- package/dist/web-vitals-Bflr5jSA.js +0 -53
- package/dist/web-vitals-Bflr5jSA.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-0HMf4-kY.js.map +0 -1
- package/dist/worker-protocol-DXekoADQ.cjs.map +0 -1
- package/dist/worker-server-BQK5z2yl.cjs +0 -2
- package/dist/worker-server-BQK5z2yl.cjs.map +0 -1
- package/dist/worker-transport-2220ghFZ.js.map +0 -1
- package/dist/worker-transport-Dj2yCQN5.cjs +0 -2
- package/dist/worker-transport-Dj2yCQN5.cjs.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
+
import type { ResolvedConfig } from "../models/config";
|
|
3
|
+
/** The ids stamped on every segment of a recording. */
|
|
4
|
+
export interface ReplayIds {
|
|
5
|
+
/** Recording id. */
|
|
6
|
+
replayId: string;
|
|
7
|
+
/** Session id from the record that triggered the upload. */
|
|
8
|
+
sessionId: string;
|
|
9
|
+
/** Tab id from the record that triggered the upload. */
|
|
10
|
+
tabId: string;
|
|
11
|
+
}
|
|
12
|
+
/** Cuts replay events into segments and sends them in order. */
|
|
13
|
+
export declare class ReplayUploader {
|
|
14
|
+
private readonly config;
|
|
15
|
+
private readonly diagnostics;
|
|
16
|
+
/** Events in the open segment, as JSON text. */
|
|
17
|
+
private open;
|
|
18
|
+
/** Size of the open segment. */
|
|
19
|
+
private openBytes;
|
|
20
|
+
/** Closes a segment that didn't fill up in time. */
|
|
21
|
+
private flushTimer;
|
|
22
|
+
/** Closed segments waiting to be sent. The one in flight isn't in here. */
|
|
23
|
+
private queue;
|
|
24
|
+
/** Total size of the queued segments. */
|
|
25
|
+
private queueBytes;
|
|
26
|
+
/** True while a segment is in flight or waiting for its next attempt. */
|
|
27
|
+
private busy;
|
|
28
|
+
/** Timer for the in-flight segment's next attempt. */
|
|
29
|
+
private retryTimer;
|
|
30
|
+
/** Ids for the segments we cut next. */
|
|
31
|
+
private ids;
|
|
32
|
+
/** Sequence number for the recording's next segment. */
|
|
33
|
+
private sequence;
|
|
34
|
+
/** Bumped on every stop, so a send that finishes after a stop changes nothing. */
|
|
35
|
+
private generation;
|
|
36
|
+
/** Aborts the request in flight. Once stopped, the uploader must not send anything else. */
|
|
37
|
+
private inFlight;
|
|
38
|
+
/**
|
|
39
|
+
* @param config Returns the current configuration.
|
|
40
|
+
* @param diagnostics Diagnostics reporter.
|
|
41
|
+
*/
|
|
42
|
+
constructor(config: () => ResolvedConfig, diagnostics: Diagnostics);
|
|
43
|
+
/**
|
|
44
|
+
* Sets the ids for the segments that follow. A new recording restarts the sequence at 0.
|
|
45
|
+
* @param ids Ids of the recording and of the record that triggered the upload.
|
|
46
|
+
*/
|
|
47
|
+
begin(ids: ReplayIds): void;
|
|
48
|
+
/**
|
|
49
|
+
* Adds events. A full segment closes right away, a partial one closes after the wait.
|
|
50
|
+
* @param texts The events as JSON text, in order.
|
|
51
|
+
*/
|
|
52
|
+
push(texts: readonly string[]): void;
|
|
53
|
+
/** Closes the open segment and gets it sent. */
|
|
54
|
+
flush(): void;
|
|
55
|
+
/** Drops everything that is waiting. A send still in flight no longer changes any state. */
|
|
56
|
+
stop(): void;
|
|
57
|
+
/** Sends the next segment, unless one is already in flight. */
|
|
58
|
+
private drain;
|
|
59
|
+
/**
|
|
60
|
+
* Sends one segment, backing off before each retry.
|
|
61
|
+
* @param segment The segment to send.
|
|
62
|
+
* @param attempt Attempt number, starting at 1.
|
|
63
|
+
* @param generation The uploader's generation when the send started.
|
|
64
|
+
*/
|
|
65
|
+
private deliver;
|
|
66
|
+
/**
|
|
67
|
+
* Hands a segment to the app's onSegment function, or posts it to the endpoint. Never throws.
|
|
68
|
+
* @param segment The segment to send.
|
|
69
|
+
* @param attempt Attempt number, starting at 1.
|
|
70
|
+
* @param generation The uploader's generation when the send started.
|
|
71
|
+
* @returns How the send went.
|
|
72
|
+
*/
|
|
73
|
+
private send;
|
|
74
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Capture, type CaptureContext } from "./types";
|
|
2
|
+
/** Records the DOM and uploads the recent events after an error. */
|
|
3
|
+
export declare class ReplayCapture implements Capture {
|
|
4
|
+
private readonly ctx;
|
|
5
|
+
/** Capture module identifier. */
|
|
6
|
+
readonly name = "replay";
|
|
7
|
+
/** Recent events. An upload empties it. */
|
|
8
|
+
private readonly buffer;
|
|
9
|
+
/** Cuts the events into segments and sends them. */
|
|
10
|
+
private readonly uploader;
|
|
11
|
+
/** Upload rate limit, so an error storm doesn't upload the page over and over. */
|
|
12
|
+
private readonly window;
|
|
13
|
+
/** The recorder's record function. Undefined while the recorder isn't running. */
|
|
14
|
+
private record;
|
|
15
|
+
/** Stops the recorder. */
|
|
16
|
+
private stopRecorder;
|
|
17
|
+
/** Id of the current recording. */
|
|
18
|
+
private replayId;
|
|
19
|
+
/** True between install() and uninstall(). */
|
|
20
|
+
private installed;
|
|
21
|
+
/** True while start() is loading the recorder. */
|
|
22
|
+
private starting;
|
|
23
|
+
/** Bumped on every stop, so a start that finishes after a stop records nothing. */
|
|
24
|
+
private generation;
|
|
25
|
+
/** True right after an error, while new events go straight to the uploader. */
|
|
26
|
+
private live;
|
|
27
|
+
/** True once we've reported a full snapshot that doesn't fit in the buffer. */
|
|
28
|
+
private starvedReported;
|
|
29
|
+
/** Ends the live period after an error. */
|
|
30
|
+
private liveTimer;
|
|
31
|
+
/**
|
|
32
|
+
* @param ctx Capture context: configuration, diagnostics and the runtime hooks.
|
|
33
|
+
*/
|
|
34
|
+
constructor(ctx: CaptureContext);
|
|
35
|
+
/** Starts listening for error records, and starts the recorder unless consent is still needed. */
|
|
36
|
+
install(): void;
|
|
37
|
+
/** Stops the recorder and drops whatever hasn't been sent. */
|
|
38
|
+
uninstall(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Loads the recorder and starts it. Never rejects.
|
|
41
|
+
* @returns A promise that resolves once the recorder is running, or can't run.
|
|
42
|
+
*/
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Drops the buffer and, if the recorder was running, starts a fresh recording. The runtime
|
|
46
|
+
* calls this on a new session, so the next user never gets the previous user's page.
|
|
47
|
+
*/
|
|
48
|
+
reset(): void;
|
|
49
|
+
/** Stops the recorder and drops whatever hasn't been sent. */
|
|
50
|
+
stop(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reads the mask and block selectors. An invalid selector aborts the start: a replay with a
|
|
53
|
+
* missing mask would show text the app meant to hide.
|
|
54
|
+
* @returns The selectors for the recorder, or undefined if one of them is invalid.
|
|
55
|
+
*/
|
|
56
|
+
private selectors;
|
|
57
|
+
/**
|
|
58
|
+
* Masks one piece of page text. The recorder calls this for every text the mask selector
|
|
59
|
+
* matches.
|
|
60
|
+
* @param text The node's text.
|
|
61
|
+
* @param element The element that holds the text, or null.
|
|
62
|
+
* @returns The text to record.
|
|
63
|
+
*/
|
|
64
|
+
private readonly maskText;
|
|
65
|
+
/**
|
|
66
|
+
* Masks an input value. The result always has the same length.
|
|
67
|
+
* @param text The input's value.
|
|
68
|
+
* @returns The text to record.
|
|
69
|
+
*/
|
|
70
|
+
private readonly maskInput;
|
|
71
|
+
/**
|
|
72
|
+
* Strips what the recorder's own masking misses: the query string of the page URL, and text
|
|
73
|
+
* sitting directly in a shadow root that changed after the snapshot.
|
|
74
|
+
* @param event Recorder event.
|
|
75
|
+
*/
|
|
76
|
+
private scrub;
|
|
77
|
+
/**
|
|
78
|
+
* Masks text that sits directly in a shadow root. The recorder masks it in a full snapshot
|
|
79
|
+
* but not in later mutations.
|
|
80
|
+
* @param text Text from the mutation.
|
|
81
|
+
* @param id The recorder's id for the text node.
|
|
82
|
+
* @returns The text to record.
|
|
83
|
+
*/
|
|
84
|
+
private shadowText;
|
|
85
|
+
/**
|
|
86
|
+
* Vets a request from the recorder's network plugin.
|
|
87
|
+
* @param request The plugin's request.
|
|
88
|
+
* @returns The request to record, or undefined to skip it.
|
|
89
|
+
*/
|
|
90
|
+
private readonly transformRequest;
|
|
91
|
+
/**
|
|
92
|
+
* Receives one event from the recorder, which calls this from its observers.
|
|
93
|
+
* @param event Recorder event.
|
|
94
|
+
* @param isCheckout True for the events of a new full snapshot.
|
|
95
|
+
*/
|
|
96
|
+
private readonly emit;
|
|
97
|
+
/**
|
|
98
|
+
* Reports an error from the recorder, or from serializing an event.
|
|
99
|
+
* @param error What the recorder caught.
|
|
100
|
+
*/
|
|
101
|
+
private readonly onFault;
|
|
102
|
+
/**
|
|
103
|
+
* Starts an upload when an ERROR or FATAL record comes through.
|
|
104
|
+
* @param record The record the runtime emitted.
|
|
105
|
+
*/
|
|
106
|
+
private readonly onError;
|
|
107
|
+
/** Ends the live period. The buffer starts over with a full snapshot. */
|
|
108
|
+
private readonly endLive;
|
|
109
|
+
/**
|
|
110
|
+
* Reports why the replay is off, once per document.
|
|
111
|
+
* @param message Report text.
|
|
112
|
+
*/
|
|
113
|
+
private reportOnce;
|
|
114
|
+
}
|
|
@@ -7,11 +7,11 @@ export declare class ReportCapture implements Capture {
|
|
|
7
7
|
private observer;
|
|
8
8
|
private readonly window;
|
|
9
9
|
constructor(ctx: CaptureContext);
|
|
10
|
-
/** Installs report and CSP listeners. CSP reports
|
|
10
|
+
/** Installs the report and CSP listeners. CSP reports don't need ReportingObserver. */
|
|
11
11
|
install(): void;
|
|
12
12
|
/** Disconnects the observer and removes the CSP listener. */
|
|
13
13
|
uninstall(): void;
|
|
14
14
|
private readonly onCsp;
|
|
15
|
-
/** Reads only fixed report fields. The diagnostics guard contains a failed
|
|
15
|
+
/** Reads only a fixed set of report fields. The diagnostics guard contains a failed read. */
|
|
16
16
|
private record;
|
|
17
17
|
}
|
|
@@ -6,7 +6,7 @@ export declare class ResourceTimingCapture implements Capture {
|
|
|
6
6
|
private observer;
|
|
7
7
|
private readonly window;
|
|
8
8
|
constructor(ctx: CaptureContext);
|
|
9
|
-
/** Reads buffered resources only
|
|
9
|
+
/** Reads buffered resources only on the first install in this document. */
|
|
10
10
|
install(): void;
|
|
11
11
|
/** Disconnects the observer. */
|
|
12
12
|
uninstall(): void;
|
|
@@ -4,7 +4,7 @@ interface ServerTimingEntry {
|
|
|
4
4
|
duration: number;
|
|
5
5
|
description: string;
|
|
6
6
|
}
|
|
7
|
-
/** Server duration entries
|
|
7
|
+
/** Server duration entries, plus the server span they name. */
|
|
8
8
|
export interface ServerTiming {
|
|
9
9
|
entries: ServerTimingEntry[];
|
|
10
10
|
link?: {
|
|
@@ -12,8 +12,8 @@ export interface ServerTiming {
|
|
|
12
12
|
spanId: string;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
/** Finds the header in an XHR header list.
|
|
15
|
+
/** Finds the header in an XHR header list. Reading a hidden header directly logs a Chrome error. */
|
|
16
16
|
export declare function xhrServerTiming(headers: string): string | null;
|
|
17
|
-
/** Reads bounded server duration entries. A missing header gives
|
|
17
|
+
/** Reads a bounded number of server duration entries. A missing header gives none. */
|
|
18
18
|
export declare function readServerTiming(header: string | null): ServerTiming;
|
|
19
19
|
export {};
|
package/dist/capture/storm.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import type { Diagnostics } from "../core/diagnostics";
|
|
|
2
2
|
import { type StormWindow } from "../utils/fixed-window";
|
|
3
3
|
export type { StormWindow } from "../utils/fixed-window";
|
|
4
4
|
/**
|
|
5
|
-
* Counts one event in a fixed window
|
|
6
|
-
* @param window Window state to
|
|
7
|
-
* @param limit Maximum events
|
|
5
|
+
* Counts one event in a fixed window and reports every event over the limit.
|
|
6
|
+
* @param window Window state to update.
|
|
7
|
+
* @param limit Maximum events per window.
|
|
8
8
|
* @param diagnostics Diagnostics reporter.
|
|
9
9
|
* @param what Plural name of the events, for the diagnostic message.
|
|
10
10
|
* @param windowMs Rate limit window, in milliseconds.
|
package/dist/capture/types.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import type { BreadcrumbBuffer } from "../core/breadcrumbs";
|
|
|
2
2
|
import type { Diagnostics } from "../core/diagnostics";
|
|
3
3
|
import type { SpanData } from "../core/spans";
|
|
4
4
|
import type { ResolvedConfig } from "../models/config";
|
|
5
|
-
import type { MetricType } from "../models/log-record";
|
|
5
|
+
import type { LogRecord, MetricType } from "../models/log-record";
|
|
6
6
|
import type { InstrumentDef, MetricAttributes } from "../models/metric";
|
|
7
7
|
import type { TraceEngine } from "../utils/tracing";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The logging interface the auto-capture modules use. Referring to the runtime class here
|
|
10
|
+
* would create an import cycle, because the runtime installs the capture modules.
|
|
11
11
|
*/
|
|
12
12
|
export interface CaptureLogger {
|
|
13
13
|
/**
|
|
14
|
-
* Logs an error event with
|
|
14
|
+
* Logs an error event, with the error or reason behind it.
|
|
15
15
|
* @param message Error description.
|
|
16
|
-
* @param error
|
|
16
|
+
* @param error The caught error or reason.
|
|
17
17
|
* @param payload Optional attributes.
|
|
18
18
|
*/
|
|
19
19
|
error(message: string, error?: unknown, payload?: Record<string, unknown>): void;
|
|
@@ -24,91 +24,103 @@ export interface CaptureLogger {
|
|
|
24
24
|
*/
|
|
25
25
|
warn(message: string, payload?: Record<string, unknown>): void;
|
|
26
26
|
/**
|
|
27
|
-
* Logs a
|
|
27
|
+
* Logs a single lifecycle or user event.
|
|
28
28
|
* @param name Event identifier.
|
|
29
29
|
* @param payload Optional attributes.
|
|
30
30
|
*/
|
|
31
31
|
logEvent(name: string, payload?: Record<string, unknown>): void;
|
|
32
32
|
/**
|
|
33
|
-
* Logs a
|
|
33
|
+
* Logs a numeric metric measurement.
|
|
34
34
|
* @param name Metric name.
|
|
35
|
-
* @param value
|
|
35
|
+
* @param value The measurement.
|
|
36
36
|
* @param unit Unit of measurement.
|
|
37
|
-
* @param type Metric type
|
|
37
|
+
* @param type Metric type.
|
|
38
38
|
* @param attrs Optional metric attributes.
|
|
39
39
|
*/
|
|
40
40
|
logMetric(name: string, value: number, unit?: string, type?: MetricType, attrs?: Record<string, unknown>): void;
|
|
41
41
|
/**
|
|
42
|
-
* Logs a
|
|
42
|
+
* Logs a debug message.
|
|
43
43
|
* @param message Debug message.
|
|
44
44
|
* @param payload Optional attributes.
|
|
45
45
|
*/
|
|
46
46
|
debug(message: string, payload?: Record<string, unknown>): void;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Capture work that runs
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
* Capture work that runs once per document, not once per install. A reconfigure
|
|
50
|
+
* builds new capture instances, so instance state can't hold these flags.
|
|
51
|
+
* web-vitals has no unsubscribe, and a second subscription would report every
|
|
52
|
+
* metric twice.
|
|
53
53
|
*/
|
|
54
54
|
export interface CaptureOnce {
|
|
55
|
-
/** True
|
|
55
|
+
/** True once the web-vitals reporters are subscribed. */
|
|
56
56
|
webVitals: boolean;
|
|
57
|
-
/** True
|
|
57
|
+
/** True once navigation timing has been reported. */
|
|
58
58
|
navigationTiming: boolean;
|
|
59
59
|
/** True after the first long frame install. Only that install reads buffered frames. */
|
|
60
60
|
longFrames: boolean;
|
|
61
|
-
/** True
|
|
61
|
+
/** True once we've read the previous page's alive marker. */
|
|
62
62
|
uncleanExit: boolean;
|
|
63
63
|
/** True after the first user timing install. Only that install reads buffered entries. */
|
|
64
64
|
userTiming: boolean;
|
|
65
|
-
/** True after the first resource timing install. Later installs
|
|
65
|
+
/** True after the first resource timing install. Later installs skip buffered entries. */
|
|
66
66
|
resourceTiming?: boolean;
|
|
67
|
-
/** Page state and
|
|
67
|
+
/** Page state and when it started. A reinstall keeps them, so it logs no false transition. */
|
|
68
68
|
lifecycle?: {
|
|
69
69
|
state: string;
|
|
70
70
|
enteredAt: number;
|
|
71
71
|
};
|
|
72
|
+
/** Set once the frame phases capture has reported a browser without long animation frames. */
|
|
73
|
+
framePhases?: boolean;
|
|
74
|
+
/** Set once the profiler's frame pacing has reported a context without frame callbacks. */
|
|
75
|
+
framePacing?: boolean;
|
|
76
|
+
/** Set once session replay has reported why it can't record in this document. */
|
|
77
|
+
replay?: boolean;
|
|
72
78
|
}
|
|
73
|
-
/**
|
|
79
|
+
/** Runtime dependencies shared by all auto-capture instances. */
|
|
74
80
|
export interface CaptureContext {
|
|
75
|
-
/** False while the runtime
|
|
81
|
+
/** False while the runtime is stopping or changing its security context. */
|
|
76
82
|
isActive?: () => boolean;
|
|
77
83
|
/** Active runtime configuration. */
|
|
78
84
|
config: ResolvedConfig;
|
|
79
85
|
/** Diagnostics reporter for capture faults. */
|
|
80
86
|
diagnostics: Diagnostics;
|
|
81
|
-
/** Logger
|
|
87
|
+
/** Logger for the telemetry the captures record. */
|
|
82
88
|
logger: CaptureLogger;
|
|
83
|
-
/**
|
|
89
|
+
/** Breadcrumb buffer. */
|
|
84
90
|
breadcrumbs: BreadcrumbBuffer;
|
|
85
91
|
/** Active trace context provider. */
|
|
86
92
|
tracing: TraceEngine;
|
|
87
|
-
/** Guards for
|
|
93
|
+
/** Guards for capture work that a reinstall must not repeat. */
|
|
88
94
|
once: CaptureOnce;
|
|
89
|
-
/** Adds a value to
|
|
95
|
+
/** Adds a value to one of the runtime's counters or histograms. */
|
|
90
96
|
recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;
|
|
91
97
|
/** Records a span. The runtime drops it when spans are off. */
|
|
92
98
|
recordSpan: (span: SpanData) => void;
|
|
93
|
-
/**
|
|
99
|
+
/** Returns the current session id. */
|
|
94
100
|
sessionId: () => string;
|
|
101
|
+
/** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */
|
|
102
|
+
onError?: (hook: ((record: LogRecord) => void) | undefined) => void;
|
|
103
|
+
/** Sets an ambient attribute on every later record. Undefined removes it. */
|
|
104
|
+
setContext?: (key: string, value: string | undefined) => void;
|
|
105
|
+
/** True after startReplay(), false after stopReplay(), undefined if neither was called. */
|
|
106
|
+
replayConsent?: () => boolean | undefined;
|
|
95
107
|
}
|
|
96
|
-
/** Lifecycle interface for browser instrumentation modules. */
|
|
108
|
+
/** Lifecycle interface for the browser instrumentation modules. */
|
|
97
109
|
export interface Capture {
|
|
98
110
|
/** Module identifier used in diagnostics. */
|
|
99
111
|
readonly name: string;
|
|
100
112
|
/**
|
|
101
|
-
* Attaches instrumentation listeners and patches target APIs.
|
|
102
|
-
* patched function adds a second wrapper and doubles
|
|
103
|
-
* must do nothing.
|
|
113
|
+
* Attaches the instrumentation listeners and patches the target APIs. Patching an
|
|
114
|
+
* already patched function adds a second wrapper and doubles every record, so a
|
|
115
|
+
* second call must do nothing.
|
|
104
116
|
*/
|
|
105
117
|
install(): void;
|
|
106
|
-
/** Restores native APIs and removes
|
|
118
|
+
/** Restores the native APIs and removes the listeners. */
|
|
107
119
|
uninstall(): void;
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
110
|
-
*
|
|
111
|
-
* @param url
|
|
122
|
+
* Checks whether a URL matches any of the substring or regular expression patterns.
|
|
123
|
+
* @param url URL to test. A value that isn't a string matches nothing.
|
|
112
124
|
* @param patterns Substrings and regular expressions to test against.
|
|
113
125
|
* @returns True if any pattern matches the URL.
|
|
114
126
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Capture, CaptureContext } from "./types";
|
|
2
|
-
/** Reports the unclean exit
|
|
2
|
+
/** Reports the previous page's unclean exit, and maintains this page's marker. */
|
|
3
3
|
export declare class UncleanExitCapture implements Capture {
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
/** Capture module identifier. */
|
|
@@ -8,23 +8,23 @@ export declare class UncleanExitCapture implements Capture {
|
|
|
8
8
|
private installed;
|
|
9
9
|
/** Timer that updates the marker. */
|
|
10
10
|
private timer;
|
|
11
|
-
/** True after pagehide.
|
|
11
|
+
/** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */
|
|
12
12
|
private closing;
|
|
13
13
|
/**
|
|
14
14
|
* @param ctx Capture context with the config, diagnostics, logger and session id.
|
|
15
15
|
*/
|
|
16
16
|
constructor(ctx: CaptureContext);
|
|
17
|
-
/** Reports the
|
|
17
|
+
/** Reports the previous page's marker once, then starts maintaining this page's own. */
|
|
18
18
|
install(): void;
|
|
19
|
-
/** Removes the listeners, the timer and the marker
|
|
19
|
+
/** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */
|
|
20
20
|
uninstall(): void;
|
|
21
|
-
/** Logs WARN `ui.unclean_exit`
|
|
21
|
+
/** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */
|
|
22
22
|
private reportPrevious;
|
|
23
|
-
/** Writes
|
|
23
|
+
/** Writes this page's marker with the current time and visibility. */
|
|
24
24
|
private readonly mark;
|
|
25
|
-
/** Removes
|
|
25
|
+
/** Removes this page's marker. */
|
|
26
26
|
private clear;
|
|
27
|
-
/** A clean close removes the marker. The
|
|
27
|
+
/** A clean close removes the marker. The page may still live on in the back-forward cache. */
|
|
28
28
|
private readonly onPageHide;
|
|
29
29
|
/** A page that comes back from the back-forward cache is alive again. */
|
|
30
30
|
private readonly onPageShow;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Capture, type CaptureContext } from "./types";
|
|
2
|
-
/** Observes the marks and measures
|
|
2
|
+
/** Observes the app's marks and measures. */
|
|
3
3
|
export declare class UserTimingCapture implements Capture {
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
/** Capture module identifier. */
|
|
6
6
|
readonly name = "userTiming";
|
|
7
|
-
/** Observer
|
|
7
|
+
/** Observer for the mark and measure entries. */
|
|
8
8
|
private observer;
|
|
9
9
|
/**
|
|
10
10
|
* @param ctx Capture context with the config, the meter and the breadcrumbs.
|
|
@@ -15,7 +15,7 @@ export declare class UserTimingCapture implements Capture {
|
|
|
15
15
|
/** Disconnects the observer. */
|
|
16
16
|
uninstall(): void;
|
|
17
17
|
/**
|
|
18
|
-
* Records the entries
|
|
18
|
+
* Records the entries whose name `userTimingInclude` selects.
|
|
19
19
|
* @param entries Mark and measure entries.
|
|
20
20
|
*/
|
|
21
21
|
private record;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Diagnostics } from "../core/diagnostics";
|
|
2
2
|
import type { ResolvedConfig } from "../models/config";
|
|
3
3
|
import type { CapturePlugin, PluginContext } from "../models/plugin";
|
|
4
|
-
/** Records the lifecycle and
|
|
4
|
+
/** Records the lifecycle and message counts of every WebSocket the app opens. */
|
|
5
5
|
export declare class WebSocketCapture implements CapturePlugin {
|
|
6
6
|
private readonly diagnostics;
|
|
7
7
|
private readonly config;
|
|
8
8
|
/** Capture module identifier. */
|
|
9
9
|
readonly name = "websocket";
|
|
10
|
-
/** Restores the WebSocket constructor. Undefined
|
|
10
|
+
/** Restores the WebSocket constructor. Undefined while the capture isn't installed. */
|
|
11
11
|
private restore;
|
|
12
12
|
/** State of the active install. */
|
|
13
13
|
private state;
|
|
14
|
-
/** Rate limit
|
|
14
|
+
/** Rate limit for the lifecycle records, so a reconnect loop can't flood the pipeline. */
|
|
15
15
|
private readonly window;
|
|
16
16
|
/**
|
|
17
17
|
* @param diagnostics Diagnostics reporter.
|
|
@@ -19,21 +19,21 @@ export declare class WebSocketCapture implements CapturePlugin {
|
|
|
19
19
|
*/
|
|
20
20
|
constructor(diagnostics: Diagnostics, config: ResolvedConfig);
|
|
21
21
|
/**
|
|
22
|
-
* Replaces the WebSocket constructor with a subclass that tracks
|
|
23
|
-
* @param ctx
|
|
22
|
+
* Replaces the WebSocket constructor with a subclass that tracks every socket.
|
|
23
|
+
* @param ctx The plugin's tools.
|
|
24
24
|
*/
|
|
25
25
|
install(ctx: PluginContext): void;
|
|
26
|
-
/** Restores the WebSocket constructor and stops
|
|
26
|
+
/** Restores the WebSocket constructor and stops every tracked socket from recording. */
|
|
27
27
|
uninstall(): void;
|
|
28
28
|
/**
|
|
29
|
-
* Adds the listeners that record
|
|
30
|
-
* @param socket
|
|
31
|
-
* @param state State of the install that
|
|
29
|
+
* Adds the listeners that record one socket's lifecycle and received messages.
|
|
30
|
+
* @param socket The app's new socket.
|
|
31
|
+
* @param state State of the install that created the socket.
|
|
32
32
|
*/
|
|
33
33
|
private track;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param state State of the install that
|
|
35
|
+
* Checks whether a lifecycle record can go out.
|
|
36
|
+
* @param state State of the install that created the socket.
|
|
37
37
|
* @returns False after uninstall, or when the window has no allowance left.
|
|
38
38
|
*/
|
|
39
39
|
private allow;
|
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
import type { Capture, CaptureContext } from "./types";
|
|
2
|
-
/** Captures browser navigation timing
|
|
2
|
+
/** Captures browser navigation timing and Core Web Vitals. */
|
|
3
3
|
export declare class WebVitalsCapture implements Capture {
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
/** Capture module identifier. */
|
|
6
6
|
readonly name = "web-vitals";
|
|
7
7
|
/** Prevents duplicate listener registration. */
|
|
8
8
|
private installed;
|
|
9
|
+
/** Navigation metrics already logged, so the early and the late read never repeat one. */
|
|
10
|
+
private readonly logged;
|
|
9
11
|
/**
|
|
10
|
-
* @param ctx Capture context
|
|
12
|
+
* @param ctx Capture context: configuration, diagnostics and logger.
|
|
11
13
|
*/
|
|
12
14
|
constructor(ctx: CaptureContext);
|
|
13
|
-
/** Reports navigation timing and starts
|
|
15
|
+
/** Reports navigation timing and starts loading web-vitals. */
|
|
14
16
|
install(): void;
|
|
15
17
|
/**
|
|
16
18
|
* Marks the module as uninstalled. The web-vitals reporters stay subscribed
|
|
17
|
-
* because the package has no unsubscribe
|
|
19
|
+
* because the package has no unsubscribe, and `ctx.once` prevents a second set.
|
|
18
20
|
*/
|
|
19
21
|
uninstall(): void;
|
|
20
22
|
/**
|
|
21
|
-
* Loads the web-vitals module and registers metric reporters.
|
|
22
|
-
* @param loader
|
|
23
|
+
* Loads the web-vitals module and registers the metric reporters.
|
|
24
|
+
* @param loader The loader the consumer supplies.
|
|
23
25
|
*/
|
|
24
26
|
private loadWebVitals;
|
|
25
|
-
/**
|
|
27
|
+
/** Logs the navigation timing metrics, once per document and only after the load event. */
|
|
26
28
|
private reportNavigationTiming;
|
|
29
|
+
/**
|
|
30
|
+
* Runs one step of the navigation timing read. The browser calls the late steps directly,
|
|
31
|
+
* so anything they throw would be an uncaught error on the page.
|
|
32
|
+
* @param step The step to run.
|
|
33
|
+
*/
|
|
34
|
+
private guardNavigation;
|
|
35
|
+
/**
|
|
36
|
+
* Logs every navigation metric that is ready and hasn't been logged yet.
|
|
37
|
+
* @param nav The document's navigation entry.
|
|
38
|
+
*/
|
|
39
|
+
private logNavigation;
|
|
27
40
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { tt as e } from "./constants-Bwl_YtQi.js";
|
|
2
|
+
// src/transport/compression.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
let n = globalThis.CompressionStream;
|
|
5
|
+
if (n === void 0) return null;
|
|
6
|
+
let r = new Blob([t]).stream().pipeThrough(new n(e)), i = await new Response(r).arrayBuffer();
|
|
7
|
+
return new Uint8Array(i);
|
|
8
|
+
}
|
|
9
|
+
export { t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=compression-AJJCMBOa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compression-AJJCMBOa.js","names":["ENCODING_GZIP","gzip","CS","stream","text","buffer"],"sources":["../src/transport/compression.ts"],"sourcesContent":["// src/transport/compression.ts\n//\n// Compresses payloads with the native CompressionStream API. Returns null when the API is\n// absent, never the raw text, because the server answers a non-gzip body that carries a\n// \"Content-Encoding: gzip\" header with a 400 status.\n\nimport { ENCODING_GZIP } from \"../constants\";\n\n/**\n * Compresses a string to gzip bytes with CompressionStream. The result is a\n * Uint8Array on a non-shared ArrayBuffer, which fetch accepts as BodyInit.\n * @param text Raw serialized payload to compress.\n * @returns Promise that resolves to the gzip bytes, or null when there is no CompressionStream.\n */\nexport async function gzip(text: string): Promise<Uint8Array<ArrayBuffer> | null> {\n const CS = (globalThis as { CompressionStream?: typeof CompressionStream }).CompressionStream;\n if (CS === undefined) {\n return null;\n }\n\n const stream = new Blob([text]).stream().pipeThrough(new CS(ENCODING_GZIP));\n const buffer = await new Response(stream).arrayBuffer();\n\n return new Uint8Array(buffer);\n}\n"],"mappings":";;AAcA,eAAsBC,EAAK,GAAuD;CAChF,IAAMC,IAAM,WAAgE;CAC5E,IAAIA,MAAO,KAAA,GACT,OAAO;CAGT,IAAMC,IAAS,IAAI,KAAK,CAACC,CAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,IAAIF,EAAGF,CAAa,CAAC,GACpEK,IAAS,MAAM,IAAI,SAASF,CAAM,CAAC,CAAC,YAAY;CAEtD,OAAO,IAAI,WAAWE,CAAM;AAC9B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-DakMxVB2.cjs");async function t(t){let n=globalThis.CompressionStream;if(n===void 0)return null;let r=new Blob([t]).stream().pipeThrough(new n(e.tt)),i=await new Response(r).arrayBuffer();return new Uint8Array(i)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
2
|
+
//# sourceMappingURL=compression-lD9abCcO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compression-lD9abCcO.cjs","names":["ENCODING_GZIP","require_constants","gzip","CS","stream","text","buffer"],"sources":["../src/transport/compression.ts"],"sourcesContent":["// src/transport/compression.ts\n//\n// Compresses payloads with the native CompressionStream API. Returns null when the API is\n// absent, never the raw text, because the server answers a non-gzip body that carries a\n// \"Content-Encoding: gzip\" header with a 400 status.\n\nimport { ENCODING_GZIP } from \"../constants\";\n\n/**\n * Compresses a string to gzip bytes with CompressionStream. The result is a\n * Uint8Array on a non-shared ArrayBuffer, which fetch accepts as BodyInit.\n * @param text Raw serialized payload to compress.\n * @returns Promise that resolves to the gzip bytes, or null when there is no CompressionStream.\n */\nexport async function gzip(text: string): Promise<Uint8Array<ArrayBuffer> | null> {\n const CS = (globalThis as { CompressionStream?: typeof CompressionStream }).CompressionStream;\n if (CS === undefined) {\n return null;\n }\n\n const stream = new Blob([text]).stream().pipeThrough(new CS(ENCODING_GZIP));\n const buffer = await new Response(stream).arrayBuffer();\n\n return new Uint8Array(buffer);\n}\n"],"mappings":"A,4CAcA,eAAsBE,EAAK,EAAuD,CAChF,IAAMC,EAAM,WAAgE,kBAC5E,GAAIA,IAAO,IAAA,GACT,OAAO,KAGT,IAAMC,EAAS,IAAI,KAAK,CAACC,CAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,IAAIF,EAAGH,EAAAA,EAAa,CAAC,EACpEM,EAAS,MAAM,IAAI,SAASF,CAAM,CAAC,CAAC,YAAY,EAEtD,OAAO,IAAI,WAAWE,CAAM,CAC9B,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./error-like-gGRx2s36.cjs"),t=require("./library-console-BFWEuQsl.cjs"),n=require("./patch-BX8KrPCT.cjs"),r=require("./sanitize-ChLn97Ch.cjs"),i=require("./storm-D0_qZOEg.cjs");var a=[`error`,`warn`,`info`,`log`],o=[`error`,`warn`];function s(e,n){return(...r)=>{Reflect.apply(e,console,r),t.t()||n.record?.(r)}}var c=class{ctx;name=`console`;wrapped=new Map;installed=!1;window={start:0,count:0};constructor(e){this.ctx=e}install(){if(!(this.installed||typeof console>`u`)){this.installed=!0;for(let e of this.readMethods())this.wrap(e)}}uninstall(){if(this.installed){this.installed=!1;for(let[e,{target:t,restore:n}]of this.wrapped)t.record=null,n()||this.ctx.diagnostics.report(`capture.install_failed`,`Another script wrapped console.${e} after the library. The library leaves that wrapper in place.`);this.wrapped.clear()}}readMethods(){let e=this.ctx.config.capture.console;return e===!0?o:Array.isArray(e)&&e.every(e=>a.includes(e))?[...new Set(e)]:(this.ctx.diagnostics.report(`config.invalid`,`capture.console must be true, false or a list of "error", "warn", "info" and "log". The console capture is off.`),[])}wrap(e){let r={record:n=>{t.n(()=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a console.${e} call.`,()=>{this.record(e,n)})})}},i=n.t(console,e,e=>s(e,r));this.wrapped.set(e,{target:r,restore:i})}record(t,n){let a=n.findIndex(t=>e.r(t)),o=n.findIndex(e=>typeof e==`string`),s=n[a],c=n[o]??s?.message??`console.${t}`;if(t===`info`||t===`log`){this.ctx.breadcrumbs.push({t:Date.now(),category:`console`,message:r.i(c,200),data:{"console.method":t}});return}let{diagnostics:l,logger:u}=this.ctx;if(!i.t(this.window,this.ctx.config.capturePolicy.consolePerWindow,l,`console records`,this.ctx.config.capturePolicy.windowMs))return;let d=t===`error`?[o,a]:[o],f=n.filter((e,t)=>!d.includes(t)),p={"console.method":t};f.length>0&&(p[`console.args`]=f),t===`warn`?u.warn(c,p):u.error(c,s,{...p,"error.captured_by":`console.error`})}};exports.ConsoleCapture=c;
|
|
2
|
+
//# sourceMappingURL=console-CLz_PvFn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-CLz_PvFn.cjs","names":["isLibraryConsole","patch","isErrorLike","truncate","allowInWindow","require_error_like","require_library_console","require_patch","require_sanitize","require_storm","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","restore","value","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls, because third-party code often reports a fault only there.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The console methods this capture can wrap. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** A wrapper's record function. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** A wrapper's target, plus the function that undoes its patch. */\ninterface Wrapped {\n /** The wrapper's target. */\n target: Target;\n /** Puts the original back if the method still holds the wrapper. Returns true if it did. */\n restore: () => boolean;\n}\n\n/**\n * Builds a wrapper that calls the original first, then the target.\n * The wrapper doesn't close over the capture, so one that stays in place keeps no runtime alive.\n * @param original The method that was in place before the wrap.\n * @param target The wrapper's target.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first, so devtools shows the same text even when the record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines the library itself prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods and records every call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that isn't in this map only calls the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Guards against wrapping a method twice. */\n private installed = false;\n\n /** This capture's own rate limit, so console noise can't eat the error capture's allowance. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps every selected method. */\n install(): void {\n // Some worker realms don't define console, so guard against a missing one.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores every method that still holds this capture's wrapper. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // Restoring here would remove the other script's wrapper, so leave it. Our wrapper now\n // only calls the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration and reports any value it can't use.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const value: unknown = this.ctx.config.capture.console;\n\n if (value === true) {\n return DEFAULT_METHODS;\n }\n\n if (\n Array.isArray(value) &&\n value.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(value as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true, false or a list of \"error\", \"warn\", \"info\" and \"log\". The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope keeps a console call inside the record path from being captured again.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method, so uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method The console method that was called.\n * @param args The call's arguments.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing also finds an error from another realm, which fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.capturePolicy.consolePerWindow,\n diagnostics,\n \"console records\",\n this.ctx.config.capturePolicy.windowMs,\n )\n ) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error among them.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":"A,kMAcA,IAAMU,EAA4C,CAAC,QAAS,OAAQ,OAAQ,KAAK,EAG3EC,EAAoD,CAAC,QAAS,MAAM,EA0B1E,SAASC,EAAY,EAAqB,EAA2B,CACnE,OAAQ,GAAGC,IAAS,CAElB,QAAQ,MAAMC,EAAU,QAASD,CAAI,EAGjCb,EAAAA,EAAiB,GAIrBe,EAAO,SAASF,CAAI,CACtB,CACF,CAGA,IAAaG,EAAb,KAA+C,CAgBhB,IAd7B,KAAgB,UAGhB,QAA2B,IAAI,IAG/B,UAAoB,GAGpB,OAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,EAK5D,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAEd,GAAI,OAAK,WAAa,OAAO,QAAY,KAGzC,MAAK,UAAY,GAEjB,IAAK,IAAMC,KAAU,KAAK,YAAY,EACpC,KAAK,KAAKA,CAAM,CAHD,CAKnB,CAGA,WAAkB,CAChB,GAAK,KAAK,UAGV,MAAK,UAAY,GAEjB,IAAK,GAAM,CAACA,EAAQ,CAAE,SAAQ,cAAc,KAAK,QAC/C,EAAO,OAAS,KAEZC,EAAQ,GAMZ,KAAK,IAAI,YAAY,OACnB,yBACA,kCAAkCD,EAAO,8DAC3C,EAGF,KAAK,QAAQ,MAAM,CAjBF,CAkBnB,CAMA,aAAwD,CACtD,IAAME,EAAiB,KAAK,IAAI,OAAO,QAAQ,QAiB/C,OAfIA,IAAU,GACLT,EAIP,MAAM,QAAQS,CAAK,GACnBA,EAAM,MAAO,GAAoBV,EAAQ,SAASQ,CAA+B,CAAC,EAE3E,CAAC,GAAG,IAAI,IAAIE,CAAgC,CAAC,GAGtD,KAAK,IAAI,YAAY,OACnB,iBACA,iHACF,EACO,CAAC,EACV,CAMA,KAAa,EAAqC,CAChD,IAAML,EAAiB,CACrB,OAAS,GAAS,CAEhBT,EAAA,MAA0B,CACxB,KAAK,IAAI,YAAY,MACnB,wBACA,0CAA0CY,EAAO,YAC3C,CACJ,KAAK,OAAOA,EAAQL,CAAI,CAC1B,CACF,CACF,CAAC,CACH,CACF,EAGMM,EAAUlB,EAAAA,EAAM,QAASiB,EAAS,GAAaN,EAAYE,EAAUC,CAAM,CAAC,EAClF,KAAK,QAAQ,IAAIG,EAAQ,CAAE,SAAQ,SAAQ,CAAC,CAC9C,CAOA,OAAe,EAA+B,EAAuB,CAEnE,IAAMG,EAAUR,EAAK,UAAW,GAAQX,EAAAA,EAAYoB,CAAG,CAAC,EAClDC,EAASV,EAAK,UAAW,GAAQ,OAAOS,GAAQ,QAAQ,EACxDE,EAAQX,EAAKQ,GACbI,EAAWZ,EAAKU,IAAkCC,GAAO,SAAW,WAAWN,IAErF,GAAIA,IAAW,QAAUA,IAAW,MAAO,CACzC,KAAK,IAAI,YAAY,KAAK,CACxB,EAAG,KAAK,IAAI,EACZ,SAAU,UACV,QAASf,EAAAA,EAASsB,EAAA,GAAqC,EACvD,KAAM,CAAE,iBAAkBP,CAAO,CACnC,CAAC,EACD,MACF,CAEA,GAAM,CAAE,cAAa,UAAW,KAAK,IAErC,GACE,CAACd,EAAAA,EACC,KAAK,OACL,KAAK,IAAI,OAAO,cAAc,iBAC9BsB,EACA,kBACA,KAAK,IAAI,OAAO,cAAc,QAChC,EAEA,OAIF,IAAMC,EAAOT,IAAW,QAAU,CAACK,EAAQF,CAAO,EAAI,CAACE,CAAM,EACvDK,EAAOf,EAAK,QAAQ,EAAG,IAAU,CAACc,EAAK,SAASE,CAAK,CAAC,EACtDC,EAAiC,CAAE,iBAAkBZ,CAAO,EAE9DU,EAAK,OAAS,IAChB,EAAM,gBAAkBA,GAGtBV,IAAW,OACba,EAAO,KAAKN,EAASK,CAAK,EAI5BC,EAAO,MAAMN,EAASD,EAAO,CAAE,GAAGM,EAAO,oBAAqB,eAAgB,CAAC,CACjF,CACF,E"}
|