@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,979 @@
|
|
|
1
|
+
import { D as e, Mn as t, V as n, Z as r, an as i, dt as a, ft as o, g as s, gt as c, ht as l, l as u, mt as d, nt as f, on as p, pt as m, qn as h, ut as g } from "./constants-BwJDXzj6.js";
|
|
2
|
+
import { c as _, d as v, f as ee, l as y, n as te, p as b, s as ne, t as re, u as ie } from "./factory-DV17sm2p.js";
|
|
3
|
+
import { n as x, t as S } from "./deadline-C4ccAuk5.js";
|
|
4
|
+
import { i as ae, r as C } from "./library-request-UGEwOHpf.js";
|
|
5
|
+
import { t as w } from "./openfin-Bxelt0yg.js";
|
|
6
|
+
import { t as T } from "./sanitize-DjnR6RXR.js";
|
|
7
|
+
import { n as oe } from "./library-console-DklSmucS.js";
|
|
8
|
+
import { a as se, c as E, f as D, i as ce, n as le, o as O, p as ue, r as de, s as k, t as fe } from "./response-body-BWvwKQ2p.js";
|
|
9
|
+
import { t as A } from "./defineProperty-s2S8BXUc.js";
|
|
10
|
+
import { r as j } from "./platform-8DLhjddo.js";
|
|
11
|
+
import { t as M } from "./unref-DgHPQeWv.js";
|
|
12
|
+
import { t as N } from "./compression-SHPAvS4U.js";
|
|
13
|
+
import { a as P } from "./batch-D3NHhF9L.js";
|
|
14
|
+
import { r as F } from "./log-record-DSt2P-Sr.js";
|
|
15
|
+
import { i as I } from "./identity-BgtHyY4u.js";
|
|
16
|
+
import { t as L } from "./sampling-zXA6r-Nw.js";
|
|
17
|
+
import { n as R, t as z } from "./remote-rules-Dq9xe7Qn.js";
|
|
18
|
+
// src/storage/persistence.ts
|
|
19
|
+
async function B(e) {
|
|
20
|
+
let t = globalThis.navigator?.storage;
|
|
21
|
+
return typeof t?.persist == "function" ? await e.guardAsync("storage.unavailable", "The browser rejected the request for persistent storage.", () => t.persist()) === !0 ? "granted" : "denied" : "unsupported";
|
|
22
|
+
}
|
|
23
|
+
// src/transport/status-transport.ts
|
|
24
|
+
function pe(e) {
|
|
25
|
+
let t = typeof e == "string" ? Date.parse(e) : NaN;
|
|
26
|
+
return Number.isNaN(t) ? void 0 : Math.round(t + 500 - Date.now());
|
|
27
|
+
}
|
|
28
|
+
var V = class {
|
|
29
|
+
stop() {
|
|
30
|
+
this.cancellation.abort();
|
|
31
|
+
}
|
|
32
|
+
assertContext(e) {
|
|
33
|
+
if (this.cancellation.signal.aborted || this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) throw this.diagnostics.count("security.context_mismatch"), new D("permanent", "The delivery context is inactive or does not match the batch.");
|
|
34
|
+
}
|
|
35
|
+
async untilCancelled(e) {
|
|
36
|
+
if (this.cancellation.signal.aborted) throw new D("permanent", "The delivery context retired.");
|
|
37
|
+
let t, n = new Promise((e, n) => {
|
|
38
|
+
t = () => {
|
|
39
|
+
n(new D("permanent", "The delivery context retired."));
|
|
40
|
+
}, this.cancellation.signal.addEventListener("abort", t, { once: !0 });
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
return await Promise.race([e, n]);
|
|
44
|
+
} finally {
|
|
45
|
+
this.cancellation.signal.removeEventListener("abort", t);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
constructor(e, t, n = () => void 0, r = () => void 0, i = () => void 0) {
|
|
49
|
+
A(this, "config", void 0), A(this, "diagnostics", void 0), A(this, "onSampling", void 0), A(this, "onLoss", void 0), A(this, "onClock", void 0), A(this, "cancellation", new AbortController()), A(this, "throttledUntil", {
|
|
50
|
+
logs: 0,
|
|
51
|
+
metrics: 0,
|
|
52
|
+
traces: 0
|
|
53
|
+
}), A(this, "acceptedAt", null), this.config = e, this.diagnostics = t, this.onSampling = n, this.onLoss = r, this.onClock = i;
|
|
54
|
+
}
|
|
55
|
+
throttledForMs(e) {
|
|
56
|
+
return Math.max(0, this.throttledUntil[O(e, this.config)] - Date.now());
|
|
57
|
+
}
|
|
58
|
+
throttleEnd() {
|
|
59
|
+
let e = Math.max(...Object.values(this.throttledUntil));
|
|
60
|
+
return e > Date.now() ? e : null;
|
|
61
|
+
}
|
|
62
|
+
lastSendAt() {
|
|
63
|
+
return this.acceptedAt;
|
|
64
|
+
}
|
|
65
|
+
serialize(e) {
|
|
66
|
+
let t = E(this.config, e, this.diagnostics, "The serializer threw an error. The library dropped the batch.");
|
|
67
|
+
return t || this.onLoss("unserializable", e.records, [e.id]), t;
|
|
68
|
+
}
|
|
69
|
+
accept(e, t, n) {
|
|
70
|
+
this.throttledUntil[e] = 0, this.acceptedAt = Date.now(), this.config.sampling.remote && t != null && this.onSampling(t);
|
|
71
|
+
let r = pe(n);
|
|
72
|
+
r !== void 0 && this.onClock(r);
|
|
73
|
+
}
|
|
74
|
+
reportPartial(e, t, n) {
|
|
75
|
+
let r = this.diagnostics.guard("transport.http_error", "The library could not read the body of the 2xx response.", () => ce(n, t));
|
|
76
|
+
if (!r) return 0;
|
|
77
|
+
let i = k(t, this.config), a = Math.min(r.rejected, e.records.length);
|
|
78
|
+
if (a === 0) return this.diagnostics.report("transport.partial_success", "The server accepted the batch with a warning.", {
|
|
79
|
+
endpoint: i,
|
|
80
|
+
serverMessage: r.message
|
|
81
|
+
}), 0;
|
|
82
|
+
this.onLoss("partially_rejected", [], [e.id], a);
|
|
83
|
+
let o = String(e.records.length);
|
|
84
|
+
return this.diagnostics.report("transport.partial_success", `The server rejected ${String(a)} of ${o} records in the batch. The library does not send them again.`, {
|
|
85
|
+
endpoint: i,
|
|
86
|
+
rejected: a,
|
|
87
|
+
serverMessage: r.message
|
|
88
|
+
}), a;
|
|
89
|
+
}
|
|
90
|
+
reject(e, t, n, r) {
|
|
91
|
+
let i = String(e);
|
|
92
|
+
if (e === 401 || e === 403) {
|
|
93
|
+
let t = r.advice === void 0 ? "" : ` ${r.advice}`;
|
|
94
|
+
return this.diagnostics.report("transport.rejected_credentials", `The server returned ${i}.${t}`, {
|
|
95
|
+
status: e,
|
|
96
|
+
endpoint: k(n, this.config)
|
|
97
|
+
}), new D("permanent", `The server rejected the batch with ${i}.`, e);
|
|
98
|
+
}
|
|
99
|
+
if (e === 413) return new D("too_large", "The payload is too large.", e, void 0, r.maxBytes);
|
|
100
|
+
if (e === 429 || e === 503) {
|
|
101
|
+
let t = e === 429, i = r.retryAfterMs === void 0 ? void 0 : Math.min(r.retryAfterMs, this.config.delivery.retryMaxDelayMs);
|
|
102
|
+
return this.throttledUntil[n] = Date.now() + (i ?? this.config.delivery.retryBaseDelayMs), t && this.diagnostics.report("transport.throttled", "The server throttles the requests.", { retryAfterMs: i }), new D("throttled", t ? "The server throttles the requests." : "The service is not available.", e, i);
|
|
103
|
+
}
|
|
104
|
+
return e === 408 || e >= 500 ? new D("transient", `The server returned the error ${i}.`, e) : (this.diagnostics.report("transport.dropped_permanent", `The server rejected the batch with ${i}. The library dropped it.`, {
|
|
105
|
+
batchId: t,
|
|
106
|
+
status: e
|
|
107
|
+
}), new D("permanent", `The server rejected the batch with ${i}.`, e));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
// src/transport/custom-transport.ts
|
|
111
|
+
function H(e, t, n) {
|
|
112
|
+
return {
|
|
113
|
+
kind: n,
|
|
114
|
+
body: t.body,
|
|
115
|
+
contentType: t.contentType,
|
|
116
|
+
batchId: e.id,
|
|
117
|
+
attempt: e.attempts,
|
|
118
|
+
records: e.records,
|
|
119
|
+
routingContextId: e.routingContextId
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function me(e) {
|
|
123
|
+
if (typeof e != "object" || !e) return !1;
|
|
124
|
+
let t = Reflect.get(e, "status");
|
|
125
|
+
return typeof t == "number" && Number.isInteger(t) && t >= 100 && t <= 599;
|
|
126
|
+
}
|
|
127
|
+
function U(e) {
|
|
128
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : void 0;
|
|
129
|
+
}
|
|
130
|
+
var he = class extends V {
|
|
131
|
+
async send(e) {
|
|
132
|
+
this.assertContext(e);
|
|
133
|
+
let { transport: t } = this.config;
|
|
134
|
+
if (!t || e.records.length === 0) return e.records.length;
|
|
135
|
+
let n = this.serialize(e);
|
|
136
|
+
if (!n) return e.records.length;
|
|
137
|
+
let r = O(e, this.config), i = H(e, n, r);
|
|
138
|
+
i.signal = this.cancellation.signal;
|
|
139
|
+
let a;
|
|
140
|
+
try {
|
|
141
|
+
a = await x(this.untilCancelled(ae(() => C(() => oe(() => t(i))))), this.config.delivery.requestTimeoutMs);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
let t = e instanceof S ? e : void 0, n = t ? "timeout" : "transient", r = t?.message ?? "The custom transport failed.";
|
|
144
|
+
throw new D(n, r, void 0, void 0, void 0, e);
|
|
145
|
+
}
|
|
146
|
+
if (this.assertContext(e), !me(a)) throw this.diagnostics.report("transport.http_error", "The custom transport returned no valid status. The library sends the batch again later.", { batchId: e.id }), new D("transient", "The custom transport returned no valid status.");
|
|
147
|
+
let { status: o } = a;
|
|
148
|
+
if (o >= 200 && o < 300) return this.accept(r, a.sampling, a.date), 0;
|
|
149
|
+
throw this.reject(o, e.id, r, {
|
|
150
|
+
retryAfterMs: U(a.retryAfterMs),
|
|
151
|
+
maxBytes: U(a.maxBytes)
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, W = class {
|
|
155
|
+
constructor(e) {
|
|
156
|
+
A(this, "deps", void 0), A(this, "installed", !1), A(this, "keepaliveBytes", 0), A(this, "onVisibility", () => {
|
|
157
|
+
document.visibilityState === "hidden" && this.flush("hidden");
|
|
158
|
+
}), A(this, "onPageHide", () => {
|
|
159
|
+
this.flush("pagehide");
|
|
160
|
+
}), A(this, "onFreeze", () => {
|
|
161
|
+
this.flush("freeze");
|
|
162
|
+
}), A(this, "onOpenFinClose", () => {
|
|
163
|
+
this.flush("openfin-close");
|
|
164
|
+
}), this.deps = e;
|
|
165
|
+
}
|
|
166
|
+
install() {
|
|
167
|
+
if (this.installed || typeof addEventListener > "u") return;
|
|
168
|
+
this.installed = !0, typeof document < "u" && (document.addEventListener("visibilitychange", this.onVisibility), document.addEventListener("freeze", this.onFreeze)), addEventListener("pagehide", this.onPageHide);
|
|
169
|
+
let e = w()?.me;
|
|
170
|
+
this.deps.diagnostics.guard("openfin.unavailable", "The library could not subscribe to close-requested.", () => {
|
|
171
|
+
e?.on?.("close-requested", this.onOpenFinClose);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
uninstall() {
|
|
175
|
+
if (!this.installed) return;
|
|
176
|
+
this.installed = !1, typeof document < "u" && (document.removeEventListener("visibilitychange", this.onVisibility), document.removeEventListener("freeze", this.onFreeze)), removeEventListener("pagehide", this.onPageHide);
|
|
177
|
+
let e = w()?.me;
|
|
178
|
+
this.deps.diagnostics.guard("openfin.unavailable", "The library could not unsubscribe from close-requested.", () => {
|
|
179
|
+
e?.removeListener?.("close-requested", this.onOpenFinClose);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
flush(e) {
|
|
183
|
+
let { config: t, diagnostics: n } = this.deps;
|
|
184
|
+
if (n.guard("pipeline.crashed", "The metric points before the exit flush failed.", () => {
|
|
185
|
+
this.deps.beforeExit?.();
|
|
186
|
+
}), e === "hidden") {
|
|
187
|
+
this.flushAlive();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (t.transport) {
|
|
191
|
+
this.flushCustom(e, t.transportOnExit);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let r = this.endpointUrl();
|
|
195
|
+
if (r !== null) {
|
|
196
|
+
this.keepaliveBytes = this.deps.keepaliveInFlight() ?? 0;
|
|
197
|
+
for (let i of this.deps.drainForExit()) {
|
|
198
|
+
let a = O(i, t), o = a === "logs" ? r.href : k(a, t);
|
|
199
|
+
o ? this.flushBatch(i, e, new URL(o)) : n.count("record.dropped_no_destination");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
flushBatch(t, r, o) {
|
|
204
|
+
let { config: s } = this.deps;
|
|
205
|
+
if (t.records.length === 0) return;
|
|
206
|
+
let c = this.serialize(t, r);
|
|
207
|
+
if (!c) return;
|
|
208
|
+
let l = T(c.body);
|
|
209
|
+
if (l > 6e4) {
|
|
210
|
+
this.park(t);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
o.searchParams.set(i, t.id), o.searchParams.set(p, r);
|
|
214
|
+
let u = o.toString(), d = this.deps.exitHeaders(), f = () => {
|
|
215
|
+
let e = new Headers(d);
|
|
216
|
+
return e.set(m, c.contentType), e.set(a, t.id), e;
|
|
217
|
+
};
|
|
218
|
+
if (d) {
|
|
219
|
+
this.keepaliveFetch(u, t, c.body, l, r, f);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (s.headers) {
|
|
223
|
+
this.park(t);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (this.isSameOrigin(o)) {
|
|
227
|
+
this.keepaliveFetch(u, t, c.body, l, r, f);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
let h = () => new Headers({ [m]: n });
|
|
231
|
+
if (s.credentials !== "include") {
|
|
232
|
+
this.keepaliveFetch(u, t, c.body, l, r, h);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
let g = this.beacon(u, c.body);
|
|
236
|
+
g === "sent" ? this.keepaliveBytes += l : g === "refused" ? (this.keepaliveBytes = e, this.park(t)) : this.keepaliveFetch(u, t, c.body, l, r, h);
|
|
237
|
+
}
|
|
238
|
+
isSameOrigin(e) {
|
|
239
|
+
if (typeof location > "u") return !1;
|
|
240
|
+
let t = e.origin === "null", n = e.origin === globalThis.origin, r = e.origin === location.origin;
|
|
241
|
+
return !t && n && r;
|
|
242
|
+
}
|
|
243
|
+
flushAlive() {
|
|
244
|
+
let { diagnostics: e } = this.deps, t = "The flush of the hidden document failed.";
|
|
245
|
+
e.guard("pipeline.crashed", t, () => {
|
|
246
|
+
Promise.resolve(this.deps.flushAlive()).catch((n) => {
|
|
247
|
+
e.report("pipeline.crashed", t, void 0, n);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
flushCustom(e, t) {
|
|
252
|
+
let { config: n, diagnostics: r } = this.deps;
|
|
253
|
+
for (let i of this.deps.drainForExit()) {
|
|
254
|
+
let a = this.serialize(i, e);
|
|
255
|
+
if (!a) continue;
|
|
256
|
+
let o = H(i, a, O(i, n));
|
|
257
|
+
(t === void 0 || r.guard("transport.http_error", "The transportOnExit hook threw an error.", () => C(() => t(o))) !== !0) && this.park(i);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
park(e) {
|
|
261
|
+
let { config: t, diagnostics: n, onLoss: r } = this.deps, { backend: i } = t.storage;
|
|
262
|
+
i === "memory" || i === "none" ? r?.("not_stored", e.records, [e.id]) : y(e, n, r);
|
|
263
|
+
}
|
|
264
|
+
serialize(e, t) {
|
|
265
|
+
let n = E(this.deps.config, e, this.deps.diagnostics, `The ${t} exit flush could not serialize its batch.`);
|
|
266
|
+
return n || this.deps.onLoss?.("unserializable", e.records, [e.id]), n;
|
|
267
|
+
}
|
|
268
|
+
endpointUrl() {
|
|
269
|
+
let { endpoint: e } = this.deps.config;
|
|
270
|
+
return e ? this.deps.diagnostics.guard("config.invalid", `The exit flush cannot use the endpoint ${e}.`, () => new URL(e)) ?? null : null;
|
|
271
|
+
}
|
|
272
|
+
beacon(e, t) {
|
|
273
|
+
return this.deps.diagnostics.guard("transport.http_error", "The sendBeacon call failed.", () => {
|
|
274
|
+
let n = globalThis.navigator;
|
|
275
|
+
return n?.sendBeacon ? n.sendBeacon(e, new Blob([t], { type: "text/plain;charset=UTF-8" })) ? "sent" : "refused" : "unavailable";
|
|
276
|
+
}) ?? "unavailable";
|
|
277
|
+
}
|
|
278
|
+
keepaliveFetch(e, t, n, r, i, a) {
|
|
279
|
+
let { config: o, diagnostics: s } = this.deps, c = () => {
|
|
280
|
+
this.park(t);
|
|
281
|
+
};
|
|
282
|
+
this.keepaliveBytes + r > 6e4 ? c() : (this.keepaliveBytes += r, s.guard("transport.http_error", "The keepalive fetch failed.", () => (C(() => fetch(e, {
|
|
283
|
+
method: "POST",
|
|
284
|
+
body: n,
|
|
285
|
+
headers: a(),
|
|
286
|
+
credentials: o.credentials,
|
|
287
|
+
keepalive: !0
|
|
288
|
+
})).catch((e) => {
|
|
289
|
+
s.report("transport.http_error", "The exit flush failed.", { reason: i }, e), c();
|
|
290
|
+
}), !0)) !== !0 && c());
|
|
291
|
+
}
|
|
292
|
+
}, G = /* @__PURE__ */ new WeakMap();
|
|
293
|
+
function ge(e, t) {
|
|
294
|
+
let { headers: n } = t;
|
|
295
|
+
if (!n) return;
|
|
296
|
+
if (typeof n != "function") return n;
|
|
297
|
+
let r = G.get(e);
|
|
298
|
+
return r?.source === n && r.endpoint === t.endpoint && r.metricsEndpoint === t.metricsEndpoint && r.tracesEndpoint === t.tracesEndpoint ? r.headers : void 0;
|
|
299
|
+
}
|
|
300
|
+
async function K(e, t, n) {
|
|
301
|
+
let { headers: r } = t;
|
|
302
|
+
if (!r) return {};
|
|
303
|
+
if (typeof r != "function") return r;
|
|
304
|
+
let { endpoint: i, metricsEndpoint: a, tracesEndpoint: o } = t, s = await n.guardAsync("transport.http_error", "The headers() function threw an error.", () => Promise.resolve(r()));
|
|
305
|
+
return s && G.set(e, {
|
|
306
|
+
source: r,
|
|
307
|
+
endpoint: i,
|
|
308
|
+
metricsEndpoint: a,
|
|
309
|
+
tracesEndpoint: o,
|
|
310
|
+
headers: s
|
|
311
|
+
}), s ?? {};
|
|
312
|
+
}
|
|
313
|
+
function q(e) {
|
|
314
|
+
G.delete(e);
|
|
315
|
+
}
|
|
316
|
+
// src/transport/http-transport.ts
|
|
317
|
+
var J = "In a cross-origin iframe, the session cookie is a third-party cookie. The browser often blocks it. Forward the records to the platform document. As an alternative, issue the cookie with the Partitioned attribute.", Y = class extends V {
|
|
318
|
+
constructor(...e) {
|
|
319
|
+
super(...e), A(this, "keepaliveBytes", 0);
|
|
320
|
+
}
|
|
321
|
+
async send(e, t) {
|
|
322
|
+
this.assertContext(e);
|
|
323
|
+
let { config: n } = this, r = O(e, n), i = k(r, n);
|
|
324
|
+
return i ? e.records.length === 0 ? 0 : this.post(e, r, i, t) : (this.diagnostics.count("record.dropped_no_destination"), e.records.length);
|
|
325
|
+
}
|
|
326
|
+
lastHeaders() {
|
|
327
|
+
return ge(this, this.config);
|
|
328
|
+
}
|
|
329
|
+
keepaliveInFlight() {
|
|
330
|
+
return this.keepaliveBytes;
|
|
331
|
+
}
|
|
332
|
+
async post(e, t, n, r) {
|
|
333
|
+
let i = this.serialize(e);
|
|
334
|
+
if (!i) return e.records.length;
|
|
335
|
+
let a = fe(t, this.config.serializer), o = await this.attempt(e, n, i, a, r);
|
|
336
|
+
this.assertContext(e), this.rejectsCredentials(o.response.status) && typeof this.config.headers == "function" && (q(this), o = await this.attempt(e, n, i, a, r), this.assertContext(e));
|
|
337
|
+
let { response: s, body: u } = o;
|
|
338
|
+
if (s.ok) {
|
|
339
|
+
let { headers: n } = s;
|
|
340
|
+
return this.accept(t, n.get(c), n.get(d)), u === void 0 ? 0 : this.reportPartial(e, t, u);
|
|
341
|
+
}
|
|
342
|
+
let f = s.status, p = ue(s.headers.get(l)), m = f === 413 && u !== void 0 ? this.readMaxBytes(u) : void 0;
|
|
343
|
+
throw this.reject(f, e.id, t, {
|
|
344
|
+
retryAfterMs: p,
|
|
345
|
+
maxBytes: m,
|
|
346
|
+
advice: J
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
rejectsCredentials(e) {
|
|
350
|
+
return e === 401 || e === 403;
|
|
351
|
+
}
|
|
352
|
+
async attempt(e, t, n, r, i) {
|
|
353
|
+
let s = Date.now() + this.config.delivery.requestTimeoutMs, c = new Headers(await this.before(this.resolveHeaders(), s, t));
|
|
354
|
+
c.set(m, n.contentType), c.set(a, e.id), c.set(g, String(e.attempts));
|
|
355
|
+
let l = await this.before(this.encodeBody(n.body), s, t);
|
|
356
|
+
this.assertContext(e), typeof l != "string" && c.set(o, f);
|
|
357
|
+
let u = typeof l == "string" ? T(l) : l.byteLength;
|
|
358
|
+
if (!this.keepalive(u)) return this.dispatch(t, c, l, s, !1, r);
|
|
359
|
+
i?.(), this.keepaliveBytes += u;
|
|
360
|
+
try {
|
|
361
|
+
return await this.dispatch(t, c, l, s, !0, r);
|
|
362
|
+
} finally {
|
|
363
|
+
this.keepaliveBytes -= u;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
async before(e, t, n) {
|
|
367
|
+
try {
|
|
368
|
+
return await x(this.untilCancelled(e), Math.max(0, t - Date.now()));
|
|
369
|
+
} catch {
|
|
370
|
+
throw this.cancellation.signal.aborted ? new D("permanent", "The delivery context retired.") : this.timeout(n);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
timeout(e) {
|
|
374
|
+
let t = `The request took longer than ${String(this.config.delivery.requestTimeoutMs)} ms.`;
|
|
375
|
+
return this.diagnostics.report("transport.timeout", t, { endpoint: e }), new D("timeout", t);
|
|
376
|
+
}
|
|
377
|
+
async encodeBody(e) {
|
|
378
|
+
let { config: t } = this;
|
|
379
|
+
return t.compression !== "gzip" || T(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "The library could not compress the payload.", () => N(e)) ?? e;
|
|
380
|
+
}
|
|
381
|
+
async dispatch(e, t, n, r, i, a) {
|
|
382
|
+
let { config: o } = this, s = new AbortController(), c = () => {
|
|
383
|
+
s.abort();
|
|
384
|
+
};
|
|
385
|
+
this.cancellation.signal.addEventListener("abort", c, { once: !0 }), this.cancellation.signal.aborted && s.abort();
|
|
386
|
+
let l = setTimeout(() => {
|
|
387
|
+
s.abort();
|
|
388
|
+
}, Math.max(0, r - Date.now()));
|
|
389
|
+
M(l);
|
|
390
|
+
try {
|
|
391
|
+
let r = await C(() => fetch(e, {
|
|
392
|
+
method: "POST",
|
|
393
|
+
headers: t,
|
|
394
|
+
body: n,
|
|
395
|
+
credentials: o.credentials,
|
|
396
|
+
signal: s.signal,
|
|
397
|
+
cache: "no-store",
|
|
398
|
+
keepalive: i,
|
|
399
|
+
priority: i ? "auto" : o.delivery.priority
|
|
400
|
+
}));
|
|
401
|
+
return de(r, a) ? {
|
|
402
|
+
response: r,
|
|
403
|
+
body: await se(r, s.signal, this.diagnostics)
|
|
404
|
+
} : { response: r };
|
|
405
|
+
} catch {
|
|
406
|
+
throw this.cancellation.signal.aborted ? new D("permanent", "The delivery context retired.") : s.signal.aborted ? this.timeout(e) : new D(j() ? "transient" : "offline", "A network error occurred.");
|
|
407
|
+
} finally {
|
|
408
|
+
this.cancellation.signal.removeEventListener("abort", c), clearTimeout(l);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
keepalive(e) {
|
|
412
|
+
return globalThis.document?.visibilityState === "hidden" && e <= 6e4;
|
|
413
|
+
}
|
|
414
|
+
readMaxBytes(e) {
|
|
415
|
+
return this.diagnostics.guard("transport.http_error", "The library could not read the body of the 413 response.", () => le(e));
|
|
416
|
+
}
|
|
417
|
+
async resolveHeaders() {
|
|
418
|
+
return K(this, this.config, this.diagnostics);
|
|
419
|
+
}
|
|
420
|
+
}, _e = class {
|
|
421
|
+
constructor(e, t, n, r, i = 20, a = () => void 0) {
|
|
422
|
+
A(this, "storage", void 0), A(this, "transport", void 0), A(this, "diagnostics", void 0), A(this, "config", void 0), A(this, "batchesPerDrain", void 0), A(this, "onLoss", void 0), A(this, "timer", null), A(this, "attempt", 0), A(this, "draining", !1), A(this, "stopped", !1), A(this, "maxAttempts", void 0), A(this, "onOnline", () => {
|
|
423
|
+
this.attempt = 0, this.schedule(0);
|
|
424
|
+
}), this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i, this.onLoss = a, this.maxAttempts = b(r.retention).maxAttempts;
|
|
425
|
+
}
|
|
426
|
+
start() {
|
|
427
|
+
this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(t);
|
|
428
|
+
}
|
|
429
|
+
nudge() {
|
|
430
|
+
this.draining || this.schedule(this.config.delivery.retryBaseDelayMs);
|
|
431
|
+
}
|
|
432
|
+
async storeFailed(e, t) {
|
|
433
|
+
let n = this.toStorable(e, t);
|
|
434
|
+
if (n.length === 0) return {
|
|
435
|
+
outcome: "rejected",
|
|
436
|
+
stored: 0
|
|
437
|
+
};
|
|
438
|
+
let r = 0, i = 0;
|
|
439
|
+
for (let e of n) await this.bounded(this.storage.save(e)) && (r++, i += e.records.length);
|
|
440
|
+
return r > 0 && this.nudge(), r < n.length ? {
|
|
441
|
+
outcome: "not_stored",
|
|
442
|
+
stored: i
|
|
443
|
+
} : {
|
|
444
|
+
outcome: n.length > 1 ? "split" : "stored",
|
|
445
|
+
stored: i
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
stop() {
|
|
449
|
+
this.stopped = !0, typeof removeEventListener < "u" && removeEventListener("online", this.onOnline), this.clearTimer();
|
|
450
|
+
}
|
|
451
|
+
async flush() {
|
|
452
|
+
this.stopped = !1;
|
|
453
|
+
try {
|
|
454
|
+
await this.drain();
|
|
455
|
+
} finally {
|
|
456
|
+
this.stop();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
schedule(e) {
|
|
460
|
+
if (this.stopped) return;
|
|
461
|
+
this.clearTimer();
|
|
462
|
+
let t = setTimeout(() => {
|
|
463
|
+
this.drain();
|
|
464
|
+
}, e);
|
|
465
|
+
this.timer = t, M(t);
|
|
466
|
+
}
|
|
467
|
+
bounded(e) {
|
|
468
|
+
return x(e, h);
|
|
469
|
+
}
|
|
470
|
+
clearTimer() {
|
|
471
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
472
|
+
}
|
|
473
|
+
backoffMs() {
|
|
474
|
+
let e = Math.min(this.config.delivery.retryBaseDelayMs * 2 ** this.attempt, this.config.delivery.retryMaxDelayMs);
|
|
475
|
+
return Math.random() * e;
|
|
476
|
+
}
|
|
477
|
+
async drain() {
|
|
478
|
+
if (!this.draining) {
|
|
479
|
+
this.draining = !0;
|
|
480
|
+
try {
|
|
481
|
+
let e = ie(r, this.config.storage.namespace);
|
|
482
|
+
await v(e, this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(t);
|
|
483
|
+
} finally {
|
|
484
|
+
this.draining = !1;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
async drainLocked() {
|
|
489
|
+
try {
|
|
490
|
+
if (!j()) return this.schedule(t), !0;
|
|
491
|
+
let e = await this.bounded(this.storage.take(this.batchesPerDrain));
|
|
492
|
+
if (e.length === 0) return this.schedule(t), !0;
|
|
493
|
+
let n = /* @__PURE__ */ new Set(), r = 0;
|
|
494
|
+
for (let t of e) {
|
|
495
|
+
if (this.stopped) return !0;
|
|
496
|
+
let e = O(t, this.config);
|
|
497
|
+
if (n.has(e)) continue;
|
|
498
|
+
let i = await this.deliver(t);
|
|
499
|
+
if (i === "stop") return !0;
|
|
500
|
+
i !== "next" && (n.add(e), r = Math.max(r, i));
|
|
501
|
+
}
|
|
502
|
+
return n.size > 0 ? this.schedule(r) : this.schedule(e.length === this.batchesPerDrain ? 0 : t), !0;
|
|
503
|
+
} catch (e) {
|
|
504
|
+
return this.diagnostics.report("storage.degraded", "The drain loop threw an error.", void 0, e), this.attempt++, this.schedule(this.backoffMs()), !0;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
async deliver(e) {
|
|
508
|
+
if (e.attempts >= this.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `The library dropped a batch after ${e.attempts.toString()} attempts.`, {
|
|
509
|
+
batchId: e.id,
|
|
510
|
+
records: e.records.length
|
|
511
|
+
}), this.onLoss("max_attempts", e.records, [e.id]), await this.bounded(this.storage.remove(e.id)), "next";
|
|
512
|
+
try {
|
|
513
|
+
return await this.transport.send(e), await this.bounded(this.storage.remove(e.id)), this.attempt = 0, "next";
|
|
514
|
+
} catch (n) {
|
|
515
|
+
if (this.stopped) return "stop";
|
|
516
|
+
let r = n instanceof D ? n : void 0;
|
|
517
|
+
return r?.kind === "permanent" || r?.kind === "too_large" ? (await this.replaceStored(e, n), "next") : r?.kind === "offline" ? (this.schedule(t), "stop") : r?.kind === "throttled" ? (this.attempt++, r.retryAfterMs ?? this.backoffMs()) : (await this.bounded(this.storage.bumpAttempts(e.id, e.attempts + 1)), this.attempt++, r?.retryAfterMs ?? this.backoffMs());
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
async replaceStored(e, t) {
|
|
521
|
+
let n = this.toStorable(e, t);
|
|
522
|
+
await this.bounded(this.storage.remove(e.id));
|
|
523
|
+
for (let e of n) await this.bounded(this.storage.save(e));
|
|
524
|
+
}
|
|
525
|
+
toStorable(e, t) {
|
|
526
|
+
let n = t instanceof D ? t : void 0;
|
|
527
|
+
if (n?.kind === "permanent") return this.onLoss("rejected", e.records, [e.id]), [];
|
|
528
|
+
if (n?.kind !== "too_large") return [e];
|
|
529
|
+
let r = P(e, this.diagnostics);
|
|
530
|
+
return r ? (this.diagnostics.report("transport.batch_split", "The server refused the batch because it is too large.", {
|
|
531
|
+
from: e.records.length,
|
|
532
|
+
to: r[0].records.length,
|
|
533
|
+
serverMaxBytes: n.maxBytes
|
|
534
|
+
}), r) : (this.diagnostics.report("transport.dropped_permanent", "One record is larger than the server limit. The library dropped it.", {
|
|
535
|
+
batchId: e.id,
|
|
536
|
+
bodies: e.records.map((e) => e.body)
|
|
537
|
+
}), this.onLoss("rejected", e.records, [e.id]), []);
|
|
538
|
+
}
|
|
539
|
+
}, X = [
|
|
540
|
+
"metrics",
|
|
541
|
+
"logs",
|
|
542
|
+
"traces"
|
|
543
|
+
];
|
|
544
|
+
function Z(e) {
|
|
545
|
+
let t = e.attributes[s];
|
|
546
|
+
return t === "metric" ? "metrics" : t === "span" ? "traces" : "logs";
|
|
547
|
+
}
|
|
548
|
+
function Q(e, t) {
|
|
549
|
+
return {
|
|
550
|
+
accepted: 0,
|
|
551
|
+
stored: e,
|
|
552
|
+
dropped: t - e
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
var ve = {
|
|
556
|
+
stored: "The send failed. The library stored the batch and sends it again later.",
|
|
557
|
+
split: "The send failed. The library stored the batch in two parts and sends them again later.",
|
|
558
|
+
rejected: "The send failed, and another send would fail too. The library drops the batch.",
|
|
559
|
+
not_stored: "The send failed, and storage did not keep the batch. The library drops the records that are not in storage.",
|
|
560
|
+
unknown: "The send failed. The library could not confirm that storage kept the batch. The library sends again only the records that are in storage."
|
|
561
|
+
}, ye = {
|
|
562
|
+
stored: "The server throttles requests. The pipeline stored the batch and did not send it.",
|
|
563
|
+
not_stored: "The server throttles requests, and storage did not keep the batch. The library drops the batch.",
|
|
564
|
+
unknown: "The server throttles requests. The library could not confirm that storage kept the batch. The library sends the batch later only if it is in storage."
|
|
565
|
+
}, $ = class {
|
|
566
|
+
constructor(e, t) {
|
|
567
|
+
A(this, "options", void 0), A(this, "onFlush", void 0), A(this, "pending", []), A(this, "timer", null), this.options = e, this.onFlush = t;
|
|
568
|
+
}
|
|
569
|
+
add(e) {
|
|
570
|
+
this.pending.push(e), this.pending.length >= this.options.batchSize ? this.onFlush(this) : this.arm();
|
|
571
|
+
}
|
|
572
|
+
take() {
|
|
573
|
+
this.clearTimer();
|
|
574
|
+
let e = this.pending;
|
|
575
|
+
return this.pending = [], e;
|
|
576
|
+
}
|
|
577
|
+
get size() {
|
|
578
|
+
return this.pending.length;
|
|
579
|
+
}
|
|
580
|
+
get records() {
|
|
581
|
+
return this.pending;
|
|
582
|
+
}
|
|
583
|
+
stop() {
|
|
584
|
+
this.clearTimer();
|
|
585
|
+
}
|
|
586
|
+
arm() {
|
|
587
|
+
if (this.timer !== null) return;
|
|
588
|
+
let e = setTimeout(() => {
|
|
589
|
+
this.timer = null, this.onFlush(this);
|
|
590
|
+
}, this.options.flushIntervalMs);
|
|
591
|
+
this.timer = e, M(e);
|
|
592
|
+
}
|
|
593
|
+
clearTimer() {
|
|
594
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
595
|
+
}
|
|
596
|
+
}, be = class {
|
|
597
|
+
release(e) {
|
|
598
|
+
for (let t of e) this.heldBytes -= this.held.get(t) ?? 0, this.held.delete(t);
|
|
599
|
+
}
|
|
600
|
+
evict() {
|
|
601
|
+
let e = this.queue.shift();
|
|
602
|
+
if (e) return this.open.delete(e), this.unconfirmed.delete(e.batch.id), this.release(e.batch.records), e.end = {
|
|
603
|
+
accepted: 0,
|
|
604
|
+
stored: 0,
|
|
605
|
+
dropped: e.batch.records.length
|
|
606
|
+
}, e.resolve(), this.onLoss("buffer_full", e.batch.records, [e.batch.id]), !0;
|
|
607
|
+
for (let e of Object.values(this.streams)) {
|
|
608
|
+
let t = e.take();
|
|
609
|
+
if (t.length) return this.release(t), this.onLoss("buffer_full", t), !0;
|
|
610
|
+
}
|
|
611
|
+
return !1;
|
|
612
|
+
}
|
|
613
|
+
admit(e) {
|
|
614
|
+
if (!this.policy) return !0;
|
|
615
|
+
let { maxPendingRecords: t, maxPendingBytes: n, overflow: r } = this.policy.buffering, i;
|
|
616
|
+
try {
|
|
617
|
+
i = T(JSON.stringify(e));
|
|
618
|
+
} catch {
|
|
619
|
+
return this.onLoss("unserializable", [e]), !1;
|
|
620
|
+
}
|
|
621
|
+
let a = () => t !== null && this.held.size >= t || n !== null && this.heldBytes + i > n, o = n === null || i <= n;
|
|
622
|
+
for (; o && a() && r === "drop-oldest" && this.evict(););
|
|
623
|
+
if (a()) {
|
|
624
|
+
if (r === "persist" && !this.persisting) {
|
|
625
|
+
this.persisting = !0;
|
|
626
|
+
let t = this.toBatch([e]);
|
|
627
|
+
this.diagnostics.guardAsync("storage.degraded", "Could not persist an overflow record.", async () => {
|
|
628
|
+
try {
|
|
629
|
+
await this.storage.save(t) && this.retry.nudge();
|
|
630
|
+
} finally {
|
|
631
|
+
this.persisting = !1;
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
} else this.onLoss("buffer_full", [e]);
|
|
635
|
+
return !1;
|
|
636
|
+
}
|
|
637
|
+
return this.held.set(e, i), this.heldBytes += i, !0;
|
|
638
|
+
}
|
|
639
|
+
constructor(e, t, n, r, i, a, o, s = () => void 0, c = () => void 0) {
|
|
640
|
+
A(this, "transport", void 0), A(this, "storage", void 0), A(this, "retry", void 0), A(this, "diagnostics", void 0), A(this, "routingContextId", void 0), A(this, "policy", void 0), A(this, "onLoss", void 0), A(this, "clockOffset", void 0), A(this, "streams", void 0), A(this, "unconfirmed", /* @__PURE__ */ new Map()), A(this, "queue", []), A(this, "open", /* @__PURE__ */ new Set()), A(this, "ceiling", new L()), A(this, "inFlight", 0), A(this, "pumpScheduled", !1), A(this, "stopped", !1), A(this, "paused", !1), A(this, "waiters", /* @__PURE__ */ new Set()), A(this, "held", /* @__PURE__ */ new Map()), A(this, "heldBytes", 0), A(this, "persisting", !1), this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r, this.routingContextId = a, this.policy = o, this.onLoss = s, this.clockOffset = c;
|
|
641
|
+
let l = (e) => {
|
|
642
|
+
this.claim(e);
|
|
643
|
+
};
|
|
644
|
+
this.streams = {
|
|
645
|
+
logs: new $(i.logs, l),
|
|
646
|
+
metrics: new $(i.metrics, l),
|
|
647
|
+
traces: new $(i.traces, l)
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
push(e) {
|
|
651
|
+
if (this.stopped) return;
|
|
652
|
+
e.observedTimeUnixNano = F();
|
|
653
|
+
let t = { ...e };
|
|
654
|
+
this.admit(t) && this.route(t);
|
|
655
|
+
}
|
|
656
|
+
drainForExit() {
|
|
657
|
+
let e = [...this.unconfirmed.values()].flatMap((e) => e.records);
|
|
658
|
+
return this.unconfirmed.clear(), this.held.clear(), this.heldBytes = 0, X.map((t) => this.toBatch([...e.filter((e) => Z(e) === t), ...this.streams[t].take()])).filter((e) => e !== null);
|
|
659
|
+
}
|
|
660
|
+
async flushPending(e) {
|
|
661
|
+
if (this.paused) return [];
|
|
662
|
+
if (!this.stopped) for (let e of X) this.claim(this.streams[e]);
|
|
663
|
+
let t = [...this.open], n, r = new Promise((e) => {
|
|
664
|
+
n = e;
|
|
665
|
+
});
|
|
666
|
+
this.waiters.add(n);
|
|
667
|
+
try {
|
|
668
|
+
let n = Promise.all(t.map((e) => e.done));
|
|
669
|
+
await Promise.race(e ? [
|
|
670
|
+
n,
|
|
671
|
+
r,
|
|
672
|
+
e
|
|
673
|
+
] : [n, r]);
|
|
674
|
+
} finally {
|
|
675
|
+
this.waiters.delete(n);
|
|
676
|
+
}
|
|
677
|
+
return t;
|
|
678
|
+
}
|
|
679
|
+
async flushUntil(e) {
|
|
680
|
+
let t = await this.flushPending(e), n = {
|
|
681
|
+
accepted: 0,
|
|
682
|
+
stored: 0,
|
|
683
|
+
dropped: 0,
|
|
684
|
+
pending: 0
|
|
685
|
+
};
|
|
686
|
+
for (let { batch: e, end: r } of t) r ? (n.accepted += r.accepted, n.stored += r.stored, n.dropped += r.dropped) : n.pending += e.records.length;
|
|
687
|
+
return n;
|
|
688
|
+
}
|
|
689
|
+
counts() {
|
|
690
|
+
let e = (e) => {
|
|
691
|
+
let t = 0;
|
|
692
|
+
for (let n of e) t += n.batch.records.length;
|
|
693
|
+
return t;
|
|
694
|
+
}, t = e(this.queue);
|
|
695
|
+
return {
|
|
696
|
+
pending: X.reduce((e, t) => e + this.streams[t].size, 0) + t,
|
|
697
|
+
inFlight: e(this.open) - t
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
hold(e) {
|
|
701
|
+
if (this.paused = e, e) for (let e of this.waiters) e();
|
|
702
|
+
else {
|
|
703
|
+
for (let e of X) this.claim(this.streams[e]);
|
|
704
|
+
this.schedulePump();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
isHeld() {
|
|
708
|
+
return this.paused;
|
|
709
|
+
}
|
|
710
|
+
records() {
|
|
711
|
+
return [...[...this.unconfirmed.values()].flatMap((e) => e.records), ...X.flatMap((e) => this.streams[e].records)];
|
|
712
|
+
}
|
|
713
|
+
discard() {
|
|
714
|
+
for (let e of this.queue) e.end = Q(0, e.batch.records.length);
|
|
715
|
+
let e = this.queue.flatMap((e) => e.batch.records), t = X.flatMap((e) => this.streams[e].take());
|
|
716
|
+
return this.destroy(), [...e, ...t];
|
|
717
|
+
}
|
|
718
|
+
destroy() {
|
|
719
|
+
this.stopped = !0, this.held.clear(), this.heldBytes = 0;
|
|
720
|
+
for (let e of X) this.streams[e].stop();
|
|
721
|
+
this.queue.length = 0;
|
|
722
|
+
for (let e of this.open) e.resolve();
|
|
723
|
+
this.open.clear();
|
|
724
|
+
}
|
|
725
|
+
toBatch(e) {
|
|
726
|
+
return e.length === 0 ? null : {
|
|
727
|
+
id: I(this.diagnostics),
|
|
728
|
+
records: e,
|
|
729
|
+
createdAt: Date.now(),
|
|
730
|
+
attempts: 0,
|
|
731
|
+
routingContextId: this.routingContextId?.(),
|
|
732
|
+
persistenceNamespace: this.policy?.storage.namespace
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
route(e) {
|
|
736
|
+
try {
|
|
737
|
+
let t = Z(e), n = this.streams[t];
|
|
738
|
+
if (t === "logs" && !this.ceiling.allow(e, this.policy?.sampling.errorCeiling, this.policy?.sampling.errorCeilingWindowMs, this.policy?.sampling.alwaysSampleFrom)) {
|
|
739
|
+
this.release([e]), this.diagnostics.count("record.dropped_by_ceiling");
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
let r = this.clockOffset();
|
|
743
|
+
r !== void 0 && t !== "metrics" && (e.attributes = {
|
|
744
|
+
...e.attributes,
|
|
745
|
+
[u]: r
|
|
746
|
+
}), n.add(e);
|
|
747
|
+
} catch (e) {
|
|
748
|
+
this.diagnostics.report("pipeline.crashed", "The pipeline dropped a record before it reached a stream.", void 0, e);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
claim(e) {
|
|
752
|
+
this.paused || this.enqueue(this.toBatch(e.take()));
|
|
753
|
+
}
|
|
754
|
+
enqueue(e) {
|
|
755
|
+
if (!e) return;
|
|
756
|
+
let t, n = {
|
|
757
|
+
batch: e,
|
|
758
|
+
done: new Promise((e) => {
|
|
759
|
+
t = e;
|
|
760
|
+
}),
|
|
761
|
+
resolve: t
|
|
762
|
+
};
|
|
763
|
+
this.unconfirmed.set(e.id, e), this.open.add(n), this.queue.push(n), this.schedulePump();
|
|
764
|
+
}
|
|
765
|
+
schedulePump() {
|
|
766
|
+
this.pumpScheduled || (this.pumpScheduled = !0, queueMicrotask(() => {
|
|
767
|
+
this.pumpScheduled = !1, this.pump();
|
|
768
|
+
}));
|
|
769
|
+
}
|
|
770
|
+
pump() {
|
|
771
|
+
if (!(this.stopped || this.paused)) for (; this.inFlight < (this.policy?.delivery.maxConcurrentRequests ?? 2);) {
|
|
772
|
+
let e = this.queue.shift();
|
|
773
|
+
if (!e) return;
|
|
774
|
+
this.inFlight++, this.run(e);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
async run(e) {
|
|
778
|
+
let { batch: t } = e;
|
|
779
|
+
try {
|
|
780
|
+
e.end = await this.dispatch(t);
|
|
781
|
+
} catch (e) {
|
|
782
|
+
this.diagnostics.report("pipeline.crashed", "A dispatch rejected its promise. This must not occur.", { batchId: t.id }, e);
|
|
783
|
+
} finally {
|
|
784
|
+
this.release(t.records), this.inFlight--, this.open.delete(e), e.resolve(), this.pump();
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
async dispatch(e) {
|
|
788
|
+
let t = e.records.length;
|
|
789
|
+
try {
|
|
790
|
+
let n = this.transport.throttledForMs(e);
|
|
791
|
+
if (n > 0) {
|
|
792
|
+
let r = await this.store(e);
|
|
793
|
+
return this.diagnostics.report("transport.throttled", ye[r], {
|
|
794
|
+
batchId: e.id,
|
|
795
|
+
records: t,
|
|
796
|
+
throttledMs: n
|
|
797
|
+
}), r === "unknown" ? void 0 : Q(r === "stored" ? t : 0, t);
|
|
798
|
+
}
|
|
799
|
+
try {
|
|
800
|
+
let n = await this.transport.send(e, () => {
|
|
801
|
+
this.unconfirmed.delete(e.id);
|
|
802
|
+
});
|
|
803
|
+
return {
|
|
804
|
+
accepted: t - n,
|
|
805
|
+
stored: 0,
|
|
806
|
+
dropped: n
|
|
807
|
+
};
|
|
808
|
+
} catch (n) {
|
|
809
|
+
if (this.stopped) return;
|
|
810
|
+
let r = await this.storeFailed({
|
|
811
|
+
...e,
|
|
812
|
+
attempts: e.attempts + 1
|
|
813
|
+
}, n);
|
|
814
|
+
return this.diagnostics.report("transport.http_error", ve[r?.outcome ?? "unknown"], {
|
|
815
|
+
batchId: e.id,
|
|
816
|
+
records: t
|
|
817
|
+
}, n), r ? Q(r.stored, t) : void 0;
|
|
818
|
+
}
|
|
819
|
+
} finally {
|
|
820
|
+
this.unconfirmed.delete(e.id);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
storeFailed(e, t) {
|
|
824
|
+
return this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", () => this.retry.storeFailed(e, t));
|
|
825
|
+
}
|
|
826
|
+
async store(e) {
|
|
827
|
+
let t = await this.diagnostics.guardAsync("storage.degraded", "The library could not store an undelivered batch.", async () => {
|
|
828
|
+
let t = await x(this.storage.save(e), h);
|
|
829
|
+
return t && this.retry.nudge(), t;
|
|
830
|
+
});
|
|
831
|
+
return t === void 0 ? "unknown" : t ? "stored" : "not_stored";
|
|
832
|
+
}
|
|
833
|
+
}, xe = class {
|
|
834
|
+
constructor(e, t = () => void 0) {
|
|
835
|
+
A(this, "transport", void 0), A(this, "onSent", void 0), A(this, "failures", 0), A(this, "failedAt", null), this.transport = e, this.onSent = t;
|
|
836
|
+
}
|
|
837
|
+
async send(e, t) {
|
|
838
|
+
let n = this.transport.lastSendAt(), r;
|
|
839
|
+
try {
|
|
840
|
+
r = await this.transport.send(e, t);
|
|
841
|
+
} catch (e) {
|
|
842
|
+
throw this.failures++, this.failedAt = Date.now(), e;
|
|
843
|
+
}
|
|
844
|
+
let i = this.transport.lastSendAt();
|
|
845
|
+
return i !== null && i !== n && (this.failures = 0, this.onSent(i)), r;
|
|
846
|
+
}
|
|
847
|
+
throttledForMs(e) {
|
|
848
|
+
return this.transport.throttledForMs(e);
|
|
849
|
+
}
|
|
850
|
+
stats() {
|
|
851
|
+
return {
|
|
852
|
+
lastFailureAt: this.failedAt,
|
|
853
|
+
consecutiveFailures: this.failures
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
}, Se = class e {
|
|
857
|
+
constructor(e, t, n, r, i, a, o) {
|
|
858
|
+
A(this, "storage", void 0), A(this, "retry", void 0), A(this, "pipeline", void 0), A(this, "exitFlush", void 0), A(this, "diagnostics", void 0), A(this, "transport", void 0), A(this, "outcomes", void 0), A(this, "retired", !1), A(this, "emergencyImport", Promise.resolve()), this.storage = e, this.retry = t, this.pipeline = n, this.exitFlush = r, this.diagnostics = i, this.transport = a, this.outcomes = o;
|
|
859
|
+
}
|
|
860
|
+
static async create(t) {
|
|
861
|
+
let { config: n, diagnostics: r } = t, i = t.storage ?? await re(n.storage.backend, te(n.storage.namespace), b(n.retention), r, t.onGap, n.storage.namespace);
|
|
862
|
+
t.onStorage?.(i), n.storage.requestPersistent && (i.name === "indexeddb" || i.name === "localstorage") && (t.onPersistence?.("pending"), B(r).then(t.onPersistence));
|
|
863
|
+
let a = new ee(i, n.securityContext, n.storage.namespace), o = (e) => {
|
|
864
|
+
let i = R(e, r);
|
|
865
|
+
i && z(t.remote, n, i);
|
|
866
|
+
}, s, c = (e) => {
|
|
867
|
+
s = e;
|
|
868
|
+
}, { onLoss: l } = t, u = !n.transport && n.transportWorker ? await r.guardAsync("transport.http_error", "The transport worker module did not load. The library uses HTTP.", async () => (await import("./worker-transport-JK-Fby9J.js")).createWorkerTransport(n, r, o, l, c)) : void 0, d = n.transport !== void 0 || u !== void 0 ? void 0 : new Y(n, r, o, l, c), f = u?.transport ?? d ?? new he(n, r, o, l, c), p = new xe(f, t.onSent), m = new _e(a, p, r, n, void 0, l), { batching: h } = n, g = new be(p, a, m, r, {
|
|
869
|
+
logs: {
|
|
870
|
+
flushIntervalMs: h.logFlushIntervalMs,
|
|
871
|
+
batchSize: h.logBatchSize
|
|
872
|
+
},
|
|
873
|
+
metrics: {
|
|
874
|
+
get flushIntervalMs() {
|
|
875
|
+
return n.metrics.intervalMs;
|
|
876
|
+
},
|
|
877
|
+
batchSize: h.metricBatchSize
|
|
878
|
+
},
|
|
879
|
+
traces: {
|
|
880
|
+
flushIntervalMs: h.logFlushIntervalMs,
|
|
881
|
+
batchSize: h.logBatchSize
|
|
882
|
+
}
|
|
883
|
+
}, () => n.securityContext.id || void 0, n, l, () => n.metadata.clockOffset ? s : void 0), _ = new W({
|
|
884
|
+
config: n,
|
|
885
|
+
diagnostics: r,
|
|
886
|
+
drainForExit: () => g.drainForExit(),
|
|
887
|
+
flushAlive: () => g.flushPending(),
|
|
888
|
+
exitHeaders: () => u ? u.exitHeaders() : d?.lastHeaders(),
|
|
889
|
+
keepaliveInFlight: () => u ? u.keepaliveInFlight() : d?.keepaliveInFlight(),
|
|
890
|
+
onLoss: l,
|
|
891
|
+
beforeExit: t.beforeExit
|
|
892
|
+
}), v = !1;
|
|
893
|
+
try {
|
|
894
|
+
_.install(), m.start(), v = !0;
|
|
895
|
+
} finally {
|
|
896
|
+
v || (_.uninstall(), m.stop());
|
|
897
|
+
}
|
|
898
|
+
let y = new e(a, m, g, _, r, f, p);
|
|
899
|
+
return y.emergencyImport = y.importEmergency(), y;
|
|
900
|
+
}
|
|
901
|
+
push(e) {
|
|
902
|
+
this.pipeline.push(e);
|
|
903
|
+
}
|
|
904
|
+
hold(e) {
|
|
905
|
+
this.pipeline.hold(e), e ? (this.exitFlush.uninstall(), this.retry.stop()) : (this.exitFlush.install(), this.retry.start());
|
|
906
|
+
}
|
|
907
|
+
records() {
|
|
908
|
+
return this.pipeline.records();
|
|
909
|
+
}
|
|
910
|
+
async flush() {
|
|
911
|
+
await this.pipeline.flushPending();
|
|
912
|
+
}
|
|
913
|
+
flushUntil(e) {
|
|
914
|
+
return this.pipeline.flushUntil(e);
|
|
915
|
+
}
|
|
916
|
+
async queueDepth() {
|
|
917
|
+
return await this.diagnostics.guardAsync("storage.degraded", "The library could not count the batches in storage.", () => this.storage.count()) ?? 0;
|
|
918
|
+
}
|
|
919
|
+
stats() {
|
|
920
|
+
return {
|
|
921
|
+
...this.pipeline.counts(),
|
|
922
|
+
...this.outcomes.stats(),
|
|
923
|
+
throttledUntil: this.transport.throttleEnd()
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
async destroy() {
|
|
927
|
+
await this.diagnostics.guardAsync("pipeline.crashed", "The flush before shutdown failed.", () => this.flush()), this.pipeline.isHeld() || this.exitFlush.flush("shutdown"), this.exitFlush.uninstall(), this.retry.stop(), this.transport.stop(), this.pipeline.destroy(), await this.storage.close();
|
|
928
|
+
}
|
|
929
|
+
async discard() {
|
|
930
|
+
this.retired = !0, this.exitFlush.uninstall(), this.retry.stop(), this.transport.stop();
|
|
931
|
+
let e = this.pipeline.discard();
|
|
932
|
+
return await this.emergencyImport, await this.storage.retire(!1), e;
|
|
933
|
+
}
|
|
934
|
+
async pause(e) {
|
|
935
|
+
this.retired = !0, this.exitFlush.uninstall(), this.retry.stop(), this.transport.stop();
|
|
936
|
+
let t = this.pipeline.drainForExit();
|
|
937
|
+
this.pipeline.destroy(), await this.emergencyImport, await this.keep(t, e);
|
|
938
|
+
}
|
|
939
|
+
async keep(e, t) {
|
|
940
|
+
for (let n of e) await this.storage.save({
|
|
941
|
+
...n,
|
|
942
|
+
routingContextId: t,
|
|
943
|
+
persistenceNamespace: this.storage.namespace
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
async retire(e, t, n) {
|
|
947
|
+
if (this.retired = !0, this.exitFlush.uninstall(), this.retry.stop(), e === "flush" && !this.pipeline.isHeld()) try {
|
|
948
|
+
await x(Promise.all([this.flush(), this.retry.flush()]), t);
|
|
949
|
+
} catch (e) {
|
|
950
|
+
this.diagnostics.report("transport.timeout", "The flush of the old security context did not complete before its time limit.", void 0, e);
|
|
951
|
+
}
|
|
952
|
+
this.retry.stop(), this.transport.stop();
|
|
953
|
+
let r = this.pipeline.drainForExit(), i = r.flatMap((e) => e.records);
|
|
954
|
+
this.pipeline.destroy(), await this.emergencyImport;
|
|
955
|
+
let a = await this.storage.take(2 ** 53 - 1);
|
|
956
|
+
e === "retain" && await this.keep(r, n);
|
|
957
|
+
let o = e === "discard" || e === "flush";
|
|
958
|
+
return await this.storage.retire(o), o && ne(n, this.diagnostics, this.storage.namespace), {
|
|
959
|
+
buffered: i,
|
|
960
|
+
stored: a
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
async adopt(e, t) {
|
|
964
|
+
for (let n of e) await this.storage.save({
|
|
965
|
+
...n,
|
|
966
|
+
attempts: 0,
|
|
967
|
+
routingContextId: t,
|
|
968
|
+
persistenceNamespace: this.storage.namespace
|
|
969
|
+
});
|
|
970
|
+
e.length > 0 && this.retry.nudge();
|
|
971
|
+
}
|
|
972
|
+
async importEmergency() {
|
|
973
|
+
let e = await this.diagnostics.guardAsync("storage.degraded", "The emergency import failed.", () => _(this.storage, this.diagnostics, (e) => this.storage.accepts(e), this.storage.namespace));
|
|
974
|
+
!this.retired && e !== void 0 && e > 0 && this.retry.nudge();
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
export { Se as Sender, V as a, K as i, Y as n, q as r, J as t };
|
|
978
|
+
|
|
979
|
+
//# sourceMappingURL=sender-Bdp-TAS4.js.map
|