@utk09/ui-observability 0.12.0 → 1.1.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 +280 -10
- package/README.md +70 -839
- package/dist/{batch-BjQUwjA6.js → batch-D3NHhF9L.js} +4 -4
- package/dist/{batch-BjQUwjA6.js.map → batch-D3NHhF9L.js.map} +1 -1
- package/dist/{batch-D5LlU4Q9.cjs → batch-DnYRJqhU.cjs} +2 -2
- package/dist/{batch-D5LlU4Q9.cjs.map → batch-DnYRJqhU.cjs.map} +1 -1
- package/dist/bus/bus.d.cts +355 -0
- package/dist/bus/bus.d.ts +86 -12
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +18 -3
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +10 -1
- package/dist/bus-B__467mL.cjs +2 -0
- package/dist/bus-B__467mL.cjs.map +1 -0
- package/dist/bus-dw7T92sO.js +788 -0
- package/dist/bus-dw7T92sO.js.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +1 -1
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +1 -1
- package/dist/capture/interactions.d.cts +80 -0
- package/dist/capture/interactions.d.ts +36 -4
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +1 -1
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +1 -1
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +1 -1
- package/dist/capture/observed-windows.d.cts +51 -0
- package/dist/capture/observed-windows.d.ts +51 -0
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +1 -1
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +9 -10
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +7 -2
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +1 -1
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +1 -1
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +1 -1
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +5 -5
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +10 -9
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +1 -1
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +2 -2
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +3 -3
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +1 -1
- package/dist/{compression-lD9abCcO.cjs → compression-C0hUHKR-.cjs} +2 -2
- package/dist/{compression-lD9abCcO.cjs.map → compression-C0hUHKR-.cjs.map} +1 -1
- package/dist/{compression-AJJCMBOa.js → compression-SHPAvS4U.js} +2 -2
- package/dist/{compression-AJJCMBOa.js.map → compression-SHPAvS4U.js.map} +1 -1
- package/dist/config-CSNcS7OZ.js +558 -0
- package/dist/config-CSNcS7OZ.js.map +1 -0
- package/dist/config-CybPP5VM.cjs +2 -0
- package/dist/config-CybPP5VM.cjs.map +1 -0
- package/dist/console-BsM-fSCQ.js +81 -0
- package/dist/console-BsM-fSCQ.js.map +1 -0
- package/dist/console-Dkxs6IVQ.cjs +2 -0
- package/dist/console-Dkxs6IVQ.cjs.map +1 -0
- package/dist/constants-BwJDXzj6.js +357 -0
- package/dist/constants-BwJDXzj6.js.map +1 -0
- package/dist/constants-CtF52hIV.cjs +2 -0
- package/dist/constants-CtF52hIV.cjs.map +1 -0
- package/dist/constants.d.cts +763 -0
- package/dist/constants.d.ts +100 -20
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +5 -0
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +30 -2
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +3 -8
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +3 -3
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +3 -3
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +2 -2
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +16 -6
- package/dist/core/hold-buffer.d.cts +36 -0
- package/dist/core/hold-buffer.d.ts +16 -7
- package/dist/core/journey.d.cts +148 -0
- package/dist/core/journey.d.ts +7 -7
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +23 -30
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +14 -3
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +14 -8
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +73 -10
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +2 -2
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +44 -12
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +3 -3
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +3 -3
- package/dist/core/rotation.d.cts +99 -0
- package/dist/core/rotation.d.ts +99 -0
- package/dist/core/runtime.d.cts +774 -0
- package/dist/core/runtime.d.ts +254 -70
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +5 -5
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +59 -15
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +1 -1
- package/dist/debug-bundle-B2v6Cym-.cjs +2 -0
- package/dist/debug-bundle-B2v6Cym-.cjs.map +1 -0
- package/dist/debug-bundle-Cs_YWzTa.js +35 -0
- package/dist/debug-bundle-Cs_YWzTa.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +5 -2
- package/dist/doctor.js +119 -87
- package/dist/doctor.js.map +1 -1
- package/dist/errors-DP2RUm4V.cjs +3 -0
- package/dist/errors-DP2RUm4V.cjs.map +1 -0
- package/dist/errors-Q3Ng1ciC.js +86 -0
- package/dist/errors-Q3Ng1ciC.js.map +1 -0
- package/dist/factory-DV17sm2p.js +404 -0
- package/dist/factory-DV17sm2p.js.map +1 -0
- package/dist/factory-K8O6gpux.cjs +2 -0
- package/dist/factory-K8O6gpux.cjs.map +1 -0
- package/dist/guards-BlYGRK4l.js +10 -0
- package/dist/guards-BlYGRK4l.js.map +1 -0
- package/dist/guards-EjG3ahFp.cjs +2 -0
- package/dist/guards-EjG3ahFp.cjs.map +1 -0
- package/dist/{identity-BrQp_5J5.js → identity-BgtHyY4u.js} +33 -26
- package/dist/identity-BgtHyY4u.js.map +1 -0
- package/dist/identity-CvuyqZk7.cjs +2 -0
- package/dist/identity-CvuyqZk7.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +301 -0
- package/dist/index.d.ts +90 -98
- package/dist/index.js +1253 -1555
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-D4KVcqdD.cjs +2 -0
- package/dist/indexeddb-storage-D4KVcqdD.cjs.map +1 -0
- package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-e-13ZLWm.js} +61 -57
- package/dist/indexeddb-storage-e-13ZLWm.js.map +1 -0
- package/dist/interactions-Byxf1C82.js +207 -0
- package/dist/interactions-Byxf1C82.js.map +1 -0
- package/dist/interactions-OK85T-Dk.cjs +2 -0
- package/dist/interactions-OK85T-Dk.cjs.map +1 -0
- package/dist/{journey-35yCMNFo.js → journey-C93FTYcs.js} +46 -49
- package/dist/journey-C93FTYcs.js.map +1 -0
- package/dist/journey-nMbob3OB.cjs +2 -0
- package/dist/journey-nMbob3OB.cjs.map +1 -0
- package/dist/{library-console-BFWEuQsl.cjs → library-console-DJUQzcgM.cjs} +2 -2
- package/dist/{library-console-BFWEuQsl.cjs.map → library-console-DJUQzcgM.cjs.map} +1 -1
- package/dist/{library-console-Dl_Ly6DQ.js → library-console-DklSmucS.js} +2 -2
- package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-DklSmucS.js.map} +1 -1
- package/dist/{library-request-nI6pvI6I.js → library-request-UGEwOHpf.js} +2 -2
- package/dist/{library-request-nI6pvI6I.js.map → library-request-UGEwOHpf.js.map} +1 -1
- package/dist/{library-request-Da-CHKzT.cjs → library-request-kY9iTpIF.cjs} +2 -2
- package/dist/{library-request-Da-CHKzT.cjs.map → library-request-kY9iTpIF.cjs.map} +1 -1
- package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-B2PlIuQu.js} +21 -29
- package/dist/lifecycle-B2PlIuQu.js.map +1 -0
- package/dist/lifecycle-DaMdH_X7.cjs +2 -0
- package/dist/lifecycle-DaMdH_X7.cjs.map +1 -0
- package/dist/log-record-Bmx6etMh.cjs +2 -0
- package/dist/log-record-Bmx6etMh.cjs.map +1 -0
- package/dist/{log-record-DIA6McNr.js → log-record-DSt2P-Sr.js} +8 -7
- package/dist/log-record-DSt2P-Sr.js.map +1 -0
- package/dist/{long-frames-430_85Da.js → long-frames-Bamjs1WV.js} +18 -22
- package/dist/long-frames-Bamjs1WV.js.map +1 -0
- package/dist/long-frames-lhtONgGt.cjs +2 -0
- package/dist/long-frames-lhtONgGt.cjs.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +2 -2
- package/dist/models/bus.d.cts +163 -0
- package/dist/models/bus.d.ts +28 -3
- package/dist/models/config.d.cts +1555 -0
- package/dist/models/config.d.ts +377 -261
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +16 -3
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +108 -12
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +13 -2
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +3 -3
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/serializer.d.cts +25 -0
- package/dist/models/serializer.d.ts +4 -2
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +7 -5
- package/dist/network-BCn8Gn47.cjs +2 -0
- package/dist/network-BCn8Gn47.cjs.map +1 -0
- package/dist/{network-C7SkLf4v.js → network-Cg1L2w2r.js} +57 -57
- package/dist/network-Cg1L2w2r.js.map +1 -0
- package/dist/observed-windows-B3gJkdql.cjs +2 -0
- package/dist/observed-windows-B3gJkdql.cjs.map +1 -0
- package/dist/observed-windows-BrwaJNlj.js +64 -0
- package/dist/observed-windows-BrwaJNlj.js.map +1 -0
- package/dist/{otlp-2MCrC3kd.cjs → otlp-CrAWkQdO.cjs} +2 -2
- package/dist/{otlp-2MCrC3kd.cjs.map → otlp-CrAWkQdO.cjs.map} +1 -1
- package/dist/{otlp-COq033e3.js → otlp-D6dRZyB8.js} +9 -9
- package/dist/{otlp-COq033e3.js.map → otlp-D6dRZyB8.js.map} +1 -1
- package/dist/{platform-CVewe4wQ.js → platform-8DLhjddo.js} +9 -9
- package/dist/{platform-CVewe4wQ.js.map → platform-8DLhjddo.js.map} +1 -1
- package/dist/{platform-12uR7kBQ.cjs → platform-BqRc-7RO.cjs} +2 -2
- package/dist/{platform-12uR7kBQ.cjs.map → platform-BqRc-7RO.cjs.map} +1 -1
- package/dist/{profiler-BVWIOgnq.js → profiler-BaXSqCfz.js} +78 -96
- package/dist/profiler-BaXSqCfz.js.map +1 -0
- package/dist/profiler-BvWW2kNM.cjs +2 -0
- package/dist/profiler-BvWW2kNM.cjs.map +1 -0
- package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-C4ySHN0X.js} +21 -29
- package/dist/profiler-frames-C4ySHN0X.js.map +1 -0
- package/dist/profiler-frames-DeaBiB-5.cjs +2 -0
- package/dist/profiler-frames-DeaBiB-5.cjs.map +1 -0
- package/dist/remote-rules-D7L6D_D2.cjs +2 -0
- package/dist/remote-rules-D7L6D_D2.cjs.map +1 -0
- package/dist/remote-rules-Dq9xe7Qn.js +95 -0
- package/dist/remote-rules-Dq9xe7Qn.js.map +1 -0
- package/dist/replay-B0M8kWz_.js +310 -0
- package/dist/replay-B0M8kWz_.js.map +1 -0
- package/dist/replay-QOFBpAXh.cjs +2 -0
- package/dist/replay-QOFBpAXh.cjs.map +1 -0
- package/dist/{reports-BuXekPOS.js → reports--8APRLa-.js} +25 -30
- package/dist/reports--8APRLa-.js.map +1 -0
- package/dist/reports-ojuMKGO7.cjs +2 -0
- package/dist/reports-ojuMKGO7.cjs.map +1 -0
- package/dist/{resource-timing-CXGHwFRD.js → resource-timing-BzR05rE-.js} +20 -23
- package/dist/resource-timing-BzR05rE-.js.map +1 -0
- package/dist/resource-timing-pAG3ZhB5.cjs +2 -0
- package/dist/resource-timing-pAG3ZhB5.cjs.map +1 -0
- package/dist/response-body-BWvwKQ2p.js +331 -0
- package/dist/response-body-BWvwKQ2p.js.map +1 -0
- package/dist/response-body-CKEJ5itk.cjs +3 -0
- package/dist/response-body-CKEJ5itk.cjs.map +1 -0
- package/dist/rotation-BylN1B9e.js +93 -0
- package/dist/rotation-BylN1B9e.js.map +1 -0
- package/dist/rotation-E2eKClIs.cjs +2 -0
- package/dist/rotation-E2eKClIs.cjs.map +1 -0
- package/dist/sampling-B46LW0cy.cjs +2 -0
- package/dist/sampling-B46LW0cy.cjs.map +1 -0
- package/dist/sampling-zXA6r-Nw.js +63 -0
- package/dist/sampling-zXA6r-Nw.js.map +1 -0
- package/dist/{sanitize-CNmsD9r3.js → sanitize-DjnR6RXR.js} +2 -2
- package/dist/sanitize-DjnR6RXR.js.map +1 -0
- package/dist/{sanitize-ChLn97Ch.cjs → sanitize-Qj6LuZqp.cjs} +2 -2
- package/dist/sanitize-Qj6LuZqp.cjs.map +1 -0
- package/dist/sender-Bdp-TAS4.js +979 -0
- package/dist/sender-Bdp-TAS4.js.map +1 -0
- package/dist/sender-DR7ZycZY.cjs +2 -0
- package/dist/sender-DR7ZycZY.cjs.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +5 -5
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +4 -4
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +1 -1
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +3 -3
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +3 -3
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +1 -1
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +12 -4
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +2 -2
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +11 -4
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +4 -3
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +2 -2
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-BOu54M8Y.cjs +2 -0
- package/dist/stored-context-BOu54M8Y.cjs.map +1 -0
- package/dist/stored-context-CSttrAsw.js +51 -0
- package/dist/stored-context-CSttrAsw.js.map +1 -0
- package/dist/storm-BHgI12iS.cjs +2 -0
- package/dist/storm-BHgI12iS.cjs.map +1 -0
- package/dist/storm-DKlpv0FL.js +9 -0
- package/dist/storm-DKlpv0FL.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/custom-transport.d.cts +22 -0
- package/dist/transport/custom-transport.d.ts +6 -5
- package/dist/transport/errors.d.cts +31 -0
- package/dist/transport/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +30 -13
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +2 -2
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +20 -8
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +2 -2
- package/dist/transport/response-body.d.cts +49 -0
- package/dist/transport/response-body.d.ts +49 -0
- package/dist/transport/retry-engine.d.cts +129 -0
- package/dist/transport/retry-engine.d.ts +27 -9
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +2 -2
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +5 -5
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +25 -8
- package/dist/transport/worker-client.d.cts +23 -0
- package/dist/transport/worker-client.d.ts +12 -3
- package/dist/transport/worker-entry.d.cts +5 -0
- package/dist/transport/worker-entry.d.ts +1 -1
- package/dist/transport/worker-protocol.d.cts +38 -0
- package/dist/transport/worker-protocol.d.ts +4 -2
- package/dist/transport/worker-server.d.cts +3 -0
- package/dist/transport/worker-server.d.ts +1 -1
- package/dist/transport/worker-transport.d.cts +10 -0
- package/dist/transport/worker-transport.d.ts +5 -4
- package/dist/types-BAerHgCq.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/unclean-exit-BYPYYkQ5.cjs +2 -0
- package/dist/unclean-exit-BYPYYkQ5.cjs.map +1 -0
- package/dist/{unclean-exit-Cob_jyTv.js → unclean-exit-BcOB8A2e.js} +23 -30
- package/dist/unclean-exit-BcOB8A2e.js.map +1 -0
- package/dist/{user-timing-DgHubxCI.js → user-timing-4KIJ74Vi.js} +15 -17
- package/dist/user-timing-4KIJ74Vi.js.map +1 -0
- package/dist/user-timing-BsU2wQKE.cjs +2 -0
- package/dist/user-timing-BsU2wQKE.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +4 -4
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +8 -0
- package/dist/utils/identity.d.cts +114 -0
- package/dist/utils/identity.d.ts +8 -4
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +1 -1
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +2 -2
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +1 -1
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +11 -4
- package/dist/utils/unref.d.cts +9 -0
- package/dist/web-socket-Cs1ZbmmN.cjs +2 -0
- package/dist/{web-socket-DthJuSAg.js.map → web-socket-Cs1ZbmmN.cjs.map} +1 -1
- package/dist/{web-socket-DthJuSAg.js → web-socket-Zg0hj1LB.js} +23 -28
- package/dist/web-socket-Zg0hj1LB.js.map +1 -0
- package/dist/{web-vitals-CsGCWnUr.js → web-vitals-4pWACwaR.js} +15 -21
- package/dist/web-vitals-4pWACwaR.js.map +1 -0
- package/dist/web-vitals-__X7t4pj.cjs +2 -0
- package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
- package/dist/{worker-protocol-B0_8rWy5.js → worker-protocol-CYpAbrVl.js} +14 -11
- package/dist/worker-protocol-CYpAbrVl.js.map +1 -0
- package/dist/worker-protocol-DFYXIFus.cjs +2 -0
- package/dist/worker-protocol-DFYXIFus.cjs.map +1 -0
- package/dist/worker-server--yGTadTA.cjs +2 -0
- package/dist/worker-server--yGTadTA.cjs.map +1 -0
- package/dist/worker-server-BokySIII.js +94 -0
- package/dist/worker-server-BokySIII.js.map +1 -0
- package/dist/worker-transport-BdEvh_-a.cjs +2 -0
- package/dist/worker-transport-BdEvh_-a.cjs.map +1 -0
- package/dist/worker-transport-JK-Fby9J.js +194 -0
- package/dist/worker-transport-JK-Fby9J.js.map +1 -0
- package/llms.txt +400 -0
- package/package.json +65 -49
- package/dist/bus-D_7pd7RN.cjs +0 -2
- package/dist/bus-D_7pd7RN.cjs.map +0 -1
- package/dist/bus-ecxUNTja.js +0 -660
- package/dist/bus-ecxUNTja.js.map +0 -1
- package/dist/console-CLz_PvFn.cjs +0 -2
- package/dist/console-CLz_PvFn.cjs.map +0 -1
- package/dist/console-cwgHKXvM.js +0 -82
- package/dist/console-cwgHKXvM.js.map +0 -1
- package/dist/constants-Bwl_YtQi.js +0 -349
- package/dist/constants-Bwl_YtQi.js.map +0 -1
- package/dist/constants-DakMxVB2.cjs +0 -2
- package/dist/constants-DakMxVB2.cjs.map +0 -1
- package/dist/context-storage-BjzeBSxH.cjs +0 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
- package/dist/context-storage-BzkoHzkQ.js +0 -51
- package/dist/context-storage-BzkoHzkQ.js.map +0 -1
- package/dist/debug-bundle-BOdYmCeV.js +0 -32
- package/dist/debug-bundle-BOdYmCeV.js.map +0 -1
- package/dist/debug-bundle-Ex4L_LSP.cjs +0 -2
- package/dist/debug-bundle-Ex4L_LSP.cjs.map +0 -1
- package/dist/emergency-queue-B9WZxanZ.js +0 -67
- package/dist/emergency-queue-B9WZxanZ.js.map +0 -1
- package/dist/emergency-queue-HBpL5r3V.cjs +0 -2
- package/dist/emergency-queue-HBpL5r3V.cjs.map +0 -1
- package/dist/errors-D6bwgJtO.js +0 -92
- package/dist/errors-D6bwgJtO.js.map +0 -1
- package/dist/errors-DCOCRdSi.cjs +0 -3
- package/dist/errors-DCOCRdSi.cjs.map +0 -1
- package/dist/factory-DLFDjdLv.cjs +0 -2
- package/dist/factory-DLFDjdLv.cjs.map +0 -1
- package/dist/factory-e9Qo3K0z.js +0 -276
- package/dist/factory-e9Qo3K0z.js.map +0 -1
- package/dist/guards-Cidk71ME.js +0 -7
- package/dist/guards-Cidk71ME.js.map +0 -1
- package/dist/guards-nJ70syPt.cjs +0 -2
- package/dist/guards-nJ70syPt.cjs.map +0 -1
- package/dist/identity-BlvlgjrU.cjs +0 -2
- package/dist/identity-BlvlgjrU.cjs.map +0 -1
- package/dist/identity-BrQp_5J5.js.map +0 -1
- package/dist/indexeddb-storage-CtLvZH1r.cjs +0 -2
- package/dist/indexeddb-storage-CtLvZH1r.cjs.map +0 -1
- package/dist/indexeddb-storage-DLXQzAGh.js.map +0 -1
- package/dist/interactions-B6z2I4tU.js +0 -119
- package/dist/interactions-B6z2I4tU.js.map +0 -1
- package/dist/interactions-P6pz08Jn.cjs +0 -2
- package/dist/interactions-P6pz08Jn.cjs.map +0 -1
- package/dist/journey-35yCMNFo.js.map +0 -1
- package/dist/journey-DAGh5h9k.cjs +0 -2
- package/dist/journey-DAGh5h9k.cjs.map +0 -1
- package/dist/keys-BHhw_0Wh.cjs +0 -2
- package/dist/keys-BHhw_0Wh.cjs.map +0 -1
- package/dist/keys-BU9j5YqW.js +0 -16
- package/dist/keys-BU9j5YqW.js.map +0 -1
- package/dist/lifecycle-BGGOcN4N.cjs +0 -2
- package/dist/lifecycle-BGGOcN4N.cjs.map +0 -1
- package/dist/lifecycle-CZ6RRXc6.js.map +0 -1
- package/dist/log-record-D7bA1RPb.cjs +0 -2
- package/dist/log-record-D7bA1RPb.cjs.map +0 -1
- package/dist/log-record-DIA6McNr.js.map +0 -1
- package/dist/long-frames-430_85Da.js.map +0 -1
- package/dist/long-frames-Dd8tsi2U.cjs +0 -2
- package/dist/long-frames-Dd8tsi2U.cjs.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-C7SkLf4v.js.map +0 -1
- package/dist/network-pEX3PAJv.cjs +0 -2
- package/dist/network-pEX3PAJv.cjs.map +0 -1
- package/dist/profiler-BVWIOgnq.js.map +0 -1
- package/dist/profiler-eVCknCzS.cjs +0 -2
- package/dist/profiler-eVCknCzS.cjs.map +0 -1
- package/dist/profiler-frames-CLXlT_xL.js.map +0 -1
- package/dist/profiler-frames-Dg2OebB2.cjs +0 -2
- package/dist/profiler-frames-Dg2OebB2.cjs.map +0 -1
- package/dist/remote-rules-BJGDJGwA.js +0 -98
- package/dist/remote-rules-BJGDJGwA.js.map +0 -1
- package/dist/remote-rules-CJD3ToVk.cjs +0 -2
- package/dist/remote-rules-CJD3ToVk.cjs.map +0 -1
- package/dist/replay-0zAJv9T3.js +0 -338
- package/dist/replay-0zAJv9T3.js.map +0 -1
- package/dist/replay-DomJpXqW.cjs +0 -2
- package/dist/replay-DomJpXqW.cjs.map +0 -1
- package/dist/reports-BsbqmP8h.cjs +0 -2
- package/dist/reports-BsbqmP8h.cjs.map +0 -1
- package/dist/reports-BuXekPOS.js.map +0 -1
- package/dist/resource-timing-CXGHwFRD.js.map +0 -1
- package/dist/resource-timing-DkycFGDa.cjs +0 -2
- package/dist/resource-timing-DkycFGDa.cjs.map +0 -1
- package/dist/sampling-Dd0wllyq.cjs +0 -2
- package/dist/sampling-Dd0wllyq.cjs.map +0 -1
- package/dist/sampling-UUDbi3K0.js +0 -60
- package/dist/sampling-UUDbi3K0.js.map +0 -1
- package/dist/sanitize-CNmsD9r3.js.map +0 -1
- package/dist/sanitize-ChLn97Ch.cjs.map +0 -1
- package/dist/select-CTk-K5mG.cjs +0 -3
- package/dist/select-CTk-K5mG.cjs.map +0 -1
- package/dist/select-DPv_j6wq.js +0 -270
- package/dist/select-DPv_j6wq.js.map +0 -1
- package/dist/sender-15zEsZpr.js +0 -857
- package/dist/sender-15zEsZpr.js.map +0 -1
- package/dist/sender-Bfpv9tad.cjs +0 -2
- package/dist/sender-Bfpv9tad.cjs.map +0 -1
- package/dist/storage-BA9RqRO-.cjs +0 -2
- package/dist/storage-BA9RqRO-.cjs.map +0 -1
- package/dist/storage-DZwed89z.js +0 -16
- package/dist/storage-DZwed89z.js.map +0 -1
- package/dist/storm-BTSNTIWI.js +0 -9
- package/dist/storm-BTSNTIWI.js.map +0 -1
- package/dist/storm-D0_qZOEg.cjs +0 -2
- package/dist/storm-D0_qZOEg.cjs.map +0 -1
- package/dist/unclean-exit-ClGzrc2A.cjs +0 -2
- package/dist/unclean-exit-ClGzrc2A.cjs.map +0 -1
- package/dist/unclean-exit-Cob_jyTv.js.map +0 -1
- package/dist/user-timing-CdYqx3PF.cjs +0 -2
- package/dist/user-timing-CdYqx3PF.cjs.map +0 -1
- package/dist/user-timing-DgHubxCI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BTuvYoJI.cjs +0 -2
- package/dist/web-socket-BTuvYoJI.cjs.map +0 -1
- package/dist/web-vitals-Ch5BpDmo.cjs +0 -2
- package/dist/web-vitals-Ch5BpDmo.cjs.map +0 -1
- package/dist/web-vitals-CsGCWnUr.js.map +0 -1
- package/dist/worker-protocol-B0_8rWy5.js.map +0 -1
- package/dist/worker-protocol-BjzFORfq.cjs +0 -2
- package/dist/worker-protocol-BjzFORfq.cjs.map +0 -1
- package/dist/worker-server-4en-Lt-3.cjs +0 -2
- package/dist/worker-server-4en-Lt-3.cjs.map +0 -1
- package/dist/worker-server-Cne9MX9I.js +0 -83
- package/dist/worker-server-Cne9MX9I.js.map +0 -1
- package/dist/worker-transport-B-GF4Aqn.cjs +0 -2
- package/dist/worker-transport-B-GF4Aqn.cjs.map +0 -1
- package/dist/worker-transport-C3SjJAEC.js +0 -200
- package/dist/worker-transport-C3SjJAEC.js.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import type { LogBatch } from "../models/batch.cjs";
|
|
3
|
+
import type { BatchKind, ResolvedConfig } from "../models/config.cjs";
|
|
4
|
+
import type { LossReporter } from "../models/drop.cjs";
|
|
5
|
+
import type { SerializedBatch } from "../models/serializer.cjs";
|
|
6
|
+
import { TransportError } from "./errors.cjs";
|
|
7
|
+
/** The two operations that the pipeline and the retry engine use. */
|
|
8
|
+
export interface BatchTransport {
|
|
9
|
+
/**
|
|
10
|
+
* Sends one batch.
|
|
11
|
+
* @param batch Batch to send.
|
|
12
|
+
* @param onKeepalive Runs when one of the batch's requests starts with keepalive.
|
|
13
|
+
* @returns Promise that resolves to the records lost in a send that ends without an error,
|
|
14
|
+
* for example the records a server rejected in an accepted batch.
|
|
15
|
+
* @throws TransportError when the batch isn't accepted.
|
|
16
|
+
*/
|
|
17
|
+
send(batch: LogBatch, onKeepalive?: () => void): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the remaining throttle delay for a batch's endpoint.
|
|
20
|
+
* @param batch Batch to send.
|
|
21
|
+
* @returns Milliseconds until the throttle ends, or 0.
|
|
22
|
+
*/
|
|
23
|
+
throttledForMs(batch: LogBatch): number;
|
|
24
|
+
}
|
|
25
|
+
/** Hints that come with a rejected batch. */
|
|
26
|
+
export interface RejectHints {
|
|
27
|
+
/** Delay that the server asks for, in milliseconds. */
|
|
28
|
+
retryAfterMs?: number;
|
|
29
|
+
/** Largest payload that the server accepts, from a 413 answer. */
|
|
30
|
+
maxBytes?: number;
|
|
31
|
+
/** Extra advice for a 401 or a 403 answer. */
|
|
32
|
+
advice?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Base class of the HTTP transport and the custom transport. */
|
|
35
|
+
export declare abstract class StatusTransport implements BatchTransport {
|
|
36
|
+
protected readonly config: ResolvedConfig;
|
|
37
|
+
protected readonly diagnostics: Diagnostics;
|
|
38
|
+
private readonly onSampling;
|
|
39
|
+
private readonly onLoss;
|
|
40
|
+
private readonly onClock;
|
|
41
|
+
/** Abort controller shared by the requests of this delivery context. */
|
|
42
|
+
protected readonly cancellation: AbortController;
|
|
43
|
+
/** Cancels this context's work. A custom transport receives the same abort signal. */
|
|
44
|
+
stop(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Checks the batch context after every asynchronous step and before a send.
|
|
47
|
+
* @param batch Batch to check.
|
|
48
|
+
* @throws TransportError if the context stopped or the context id doesn't match.
|
|
49
|
+
*/
|
|
50
|
+
protected assertContext(batch: LogBatch): void;
|
|
51
|
+
/**
|
|
52
|
+
* Ends the wait if this context stops before the work completes.
|
|
53
|
+
* @param work Work to wait for.
|
|
54
|
+
* @returns The result of the work.
|
|
55
|
+
* @throws TransportError if this context stops first.
|
|
56
|
+
*/
|
|
57
|
+
protected untilCancelled<T>(work: Promise<T>): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Epoch time in milliseconds when the server throttle ends, per endpoint, so that a 429 from
|
|
60
|
+
* metricsEndpoint doesn't stop the log batches.
|
|
61
|
+
*/
|
|
62
|
+
private readonly throttledUntil;
|
|
63
|
+
/** Epoch time in milliseconds when the server last accepted a batch, or null. */
|
|
64
|
+
private acceptedAt;
|
|
65
|
+
/**
|
|
66
|
+
* @param config Active configuration instance.
|
|
67
|
+
* @param diagnostics Diagnostics reporter.
|
|
68
|
+
* @param onSampling Receives an accepted batch's sampling rules, before validation.
|
|
69
|
+
* @param onLoss Receives the records of a batch that the serializer can't encode.
|
|
70
|
+
* @param onClock Receives an accepted batch's clock offset, in milliseconds.
|
|
71
|
+
*/
|
|
72
|
+
constructor(config: ResolvedConfig, diagnostics: Diagnostics, onSampling?: (raw: unknown) => void, onLoss?: LossReporter, onClock?: (offsetMs: number) => void);
|
|
73
|
+
/**
|
|
74
|
+
* Sends one batch.
|
|
75
|
+
* @param batch Batch to send.
|
|
76
|
+
* @param onKeepalive Runs when one of the batch's requests starts with keepalive.
|
|
77
|
+
* @returns Promise that resolves to the records lost in a send that ends without an error.
|
|
78
|
+
* @throws TransportError when the batch isn't accepted.
|
|
79
|
+
*/
|
|
80
|
+
abstract send(batch: LogBatch, onKeepalive?: () => void): Promise<number>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the remaining throttle delay for a batch's endpoint, in milliseconds.
|
|
83
|
+
* @param batch Batch to send.
|
|
84
|
+
* @returns Milliseconds remaining in throttle window, or 0 if unthrottled.
|
|
85
|
+
*/
|
|
86
|
+
throttledForMs(batch: LogBatch): number;
|
|
87
|
+
/**
|
|
88
|
+
* Returns when the latest server throttle ends, over all endpoints.
|
|
89
|
+
* @returns Epoch time in milliseconds, or null when no endpoint is throttled now.
|
|
90
|
+
*/
|
|
91
|
+
throttleEnd(): number | null;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the time when the server last accepted a batch.
|
|
94
|
+
* @returns Epoch time in milliseconds, or null before the first accepted batch.
|
|
95
|
+
*/
|
|
96
|
+
lastSendAt(): number | null;
|
|
97
|
+
/**
|
|
98
|
+
* Serializes a batch with the configured serializer. A metrics batch gets the OTLP metrics
|
|
99
|
+
* format. Reports a serializer that throws.
|
|
100
|
+
* @param batch Batch to serialize.
|
|
101
|
+
* @returns The serialized batch, or undefined if the serializer threw.
|
|
102
|
+
*/
|
|
103
|
+
protected serialize(batch: LogBatch): SerializedBatch | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Records an accepted batch and ends the server throttle for that batch's endpoint.
|
|
106
|
+
* @param kind Kind of the accepted batch.
|
|
107
|
+
* @param sampling The answer's sampling rules, as text or as an object.
|
|
108
|
+
* @param date The answer's Date header. Null when the server doesn't expose it.
|
|
109
|
+
*/
|
|
110
|
+
protected accept(kind: BatchKind, sampling: unknown, date: unknown): void;
|
|
111
|
+
/**
|
|
112
|
+
* Reports what an OTLP server rejected or warned about in a batch it accepted. The batch isn't
|
|
113
|
+
* sent again, because the server kept the other records and a resend would duplicate them.
|
|
114
|
+
* @param batch The accepted batch.
|
|
115
|
+
* @param kind Kind of the batch, which names the count's field.
|
|
116
|
+
* @param body The answer's body text.
|
|
117
|
+
* @returns The number of rejected records, or 0.
|
|
118
|
+
*/
|
|
119
|
+
protected reportPartial(batch: LogBatch, kind: BatchKind, body: string): number;
|
|
120
|
+
/**
|
|
121
|
+
* Converts a non-2xx status code into a classified TransportError.
|
|
122
|
+
* @param status The answer's status code.
|
|
123
|
+
* @param batchId Identifier of the rejected batch.
|
|
124
|
+
* @param kind Kind of the rejected batch. A throttle applies only to its endpoint.
|
|
125
|
+
* @param hints Delay, size limit and advice that come with the answer.
|
|
126
|
+
* @returns Classified TransportError instance.
|
|
127
|
+
*/
|
|
128
|
+
protected reject(status: number, batchId: string, kind: BatchKind, hints: RejectHints): TransportError;
|
|
129
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import type { LogBatch } from "../models/batch";
|
|
3
|
-
import type { BatchKind, ResolvedConfig } from "../models/config";
|
|
4
|
-
import type { LossReporter } from "../models/drop";
|
|
5
|
-
import type { SerializedBatch } from "../models/serializer";
|
|
6
|
-
import { TransportError } from "./errors";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import type { LogBatch } from "../models/batch.js";
|
|
3
|
+
import type { BatchKind, ResolvedConfig } from "../models/config.js";
|
|
4
|
+
import type { LossReporter } from "../models/drop.js";
|
|
5
|
+
import type { SerializedBatch } from "../models/serializer.js";
|
|
6
|
+
import { TransportError } from "./errors.js";
|
|
7
7
|
/** The two operations that the pipeline and the retry engine use. */
|
|
8
8
|
export interface BatchTransport {
|
|
9
9
|
/**
|
|
10
10
|
* Sends one batch.
|
|
11
11
|
* @param batch Batch to send.
|
|
12
12
|
* @param onKeepalive Runs when one of the batch's requests starts with keepalive.
|
|
13
|
+
* @returns Promise that resolves to the records lost in a send that ends without an error,
|
|
14
|
+
* for example the records a server rejected in an accepted batch.
|
|
13
15
|
* @throws TransportError when the batch isn't accepted.
|
|
14
16
|
*/
|
|
15
|
-
send(batch: LogBatch, onKeepalive?: () => void): Promise<
|
|
17
|
+
send(batch: LogBatch, onKeepalive?: () => void): Promise<number>;
|
|
16
18
|
/**
|
|
17
19
|
* Returns the remaining throttle delay for a batch's endpoint.
|
|
18
20
|
* @param batch Batch to send.
|
|
@@ -72,15 +74,21 @@ export declare abstract class StatusTransport implements BatchTransport {
|
|
|
72
74
|
* Sends one batch.
|
|
73
75
|
* @param batch Batch to send.
|
|
74
76
|
* @param onKeepalive Runs when one of the batch's requests starts with keepalive.
|
|
77
|
+
* @returns Promise that resolves to the records lost in a send that ends without an error.
|
|
75
78
|
* @throws TransportError when the batch isn't accepted.
|
|
76
79
|
*/
|
|
77
|
-
abstract send(batch: LogBatch, onKeepalive?: () => void): Promise<
|
|
80
|
+
abstract send(batch: LogBatch, onKeepalive?: () => void): Promise<number>;
|
|
78
81
|
/**
|
|
79
82
|
* Returns the remaining throttle delay for a batch's endpoint, in milliseconds.
|
|
80
83
|
* @param batch Batch to send.
|
|
81
84
|
* @returns Milliseconds remaining in throttle window, or 0 if unthrottled.
|
|
82
85
|
*/
|
|
83
86
|
throttledForMs(batch: LogBatch): number;
|
|
87
|
+
/**
|
|
88
|
+
* Returns when the latest server throttle ends, over all endpoints.
|
|
89
|
+
* @returns Epoch time in milliseconds, or null when no endpoint is throttled now.
|
|
90
|
+
*/
|
|
91
|
+
throttleEnd(): number | null;
|
|
84
92
|
/**
|
|
85
93
|
* Returns the time when the server last accepted a batch.
|
|
86
94
|
* @returns Epoch time in milliseconds, or null before the first accepted batch.
|
|
@@ -100,6 +108,15 @@ export declare abstract class StatusTransport implements BatchTransport {
|
|
|
100
108
|
* @param date The answer's Date header. Null when the server doesn't expose it.
|
|
101
109
|
*/
|
|
102
110
|
protected accept(kind: BatchKind, sampling: unknown, date: unknown): void;
|
|
111
|
+
/**
|
|
112
|
+
* Reports what an OTLP server rejected or warned about in a batch it accepted. The batch isn't
|
|
113
|
+
* sent again, because the server kept the other records and a resend would duplicate them.
|
|
114
|
+
* @param batch The accepted batch.
|
|
115
|
+
* @param kind Kind of the batch, which names the count's field.
|
|
116
|
+
* @param body The answer's body text.
|
|
117
|
+
* @returns The number of rejected records, or 0.
|
|
118
|
+
*/
|
|
119
|
+
protected reportPartial(batch: LogBatch, kind: BatchKind, body: string): number;
|
|
103
120
|
/**
|
|
104
121
|
* Converts a non-2xx status code into a classified TransportError.
|
|
105
122
|
* @param status The answer's status code.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import { type WorkerJob, type WorkerResult } from "./worker-protocol.cjs";
|
|
3
|
+
/** A channel failure permits HTTP fallback. A timeout keeps the retry policy. */
|
|
4
|
+
export declare class WorkerFault extends Error {
|
|
5
|
+
readonly kind: "channel" | "timeout" | "cancelled";
|
|
6
|
+
constructor(kind: "channel" | "timeout" | "cancelled");
|
|
7
|
+
}
|
|
8
|
+
/** Private channel operations of the HTTP worker adapter. */
|
|
9
|
+
export interface WorkerClient {
|
|
10
|
+
/**
|
|
11
|
+
* Sends one job to the worker.
|
|
12
|
+
* @param job The job.
|
|
13
|
+
* @param signal Cancels the job.
|
|
14
|
+
* @param timeoutMs Wait for the worker's ready answer, and then for its result.
|
|
15
|
+
* @param graceMs Extra wait for the result of a ready worker, which enforces the deadline
|
|
16
|
+
* itself and may reply with a status at the deadline.
|
|
17
|
+
* @returns The worker's result.
|
|
18
|
+
*/
|
|
19
|
+
send(job: WorkerJob, signal: AbortSignal, timeoutMs: number, graceMs: number): Promise<WorkerResult>;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
22
|
+
/** Opens a private message port. The worker factory stays on the main thread. */
|
|
23
|
+
export declare function createWorkerClient(factory: () => Worker, diagnostics: Diagnostics): WorkerClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import { type WorkerJob, type WorkerResult } from "./worker-protocol";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import { type WorkerJob, type WorkerResult } from "./worker-protocol.js";
|
|
3
3
|
/** A channel failure permits HTTP fallback. A timeout keeps the retry policy. */
|
|
4
4
|
export declare class WorkerFault extends Error {
|
|
5
5
|
readonly kind: "channel" | "timeout" | "cancelled";
|
|
@@ -7,7 +7,16 @@ export declare class WorkerFault extends Error {
|
|
|
7
7
|
}
|
|
8
8
|
/** Private channel operations of the HTTP worker adapter. */
|
|
9
9
|
export interface WorkerClient {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Sends one job to the worker.
|
|
12
|
+
* @param job The job.
|
|
13
|
+
* @param signal Cancels the job.
|
|
14
|
+
* @param timeoutMs Wait for the worker's ready answer, and then for its result.
|
|
15
|
+
* @param graceMs Extra wait for the result of a ready worker, which enforces the deadline
|
|
16
|
+
* itself and may reply with a status at the deadline.
|
|
17
|
+
* @returns The worker's result.
|
|
18
|
+
*/
|
|
19
|
+
send(job: WorkerJob, signal: AbortSignal, timeoutMs: number, graceMs: number): Promise<WorkerResult>;
|
|
11
20
|
close(): void;
|
|
12
21
|
}
|
|
13
22
|
/** Opens a private message port. The worker factory stays on the main thread. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DiagnosticHandler } from "../core/diagnostics";
|
|
1
|
+
import { type DiagnosticHandler } from "../core/diagnostics.js";
|
|
2
2
|
/** Installs the worker service synchronously before its delivery module loads. */
|
|
3
3
|
export declare function serveTransportWorker(options?: {
|
|
4
4
|
onDiagnostic?: DiagnosticHandler;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { LogBatch } from "../models/batch.cjs";
|
|
2
|
+
import type { BatchKind } from "../models/config.cjs";
|
|
3
|
+
/** Cloneable inputs of one worker send. Functions never cross the channel. */
|
|
4
|
+
export interface WorkerJob {
|
|
5
|
+
batch: LogBatch;
|
|
6
|
+
kind: BatchKind;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
serializer: "otlp" | "ecs";
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
compression: "gzip" | "none";
|
|
11
|
+
credentials: RequestCredentials;
|
|
12
|
+
priority: RequestPriority;
|
|
13
|
+
timeoutMs: number;
|
|
14
|
+
deadlineMs: number;
|
|
15
|
+
}
|
|
16
|
+
/** HTTP response fields that the main thread classifies. */
|
|
17
|
+
export interface WorkerResponse {
|
|
18
|
+
status: number;
|
|
19
|
+
sampling?: string | null;
|
|
20
|
+
date?: string | null;
|
|
21
|
+
retryAfterMs?: number;
|
|
22
|
+
maxBytes?: number;
|
|
23
|
+
compressionFailed?: boolean;
|
|
24
|
+
/** Body text of an OTLP 2xx answer, which can carry a partialSuccess. */
|
|
25
|
+
body?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A worker failure never carries app exception text. */
|
|
28
|
+
export type WorkerResult = WorkerResponse | {
|
|
29
|
+
failure: "serialize" | "network" | "timeout" | "protocol";
|
|
30
|
+
};
|
|
31
|
+
/** Builds a versioned message for the private channel. */
|
|
32
|
+
export declare function workerMessage(type: string, fields?: Record<string, unknown>): Record<string, unknown>;
|
|
33
|
+
/** Checks the protocol and the exact library version. */
|
|
34
|
+
export declare function isWorkerMessage(value: unknown): value is Record<string, unknown>;
|
|
35
|
+
/** Validates a result before it changes the main transport state. */
|
|
36
|
+
export declare function isWorkerResult(value: unknown): value is WorkerResult;
|
|
37
|
+
/** Validates the cloneable job before the worker uses an endpoint or headers. */
|
|
38
|
+
export declare function isWorkerJob(value: unknown): value is WorkerJob;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LogBatch } from "../models/batch";
|
|
2
|
-
import type { BatchKind } from "../models/config";
|
|
1
|
+
import type { LogBatch } from "../models/batch.js";
|
|
2
|
+
import type { BatchKind } from "../models/config.js";
|
|
3
3
|
/** Cloneable inputs of one worker send. Functions never cross the channel. */
|
|
4
4
|
export interface WorkerJob {
|
|
5
5
|
batch: LogBatch;
|
|
@@ -21,6 +21,8 @@ export interface WorkerResponse {
|
|
|
21
21
|
retryAfterMs?: number;
|
|
22
22
|
maxBytes?: number;
|
|
23
23
|
compressionFailed?: boolean;
|
|
24
|
+
/** Body text of an OTLP 2xx answer, which can carry a partialSuccess. */
|
|
25
|
+
body?: string;
|
|
24
26
|
}
|
|
25
27
|
/** A worker failure never carries app exception text. */
|
|
26
28
|
export type WorkerResult = WorkerResponse | {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
2
|
/** Serves a private port after the worker entry accepts one connection. */
|
|
3
3
|
export declare function serveWorkerPort(port: MessagePort, diagnostics: Diagnostics): () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import type { ResolvedConfig } from "../models/config.cjs";
|
|
3
|
+
import type { LossReporter } from "../models/drop.cjs";
|
|
4
|
+
import { StatusTransport } from "./status-transport.cjs";
|
|
5
|
+
/** Creates the worker adapter without adding a package entry point or a runtime dependency. */
|
|
6
|
+
export declare function createWorkerTransport(config: ResolvedConfig, diagnostics: Diagnostics, onSampling: (raw: unknown) => void, onLoss: LossReporter, onClock: (offsetMs: number) => void): {
|
|
7
|
+
transport: StatusTransport;
|
|
8
|
+
exitHeaders: () => Record<string, string> | undefined;
|
|
9
|
+
keepaliveInFlight: () => number;
|
|
10
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import type { ResolvedConfig } from "../models/config";
|
|
3
|
-
import type { LossReporter } from "../models/drop";
|
|
4
|
-
import { StatusTransport } from "./status-transport";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import type { ResolvedConfig } from "../models/config.js";
|
|
3
|
+
import type { LossReporter } from "../models/drop.js";
|
|
4
|
+
import { StatusTransport } from "./status-transport.js";
|
|
5
5
|
/** Creates the worker adapter without adding a package entry point or a runtime dependency. */
|
|
6
6
|
export declare function createWorkerTransport(config: ResolvedConfig, diagnostics: Diagnostics, onSampling: (raw: unknown) => void, onLoss: LossReporter, onClock: (offsetMs: number) => void): {
|
|
7
7
|
transport: StatusTransport;
|
|
8
8
|
exitHeaders: () => Record<string, string> | undefined;
|
|
9
|
+
keepaliveInFlight: () => number;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-BAerHgCq.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"types-BAerHgCq.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAgJA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAgJA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-CtF52hIV.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");function n(e){let t=e===null?null:JSON.parse(e);if(typeof t!=`object`||!t)return null;let{sessionId:n,at:r,visibility:i}=t;return typeof n==`string`&&Number.isFinite(r)&&typeof i==`string`?{sessionId:n,at:r,visibility:i}:null}var r=class{constructor(n){t.t(this,`ctx`,void 0),t.t(this,`name`,`uncleanExit`),t.t(this,`installed`,!1),t.t(this,`timer`,void 0),t.t(this,`closing`,!1),t.t(this,`mark`,()=>{if(this.closing)return;let t={sessionId:this.ctx.sessionId(),at:Date.now(),visibility:document.visibilityState};this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not write the alive marker to sessionStorage.`,()=>{sessionStorage.setItem(e.n,JSON.stringify(t))})}),t.t(this,`onPageHide`,()=>{this.closing=!0,this.clear()}),t.t(this,`onPageShow`,e=>{e.persisted&&(this.closing=!1,this.mark())}),this.ctx=n}install(){this.installed||typeof document>`u`||window.parent!==window||(this.ctx.config.identity===`memory`?this.ctx.diagnostics.report(`capture.install_failed`,`capture.uncleanExit needs sessionStorage. identity: "memory" turns it off.`):(this.installed=!0,this.ctx.once.uncleanExit||(this.ctx.once.uncleanExit=!0,window.opener||this.reportPrevious()),this.mark(),addEventListener(`pagehide`,this.onPageHide),addEventListener(`pageshow`,this.onPageShow),document.addEventListener(`visibilitychange`,this.mark),this.timer=setInterval(this.mark,e.r)))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`pagehide`,this.onPageHide),removeEventListener(`pageshow`,this.onPageShow),document.removeEventListener(`visibilitychange`,this.mark),clearInterval(this.timer),this.clear())}reportPrevious(){let t=this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not read the alive marker in sessionStorage.`,()=>n(sessionStorage.getItem(e.n)));t&&this.ctx.logger.warn(`ui.unclean_exit`,{"exit.session_id":t.sessionId,"exit.last_seen_ms":t.at,"exit.visibility":t.visibility,"exit.discarded":document.wasDiscarded===!0})}clear(){this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not remove the alive marker from sessionStorage.`,()=>{sessionStorage.removeItem(e.n)})}};exports.UncleanExitCapture=r;
|
|
2
|
+
//# sourceMappingURL=unclean-exit-BYPYYkQ5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unclean-exit-BYPYYkQ5.cjs","names":["ALIVE_KEY","ALIVE_UPDATE_MS","require_constants","require_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"A,uFA8BA,SAASI,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE,GAAc,UAAY,OAAO,SAASC,CAAE,GAAK,OAAOC,GAAe,SAEjE,CAAE,YAAe,KAAc,YAAW,EAAI,IAC/D,CAGA,IAAaC,EAAb,KAAmD,CAgBjD,YAAY,EAAsC,CAArBP,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,aAAA,EAGhBA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAGpBA,EAAA,EAAA,KAAA,QAAA,IAAA,EAAA,EAGAA,EAAA,EAAA,KAAA,UAAkB,EAAA,EA0ElBA,EAAA,EAAA,KAAA,WAAoC,CAClC,GAAI,KAAK,QACP,OAGF,IAAMQ,EAAsB,CAC1B,UAAW,KAAK,IAAI,UAAU,EAC9B,GAAI,KAAK,IAAI,EACb,WAAY,SAAS,eACvB,EAEA,KAAK,IAAI,YAAY,MACnB,sBACA,sEACM,CACJ,eAAe,QAAQX,EAAAA,EAAW,KAAK,UAAUW,CAAM,CAAC,CAC1D,CACF,CACF,CAAA,EAcAR,EAAA,EAAA,KAAA,iBAA0C,CACxC,KAAK,QAAU,GACf,KAAK,MAAM,CACb,CAAA,EAGAA,EAAA,EAAA,KAAA,aAA+B,GAAuB,CAC/CS,EAA8B,YACjC,KAAK,QAAU,GACf,KAAK,KAAK,EAEd,CAAA,EAhH6B,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAGV,KAAK,WAAa,OAAO,SAAa,KAAe,OAAO,SAAW,SAKvE,KAAK,IAAI,OAAO,WAAa,SAC/B,KAAK,IAAI,YAAY,OACnB,yBACA,4EACF,GAGF,KAAK,UAAY,GAEZ,KAAK,IAAI,KAAK,cACjB,KAAK,IAAI,KAAK,YAAc,GAEvB,OAAO,QACV,KAAK,eAAe,GAIxB,KAAK,KAAK,EACV,iBAAiB,WAAY,KAAK,UAAU,EAC5C,iBAAiB,WAAY,KAAK,UAAU,EAC5C,SAAS,iBAAiB,mBAAoB,KAAK,IAAI,EACvD,KAAK,MAAQ,YAAY,KAAK,KAAMZ,EAAAA,CAAe,GACrD,CAGA,WAAkB,CACX,KAAK,YAGV,KAAK,UAAY,GAEjB,oBAAoB,WAAY,KAAK,UAAU,EAC/C,oBAAoB,WAAY,KAAK,UAAU,EAC/C,SAAS,oBAAoB,mBAAoB,KAAK,IAAI,EAC1D,cAAc,KAAK,KAAK,EACxB,KAAK,MAAM,EACb,CAGA,gBAA+B,CAC7B,IAAMU,EAAS,KAAK,IAAI,YAAY,MAClC,sBACA,qEACMP,EAAW,eAAe,QAAQJ,EAAAA,CAAS,CAAC,CACpD,EACKW,GAIL,KAAK,IAAI,OAAO,KAAK,kBAAmB,CACtC,kBAAmBA,EAAO,UAC1B,oBAAqBA,EAAO,GAC5B,kBAAmBA,EAAO,WAC1B,iBAAmB,SAA6B,eAAiB,EACnE,CAAC,CACH,CAwBA,OAAsB,CACpB,KAAK,IAAI,YAAY,MACnB,sBACA,yEACM,CACJ,eAAe,WAAWX,EAAAA,CAAS,CACrC,CACF,CACF,CAeF,E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { n as e, r as t } from "./constants-
|
|
1
|
+
import { n as e, r as t } from "./constants-BwJDXzj6.js";
|
|
2
|
+
import { t as n } from "./defineProperty-s2S8BXUc.js";
|
|
2
3
|
// src/capture/unclean-exit.ts
|
|
3
|
-
function
|
|
4
|
+
function r(e) {
|
|
4
5
|
let t = e === null ? null : JSON.parse(e);
|
|
5
6
|
if (typeof t != "object" || !t) return null;
|
|
6
7
|
let { sessionId: n, at: r, visibility: i } = t;
|
|
@@ -10,14 +11,23 @@ function n(e) {
|
|
|
10
11
|
visibility: i
|
|
11
12
|
} : null;
|
|
12
13
|
}
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
var i = class {
|
|
15
|
+
constructor(t) {
|
|
16
|
+
n(this, "ctx", void 0), n(this, "name", "uncleanExit"), n(this, "installed", !1), n(this, "timer", void 0), n(this, "closing", !1), n(this, "mark", () => {
|
|
17
|
+
if (this.closing) return;
|
|
18
|
+
let t = {
|
|
19
|
+
sessionId: this.ctx.sessionId(),
|
|
20
|
+
at: Date.now(),
|
|
21
|
+
visibility: document.visibilityState
|
|
22
|
+
};
|
|
23
|
+
this.ctx.diagnostics.guard("storage.unavailable", "The library could not write the alive marker to sessionStorage.", () => {
|
|
24
|
+
sessionStorage.setItem(e, JSON.stringify(t));
|
|
25
|
+
});
|
|
26
|
+
}), n(this, "onPageHide", () => {
|
|
27
|
+
this.closing = !0, this.clear();
|
|
28
|
+
}), n(this, "onPageShow", (e) => {
|
|
29
|
+
e.persisted && (this.closing = !1, this.mark());
|
|
30
|
+
}), this.ctx = t;
|
|
21
31
|
}
|
|
22
32
|
install() {
|
|
23
33
|
this.installed || typeof document > "u" || window.parent !== window || (this.ctx.config.identity === "memory" ? this.ctx.diagnostics.report("capture.install_failed", "capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.") : (this.installed = !0, this.ctx.once.uncleanExit || (this.ctx.once.uncleanExit = !0, window.opener || this.reportPrevious()), this.mark(), addEventListener("pagehide", this.onPageHide), addEventListener("pageshow", this.onPageShow), document.addEventListener("visibilitychange", this.mark), this.timer = setInterval(this.mark, t)));
|
|
@@ -26,7 +36,7 @@ var r = class {
|
|
|
26
36
|
this.installed && (this.installed = !1, removeEventListener("pagehide", this.onPageHide), removeEventListener("pageshow", this.onPageShow), document.removeEventListener("visibilitychange", this.mark), clearInterval(this.timer), this.clear());
|
|
27
37
|
}
|
|
28
38
|
reportPrevious() {
|
|
29
|
-
let t = this.ctx.diagnostics.guard("storage.unavailable", "The library could not read the alive marker in sessionStorage.", () =>
|
|
39
|
+
let t = this.ctx.diagnostics.guard("storage.unavailable", "The library could not read the alive marker in sessionStorage.", () => r(sessionStorage.getItem(e)));
|
|
30
40
|
t && this.ctx.logger.warn("ui.unclean_exit", {
|
|
31
41
|
"exit.session_id": t.sessionId,
|
|
32
42
|
"exit.last_seen_ms": t.at,
|
|
@@ -34,29 +44,12 @@ var r = class {
|
|
|
34
44
|
"exit.discarded": document.wasDiscarded === !0
|
|
35
45
|
});
|
|
36
46
|
}
|
|
37
|
-
mark = () => {
|
|
38
|
-
if (this.closing) return;
|
|
39
|
-
let t = {
|
|
40
|
-
sessionId: this.ctx.sessionId(),
|
|
41
|
-
at: Date.now(),
|
|
42
|
-
visibility: document.visibilityState
|
|
43
|
-
};
|
|
44
|
-
this.ctx.diagnostics.guard("storage.unavailable", "The library could not write the alive marker to sessionStorage.", () => {
|
|
45
|
-
sessionStorage.setItem(e, JSON.stringify(t));
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
47
|
clear() {
|
|
49
48
|
this.ctx.diagnostics.guard("storage.unavailable", "The library could not remove the alive marker from sessionStorage.", () => {
|
|
50
49
|
sessionStorage.removeItem(e);
|
|
51
50
|
});
|
|
52
51
|
}
|
|
53
|
-
onPageHide = () => {
|
|
54
|
-
this.closing = !0, this.clear();
|
|
55
|
-
};
|
|
56
|
-
onPageShow = (e) => {
|
|
57
|
-
e.persisted && (this.closing = !1, this.mark());
|
|
58
|
-
};
|
|
59
52
|
};
|
|
60
|
-
export {
|
|
53
|
+
export { i as UncleanExitCapture };
|
|
61
54
|
|
|
62
|
-
//# sourceMappingURL=unclean-exit-
|
|
55
|
+
//# sourceMappingURL=unclean-exit-BcOB8A2e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unclean-exit-BcOB8A2e.js","names":["ALIVE_KEY","ALIVE_UPDATE_MS","_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":";;;AA8BA,SAASG,EAAW,GAAyC;CAC3D,IAAMC,IAAiBC,MAAS,OAAO,OAAO,KAAK,MAAMA,CAAI;CAC7D,IAAI,OAAOD,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAM,EAAE,cAAW,OAAI,kBAAeA;CAItC,OAFE,OAAOE,KAAc,YAAY,OAAO,SAASC,CAAE,KAAK,OAAOC,KAAe,WAEjE;EAAE;EAAe;EAAc;CAAW,IAAI;AAC/D;AAGA,IAAaC,IAAb,MAAmD;CAgBjD,YAAY,GAAsC;EAArB,AAAAP,EAAA,MAAA,OAAA,KAAA,CAAA,GAd7BA,EAAA,MAAA,QAAgB,aAAA,GAGhBA,EAAA,MAAA,aAAoB,EAAA,GAGpBA,EAAA,MAAA,SAAA,KAAA,CAAA,GAGAA,EAAA,MAAA,WAAkB,EAAA,GA0ElBA,EAAA,MAAA,cAAoC;GAClC,IAAI,KAAK,SACP;GAGF,IAAMQ,IAAsB;IAC1B,WAAW,KAAK,IAAI,UAAU;IAC9B,IAAI,KAAK,IAAI;IACb,YAAY,SAAS;GACvB;GAEA,KAAK,IAAI,YAAY,MACnB,uBACA,yEACM;IACJ,eAAe,QAAQV,GAAW,KAAK,UAAUU,CAAM,CAAC;GAC1D,CACF;EACF,CAAA,GAcAR,EAAA,MAAA,oBAA0C;GAExC,AADA,KAAK,UAAU,IACf,KAAK,MAAM;EACb,CAAA,GAGAA,EAAA,MAAA,eAA+B,MAAuB;GACpD,AAAKS,EAA8B,cACjC,KAAK,UAAU,IACf,KAAK,KAAK;EAEd,CAAA,GAhH6B,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EAGd,AAAI,KAAK,aAAa,OAAO,WAAa,OAAe,OAAO,WAAW,WAKvE,KAAK,IAAI,OAAO,aAAa,WAC/B,KAAK,IAAI,YAAY,OACnB,0BACA,8EACF,KAGF,KAAK,YAAY,IAEZ,KAAK,IAAI,KAAK,gBACjB,KAAK,IAAI,KAAK,cAAc,IAEvB,OAAO,UACV,KAAK,eAAe,IAIxB,KAAK,KAAK,GACV,iBAAiB,YAAY,KAAK,UAAU,GAC5C,iBAAiB,YAAY,KAAK,UAAU,GAC5C,SAAS,iBAAiB,oBAAoB,KAAK,IAAI,GACvD,KAAK,QAAQ,YAAY,KAAK,MAAMX,CAAe;CACrD;CAGA,YAAkB;EAChB,AAAK,KAAK,cAGV,KAAK,YAAY,IAEjB,oBAAoB,YAAY,KAAK,UAAU,GAC/C,oBAAoB,YAAY,KAAK,UAAU,GAC/C,SAAS,oBAAoB,oBAAoB,KAAK,IAAI,GAC1D,cAAc,KAAK,KAAK,GACxB,KAAK,MAAM;CACb;CAGA,iBAA+B;EAC7B,IAAMS,IAAS,KAAK,IAAI,YAAY,MAClC,uBACA,wEACMP,EAAW,eAAe,QAAQH,CAAS,CAAC,CACpD;EACA,AAAKU,KAIL,KAAK,IAAI,OAAO,KAAK,mBAAmB;GACtC,mBAAmBA,EAAO;GAC1B,qBAAqBA,EAAO;GAC5B,mBAAmBA,EAAO;GAC1B,kBAAmB,SAA6B,iBAAiB;EACnE,CAAC;CACH;CAwBA,QAAsB;EACpB,KAAK,IAAI,YAAY,MACnB,uBACA,4EACM;GACJ,eAAe,WAAWV,CAAS;EACrC,CACF;CACF;AAeF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { i as e } from "./platform-
|
|
1
|
+
import { i as e } from "./platform-8DLhjddo.js";
|
|
2
2
|
import { t } from "./types-BAerHgCq.js";
|
|
3
|
+
import { t as n } from "./defineProperty-s2S8BXUc.js";
|
|
3
4
|
// src/capture/user-timing.ts
|
|
4
|
-
var
|
|
5
|
+
var r = {
|
|
5
6
|
name: "ui.user_timing.duration",
|
|
6
7
|
kind: "histogram",
|
|
7
8
|
unit: "ms",
|
|
@@ -19,12 +20,9 @@ var n = {
|
|
|
19
20
|
5e3,
|
|
20
21
|
1e4
|
|
21
22
|
]
|
|
22
|
-
},
|
|
23
|
-
ctx;
|
|
24
|
-
name = "userTiming";
|
|
25
|
-
observer;
|
|
23
|
+
}, i = class {
|
|
26
24
|
constructor(e) {
|
|
27
|
-
this.ctx = e;
|
|
25
|
+
n(this, "ctx", void 0), n(this, "name", "userTiming"), n(this, "observer", void 0), this.ctx = e;
|
|
28
26
|
}
|
|
29
27
|
install() {
|
|
30
28
|
if (this.observer) return;
|
|
@@ -46,20 +44,20 @@ var n = {
|
|
|
46
44
|
uninstall() {
|
|
47
45
|
this.observer?.disconnect(), this.observer = void 0;
|
|
48
46
|
}
|
|
49
|
-
record(
|
|
47
|
+
record(n) {
|
|
50
48
|
if (this.ctx.isActive?.() === !1) return;
|
|
51
|
-
let { fullUrls: i,
|
|
52
|
-
for (let
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
t: Math.round(performance.timeOrigin +
|
|
49
|
+
let { fullUrls: i, userTiming: a } = this.ctx.config.capture, o = typeof a == "object" ? a.include : void 0;
|
|
50
|
+
for (let a of n) {
|
|
51
|
+
if (o !== void 0 && o.length > 0 && !t(a.name, o)) continue;
|
|
52
|
+
let n = e(a.name, i);
|
|
53
|
+
a.entryType === "measure" ? this.ctx.recordMetric(r, a.duration, { "user_timing.name": n }) : this.ctx.breadcrumbs.push({
|
|
54
|
+
t: Math.round(performance.timeOrigin + a.startTime),
|
|
57
55
|
category: "event",
|
|
58
|
-
message:
|
|
56
|
+
message: n.slice(0, this.ctx.config.limits.maxBodyChars)
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
};
|
|
63
|
-
export {
|
|
61
|
+
export { i as UserTimingCapture };
|
|
64
62
|
|
|
65
|
-
//# sourceMappingURL=user-timing-
|
|
63
|
+
//# sourceMappingURL=user-timing-4KIJ74Vi.js.map
|