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