@utk09/ui-observability 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +273 -102
  3. package/bin/uiobs.mjs +1 -1
  4. package/dist/{batch-CL9uWYY3.js → batch-BjQUwjA6.js} +4 -4
  5. package/dist/batch-BjQUwjA6.js.map +1 -0
  6. package/dist/{batch-C8OcWR2L.cjs → batch-D5LlU4Q9.cjs} +2 -2
  7. package/dist/batch-D5LlU4Q9.cjs.map +1 -0
  8. package/dist/bus/bus.d.ts +48 -47
  9. package/dist/bus/links.d.ts +4 -4
  10. package/dist/bus/validation.d.ts +1 -1
  11. package/dist/bus-D_7pd7RN.cjs +2 -0
  12. package/dist/bus-D_7pd7RN.cjs.map +1 -0
  13. package/dist/{bus-BZ0GldpT.js → bus-ecxUNTja.js} +91 -91
  14. package/dist/bus-ecxUNTja.js.map +1 -0
  15. package/dist/capture/console.d.ts +10 -10
  16. package/dist/capture/errors.d.ts +6 -6
  17. package/dist/capture/interactions.d.ts +14 -14
  18. package/dist/capture/lifecycle.d.ts +3 -3
  19. package/dist/capture/long-frames.d.ts +6 -6
  20. package/dist/capture/network.d.ts +17 -17
  21. package/dist/capture/profiler-frames.d.ts +44 -0
  22. package/dist/capture/replay-buffer.d.ts +46 -0
  23. package/dist/capture/replay-upload.d.ts +74 -0
  24. package/dist/capture/replay.d.ts +114 -0
  25. package/dist/capture/reports.d.ts +2 -2
  26. package/dist/capture/resource-timing.d.ts +1 -1
  27. package/dist/capture/server-timing.d.ts +3 -3
  28. package/dist/capture/storm.d.ts +3 -3
  29. package/dist/capture/types.d.ts +45 -33
  30. package/dist/capture/unclean-exit.d.ts +8 -8
  31. package/dist/capture/user-timing.d.ts +3 -3
  32. package/dist/capture/web-socket.d.ts +11 -11
  33. package/dist/capture/web-vitals.d.ts +20 -7
  34. package/dist/compression-AJJCMBOa.js +11 -0
  35. package/dist/compression-AJJCMBOa.js.map +1 -0
  36. package/dist/compression-lD9abCcO.cjs +2 -0
  37. package/dist/compression-lD9abCcO.cjs.map +1 -0
  38. package/dist/{console-BPZCuSLc.cjs → console-CLz_PvFn.cjs} +2 -2
  39. package/dist/console-CLz_PvFn.cjs.map +1 -0
  40. package/dist/{console-BeCF7n59.js → console-cwgHKXvM.js} +4 -4
  41. package/dist/console-cwgHKXvM.js.map +1 -0
  42. package/dist/constants-Bwl_YtQi.js +349 -0
  43. package/dist/constants-Bwl_YtQi.js.map +1 -0
  44. package/dist/constants-DakMxVB2.cjs +2 -0
  45. package/dist/constants-DakMxVB2.cjs.map +1 -0
  46. package/dist/constants.d.ts +150 -103
  47. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  48. package/dist/context-storage-BzkoHzkQ.js.map +1 -1
  49. package/dist/core/breadcrumbs.d.ts +16 -15
  50. package/dist/core/config.d.ts +3 -3
  51. package/dist/core/context.d.ts +7 -7
  52. package/dist/core/debug-buffer.d.ts +10 -10
  53. package/dist/core/debug-bundle.d.ts +3 -3
  54. package/dist/core/deferred.d.ts +2 -2
  55. package/dist/core/diagnostics.d.ts +24 -21
  56. package/dist/core/drops.d.ts +7 -7
  57. package/dist/core/hold-buffer.d.ts +1 -1
  58. package/dist/core/journey.d.ts +22 -23
  59. package/dist/core/logger.d.ts +22 -21
  60. package/dist/core/measure.d.ts +7 -7
  61. package/dist/core/meter.d.ts +25 -21
  62. package/dist/core/pipeline.d.ts +42 -41
  63. package/dist/core/profile-buckets.d.ts +31 -0
  64. package/dist/core/profiler.d.ts +218 -0
  65. package/dist/core/record.d.ts +23 -23
  66. package/dist/core/remote-rules.d.ts +4 -4
  67. package/dist/core/remote-sampling.d.ts +21 -20
  68. package/dist/core/runtime.d.ts +206 -137
  69. package/dist/core/sampling.d.ts +18 -18
  70. package/dist/core/sender.d.ts +22 -20
  71. package/dist/core/spans.d.ts +5 -5
  72. package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
  73. package/dist/deadline-C4ccAuk5.js.map +1 -0
  74. package/dist/deadline-CUGbto-y.cjs +2 -0
  75. package/dist/deadline-CUGbto-y.cjs.map +1 -0
  76. package/dist/{debug-bundle-C7UkHZ-q.js → debug-bundle-BOdYmCeV.js} +10 -3
  77. package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
  78. package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
  79. package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
  80. package/dist/doctor.cjs +1 -1
  81. package/dist/doctor.cjs.map +1 -1
  82. package/dist/doctor.d.ts +16 -6
  83. package/dist/doctor.js +147 -52
  84. package/dist/doctor.js.map +1 -1
  85. package/dist/{emergency-queue-Zy6lNafo.js → emergency-queue-B9WZxanZ.js} +4 -4
  86. package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
  87. package/dist/{emergency-queue-CNTRui5t.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
  88. package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
  89. package/dist/error-like-B11pB4aL.js.map +1 -1
  90. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  91. package/dist/{errors-Dh7kef0i.js → errors-D6bwgJtO.js} +3 -3
  92. package/dist/errors-D6bwgJtO.js.map +1 -0
  93. package/dist/{errors-tfEr48bS.cjs → errors-DCOCRdSi.cjs} +2 -2
  94. package/dist/errors-DCOCRdSi.cjs.map +1 -0
  95. package/dist/{factory-CJXVYp0R.cjs → factory-DLFDjdLv.cjs} +2 -2
  96. package/dist/factory-DLFDjdLv.cjs.map +1 -0
  97. package/dist/{factory-BonqI3NL.js → factory-e9Qo3K0z.js} +13 -13
  98. package/dist/factory-e9Qo3K0z.js.map +1 -0
  99. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  100. package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
  101. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  102. package/dist/global-scope-D9I8s-oN.js.map +1 -1
  103. package/dist/guards-Cidk71ME.js.map +1 -1
  104. package/dist/guards-nJ70syPt.cjs.map +1 -1
  105. package/dist/{identity-Cxgj6pZX.cjs → identity-BlvlgjrU.cjs} +2 -2
  106. package/dist/identity-BlvlgjrU.cjs.map +1 -0
  107. package/dist/{identity-DT5VmvXy.js → identity-BrQp_5J5.js} +19 -19
  108. package/dist/identity-BrQp_5J5.js.map +1 -0
  109. package/dist/index.cjs +1 -1
  110. package/dist/index.cjs.map +1 -1
  111. package/dist/index.d.ts +112 -79
  112. package/dist/index.js +783 -635
  113. package/dist/index.js.map +1 -1
  114. package/dist/{indexeddb-storage-CIoW21Xd.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
  115. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
  116. package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-DLXQzAGh.js} +4 -4
  117. package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
  118. package/dist/{interactions-DTgKy_6K.js → interactions-B6z2I4tU.js} +3 -3
  119. package/dist/interactions-B6z2I4tU.js.map +1 -0
  120. package/dist/{interactions-fEN6FbVo.cjs → interactions-P6pz08Jn.cjs} +2 -2
  121. package/dist/interactions-P6pz08Jn.cjs.map +1 -0
  122. package/dist/{journey-CuJrHzEg.js → journey-35yCMNFo.js} +20 -19
  123. package/dist/journey-35yCMNFo.js.map +1 -0
  124. package/dist/journey-DAGh5h9k.cjs +2 -0
  125. package/dist/journey-DAGh5h9k.cjs.map +1 -0
  126. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  127. package/dist/keys-BU9j5YqW.js.map +1 -1
  128. package/dist/{library-console-D2GY9Or6.cjs → library-console-BFWEuQsl.cjs} +2 -2
  129. package/dist/library-console-BFWEuQsl.cjs.map +1 -0
  130. package/dist/{library-console-C1m6g1BR.js → library-console-Dl_Ly6DQ.js} +2 -2
  131. package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
  132. package/dist/{library-request-1BX_UlaX.cjs → library-request-Da-CHKzT.cjs} +2 -2
  133. package/dist/library-request-Da-CHKzT.cjs.map +1 -0
  134. package/dist/{library-request-BQBT9N9Q.js → library-request-nI6pvI6I.js} +2 -2
  135. package/dist/library-request-nI6pvI6I.js.map +1 -0
  136. package/dist/{lifecycle-2EtUaRpo.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
  137. package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
  138. package/dist/{lifecycle-BaKx_-32.js → lifecycle-CZ6RRXc6.js} +2 -2
  139. package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
  140. package/dist/{log-record-i9zOTkpQ.cjs → log-record-D7bA1RPb.cjs} +2 -2
  141. package/dist/log-record-D7bA1RPb.cjs.map +1 -0
  142. package/dist/{log-record-CAoGBBf3.js → log-record-DIA6McNr.js} +2 -2
  143. package/dist/log-record-DIA6McNr.js.map +1 -0
  144. package/dist/{long-frames-Czk7IupC.js → long-frames-430_85Da.js} +8 -6
  145. package/dist/long-frames-430_85Da.js.map +1 -0
  146. package/dist/long-frames-Dd8tsi2U.cjs +2 -0
  147. package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
  148. package/dist/models/batch.d.ts +14 -15
  149. package/dist/models/bus.d.ts +24 -24
  150. package/dist/models/config.d.ts +402 -216
  151. package/dist/models/drop.d.ts +13 -11
  152. package/dist/models/health.d.ts +13 -13
  153. package/dist/models/log-record.d.ts +13 -14
  154. package/dist/models/metric.d.ts +82 -17
  155. package/dist/models/plugin.d.ts +13 -13
  156. package/dist/models/replay.d.ts +60 -0
  157. package/dist/models/serializer.d.ts +2 -3
  158. package/dist/models/stats.d.ts +2 -2
  159. package/dist/models/storage.d.ts +12 -11
  160. package/dist/{network-DBNwApoF.js → network-C7SkLf4v.js} +12 -12
  161. package/dist/network-C7SkLf4v.js.map +1 -0
  162. package/dist/{network-xbbuvG_6.cjs → network-pEX3PAJv.cjs} +2 -2
  163. package/dist/network-pEX3PAJv.cjs.map +1 -0
  164. package/dist/openfin-Bxelt0yg.js.map +1 -1
  165. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  166. package/dist/otlp-2MCrC3kd.cjs +2 -0
  167. package/dist/otlp-2MCrC3kd.cjs.map +1 -0
  168. package/dist/{otlp-BTJdIa6F.js → otlp-COq033e3.js} +25 -32
  169. package/dist/otlp-COq033e3.js.map +1 -0
  170. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  171. package/dist/patch-UdPz1ea8.js.map +1 -1
  172. package/dist/{platform-C2Ez5kDc.cjs → platform-12uR7kBQ.cjs} +2 -2
  173. package/dist/platform-12uR7kBQ.cjs.map +1 -0
  174. package/dist/{platform-DkcuXwe-.js → platform-CVewe4wQ.js} +7 -7
  175. package/dist/platform-CVewe4wQ.js.map +1 -0
  176. package/dist/profiler-BVWIOgnq.js +310 -0
  177. package/dist/profiler-BVWIOgnq.js.map +1 -0
  178. package/dist/profiler-eVCknCzS.cjs +2 -0
  179. package/dist/profiler-eVCknCzS.cjs.map +1 -0
  180. package/dist/profiler-frames-CLXlT_xL.js +86 -0
  181. package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
  182. package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
  183. package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
  184. package/dist/{remote-rules-Cfb4K-Nl.js → remote-rules-BJGDJGwA.js} +27 -27
  185. package/dist/remote-rules-BJGDJGwA.js.map +1 -0
  186. package/dist/{remote-rules-vzvk7aKf.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
  187. package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
  188. package/dist/replay-0zAJv9T3.js +338 -0
  189. package/dist/replay-0zAJv9T3.js.map +1 -0
  190. package/dist/replay-DomJpXqW.cjs +2 -0
  191. package/dist/replay-DomJpXqW.cjs.map +1 -0
  192. package/dist/{reports-Dk2YhKIh.cjs → reports-BsbqmP8h.cjs} +2 -2
  193. package/dist/reports-BsbqmP8h.cjs.map +1 -0
  194. package/dist/{reports-TA-zInnq.js → reports-BuXekPOS.js} +3 -3
  195. package/dist/reports-BuXekPOS.js.map +1 -0
  196. package/dist/{resource-timing-BLv3EA2A.js → resource-timing-CXGHwFRD.js} +4 -4
  197. package/dist/resource-timing-CXGHwFRD.js.map +1 -0
  198. package/dist/{resource-timing-Cysw1S1f.cjs → resource-timing-DkycFGDa.cjs} +2 -2
  199. package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
  200. package/dist/{sampling-Ckh2yW9k.cjs → sampling-Dd0wllyq.cjs} +2 -2
  201. package/dist/sampling-Dd0wllyq.cjs.map +1 -0
  202. package/dist/{sampling-C4VV-1MS.js → sampling-UUDbi3K0.js} +9 -9
  203. package/dist/sampling-UUDbi3K0.js.map +1 -0
  204. package/dist/{sanitize-6ymPlVvP.js → sanitize-CNmsD9r3.js} +2 -2
  205. package/dist/sanitize-CNmsD9r3.js.map +1 -0
  206. package/dist/{sanitize-BAWzkZt0.cjs → sanitize-ChLn97Ch.cjs} +2 -2
  207. package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
  208. package/dist/{select-ZF4by-lF.cjs → select-CTk-K5mG.cjs} +3 -3
  209. package/dist/select-CTk-K5mG.cjs.map +1 -0
  210. package/dist/{select-xtQaenIi.js → select-DPv_j6wq.js} +61 -61
  211. package/dist/select-DPv_j6wq.js.map +1 -0
  212. package/dist/{sender-CiMHC9YG.js → sender-15zEsZpr.js} +61 -60
  213. package/dist/sender-15zEsZpr.js.map +1 -0
  214. package/dist/sender-Bfpv9tad.cjs +2 -0
  215. package/dist/sender-Bfpv9tad.cjs.map +1 -0
  216. package/dist/storage/context-storage.d.ts +34 -33
  217. package/dist/storage/emergency-queue.d.ts +9 -9
  218. package/dist/storage/eviction.d.ts +12 -12
  219. package/dist/storage/factory.d.ts +8 -7
  220. package/dist/storage/gap.d.ts +6 -6
  221. package/dist/storage/idb-driver.d.ts +31 -32
  222. package/dist/storage/indexeddb-storage.d.ts +26 -27
  223. package/dist/storage/keys.d.ts +7 -7
  224. package/dist/storage/local-storage.d.ts +38 -38
  225. package/dist/storage/memory-storage.d.ts +21 -22
  226. package/dist/storage/persistence.d.ts +1 -1
  227. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  228. package/dist/storage-DZwed89z.js.map +1 -1
  229. package/dist/{storm-VR024_QN.js → storm-BTSNTIWI.js} +2 -2
  230. package/dist/storm-BTSNTIWI.js.map +1 -0
  231. package/dist/{storm-CYi9Swpx.cjs → storm-D0_qZOEg.cjs} +2 -2
  232. package/dist/storm-D0_qZOEg.cjs.map +1 -0
  233. package/dist/transport/compression.d.ts +2 -2
  234. package/dist/transport/errors.d.ts +7 -7
  235. package/dist/transport/exit-flush.d.ts +39 -39
  236. package/dist/transport/headers.d.ts +2 -2
  237. package/dist/transport/http-transport.d.ts +28 -27
  238. package/dist/transport/memory-transport.d.ts +6 -6
  239. package/dist/transport/retry-engine.d.ts +35 -34
  240. package/dist/transport/serializers/ecs.d.ts +1 -1
  241. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  242. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  243. package/dist/transport/serializers/otlp.d.ts +16 -16
  244. package/dist/transport/serializers/select.d.ts +7 -7
  245. package/dist/transport/status-transport.d.ts +20 -20
  246. package/dist/transport/worker-protocol.d.ts +3 -3
  247. package/dist/types-BAerHgCq.js.map +1 -1
  248. package/dist/types-C7WNpnG1.cjs.map +1 -1
  249. package/dist/{unclean-exit-DFUN57wY.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
  250. package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
  251. package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-Cob_jyTv.js} +2 -2
  252. package/dist/unclean-exit-Cob_jyTv.js.map +1 -0
  253. package/dist/unref-CU9Nyz_9.cjs +2 -0
  254. package/dist/unref-CU9Nyz_9.cjs.map +1 -0
  255. package/dist/unref-DgHPQeWv.js +7 -0
  256. package/dist/unref-DgHPQeWv.js.map +1 -0
  257. package/dist/user-timing-CdYqx3PF.cjs +2 -0
  258. package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
  259. package/dist/{user-timing-_jZIhDKI.js → user-timing-DgHubxCI.js} +5 -3
  260. package/dist/user-timing-DgHubxCI.js.map +1 -0
  261. package/dist/utils/console.d.ts +2 -2
  262. package/dist/utils/deadline.d.ts +4 -4
  263. package/dist/utils/error-like.d.ts +7 -7
  264. package/dist/utils/fixed-window.d.ts +9 -8
  265. package/dist/utils/global-scope.d.ts +8 -8
  266. package/dist/utils/guards.d.ts +2 -2
  267. package/dist/utils/identity.d.ts +17 -17
  268. package/dist/utils/library-console.d.ts +4 -4
  269. package/dist/utils/library-request.d.ts +10 -10
  270. package/dist/utils/lock.d.ts +10 -9
  271. package/dist/utils/openfin.d.ts +5 -5
  272. package/dist/utils/patch.d.ts +6 -6
  273. package/dist/utils/platform.d.ts +13 -11
  274. package/dist/utils/sanitize.d.ts +4 -4
  275. package/dist/utils/timer.d.ts +1 -1
  276. package/dist/utils/tracing.d.ts +38 -38
  277. package/dist/utils/unref.d.ts +3 -3
  278. package/dist/{web-socket-BWUoqBh8.cjs → web-socket-BTuvYoJI.cjs} +2 -2
  279. package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
  280. package/dist/{web-socket-CV7yIMnm.js → web-socket-DthJuSAg.js} +4 -4
  281. package/dist/web-socket-DthJuSAg.js.map +1 -0
  282. package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
  283. package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
  284. package/dist/web-vitals-CsGCWnUr.js +77 -0
  285. package/dist/web-vitals-CsGCWnUr.js.map +1 -0
  286. package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-B0_8rWy5.js} +4 -4
  287. package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
  288. package/dist/{worker-protocol-Bai7GAIA.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
  289. package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
  290. package/dist/worker-server-4en-Lt-3.cjs +2 -0
  291. package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
  292. package/dist/{worker-server-Dp5HYm4b.js → worker-server-Cne9MX9I.js} +8 -8
  293. package/dist/{worker-server-Dp5HYm4b.js.map → worker-server-Cne9MX9I.js.map} +1 -1
  294. package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
  295. package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
  296. package/dist/{worker-transport-D6jtgpqN.js → worker-transport-C3SjJAEC.js} +62 -61
  297. package/dist/worker-transport-C3SjJAEC.js.map +1 -0
  298. package/package.json +8 -2
  299. package/dist/batch-C8OcWR2L.cjs.map +0 -1
  300. package/dist/batch-CL9uWYY3.js.map +0 -1
  301. package/dist/bus-BZ0GldpT.js.map +0 -1
  302. package/dist/bus-VWlmM5xs.cjs +0 -2
  303. package/dist/bus-VWlmM5xs.cjs.map +0 -1
  304. package/dist/console-BPZCuSLc.cjs.map +0 -1
  305. package/dist/console-BeCF7n59.js.map +0 -1
  306. package/dist/constants-DqKJH_MP.cjs +0 -2
  307. package/dist/constants-DqKJH_MP.cjs.map +0 -1
  308. package/dist/constants-zyrqveN4.js +0 -304
  309. package/dist/constants-zyrqveN4.js.map +0 -1
  310. package/dist/deadline-BOjOxNHj.js.map +0 -1
  311. package/dist/deadline-XSnm95pg.cjs +0 -2
  312. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  313. package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
  314. package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
  315. package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
  316. package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
  317. package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
  318. package/dist/errors-Dh7kef0i.js.map +0 -1
  319. package/dist/errors-tfEr48bS.cjs.map +0 -1
  320. package/dist/factory-BonqI3NL.js.map +0 -1
  321. package/dist/factory-CJXVYp0R.cjs.map +0 -1
  322. package/dist/identity-Cxgj6pZX.cjs.map +0 -1
  323. package/dist/identity-DT5VmvXy.js.map +0 -1
  324. package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
  325. package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
  326. package/dist/interactions-DTgKy_6K.js.map +0 -1
  327. package/dist/interactions-fEN6FbVo.cjs.map +0 -1
  328. package/dist/journey-CuJrHzEg.js.map +0 -1
  329. package/dist/journey-pffMVMfa.cjs +0 -2
  330. package/dist/journey-pffMVMfa.cjs.map +0 -1
  331. package/dist/library-console-C1m6g1BR.js.map +0 -1
  332. package/dist/library-console-D2GY9Or6.cjs.map +0 -1
  333. package/dist/library-request-1BX_UlaX.cjs.map +0 -1
  334. package/dist/library-request-BQBT9N9Q.js.map +0 -1
  335. package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
  336. package/dist/lifecycle-BaKx_-32.js.map +0 -1
  337. package/dist/log-record-CAoGBBf3.js.map +0 -1
  338. package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
  339. package/dist/long-frames-BVg4i5SC.cjs +0 -2
  340. package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
  341. package/dist/long-frames-Czk7IupC.js.map +0 -1
  342. package/dist/network-DBNwApoF.js.map +0 -1
  343. package/dist/network-xbbuvG_6.cjs.map +0 -1
  344. package/dist/otlp-BDvFrLnc.cjs +0 -2
  345. package/dist/otlp-BDvFrLnc.cjs.map +0 -1
  346. package/dist/otlp-BTJdIa6F.js.map +0 -1
  347. package/dist/platform-C2Ez5kDc.cjs.map +0 -1
  348. package/dist/platform-DkcuXwe-.js.map +0 -1
  349. package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
  350. package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
  351. package/dist/reports-Dk2YhKIh.cjs.map +0 -1
  352. package/dist/reports-TA-zInnq.js.map +0 -1
  353. package/dist/resource-timing-BLv3EA2A.js.map +0 -1
  354. package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
  355. package/dist/sampling-C4VV-1MS.js.map +0 -1
  356. package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
  357. package/dist/sanitize-6ymPlVvP.js.map +0 -1
  358. package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
  359. package/dist/select-ZF4by-lF.cjs.map +0 -1
  360. package/dist/select-xtQaenIi.js.map +0 -1
  361. package/dist/sender-CiMHC9YG.js.map +0 -1
  362. package/dist/sender-D5wBoXA8.cjs +0 -2
  363. package/dist/sender-D5wBoXA8.cjs.map +0 -1
  364. package/dist/storm-CYi9Swpx.cjs.map +0 -1
  365. package/dist/storm-VR024_QN.js.map +0 -1
  366. package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
  367. package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
  368. package/dist/user-timing-C9kfRq3J.cjs +0 -2
  369. package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
  370. package/dist/user-timing-_jZIhDKI.js.map +0 -1
  371. package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
  372. package/dist/web-socket-CV7yIMnm.js.map +0 -1
  373. package/dist/web-vitals-Bq4WFHQo.js +0 -52
  374. package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
  375. package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
  376. package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
  377. package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
  378. package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
  379. package/dist/worker-server-BrIYkfoa.cjs +0 -2
  380. package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
  381. package/dist/worker-transport-Bwej4N2e.cjs +0 -2
  382. package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
  383. package/dist/worker-transport-D6jtgpqN.js.map +0 -1
package/README.md CHANGED
@@ -25,7 +25,9 @@ yarn add --exact @utk09/ui-observability
25
25
 
26
26
  ### Peer Dependencies
27
27
 
28
- Both peers are optional. The library has no runtime dependency.
28
+ Each peer is optional. The library has no runtime dependency.
29
+
30
+ Install `@rrweb/record` (`^2`) for the session replay, and set `replay.loader`. See [Session replay](#session-replay).
29
31
 
30
32
  Install `web-vitals` (`^4 || ^5 || ^6`) for `capture.webVitals`, and set `capture.webVitalsLoader`. Without the loader, the library reports `config.invalid`:
31
33
 
@@ -73,10 +75,10 @@ log.logAction("ORDER_SUBMIT", { orderId: "ORD-1001", qty: 100 });
73
75
  log.error("pricing call failed", caughtError);
74
76
  ```
75
77
 
76
- - `configure()` is idempotent. A later call updates an unlocked runtime singleton in place. Delivery/identity changes require `rotateSecurityContext()` by default. You cannot change `storage`, `identity`, `batching`, `retention`, `limits` or `journey.maxAgeMs` after startup. The library reports that change and ignores it.
78
+ - `configure()` is idempotent. A later call updates an unlocked runtime singleton in place. Delivery/identity changes require `rotateSecurityContext()` by default. You cannot change `storage`, `identity`, `batching`, `retention`, `limits`, `journey.maxAgeMs` or `profiler.maxProbes` after startup. The library reports that change and ignores it.
77
79
  - Call `configure()` from one context in each document. A second call changes `service.name` on the records of every other context. In a composed page, the shell calls `configure()`. Each microfrontend uses its own namespace.
78
80
  - You can call `getLogger()` at module top level, before `configure()`. The logger finds the runtime on its first write.
79
- - A write before the first `configure()` starts a runtime with default settings. It does not throw. The first `configure()` then sets `limits`, `journey.maxAgeMs`, `persistence.namespace` and an explicit `securityContext.id` of that runtime.
81
+ - A write before the first `configure()` starts a runtime with default settings. It does not throw. The first `configure()` then sets `limits`, `journey.maxAgeMs`, `profiler.maxProbes`, `persistence.namespace` and an explicit `securityContext.id` of that runtime.
80
82
  - After `shutdown()`, logging does nothing until the next `configure()`; health/stats remain inspectable.
81
83
 
82
84
  ### Console Only (No Network)
@@ -312,6 +314,10 @@ X-UiObs-Sampling: {"v":1,"ttlMs":600000,"defaultRate":0.1,"rates":{"blotter.grid
312
314
  | `timeSync(label, fn, attrs?)` | Times a function and emits a duration histogram with `status` `SUCCESS` or `FAILURE`. |
313
315
  | `timeAsync(label, fn, attrs?)` | Times a promise and emits a duration histogram with `status` `SUCCESS` or `FAILURE`. |
314
316
  | `startMeasure(name, attrs?)` | Times an operation with named phases. See [Measures](#measures). |
317
+ | `profiler.probe(name, options?)` | Gives a probe that times code spans with a small fixed cost. See [Profiler](#profiler). |
318
+ | `profiler.time(name, fn)` | Calls `fn` and times the call with the probe of the name. A promise result ends the span when it settles. See [Profiler](#profiler). |
319
+ | `startReplay()` | Starts the session replay recorder. With `replay.requireConsent`, nothing records before this call. See [Session replay](#session-replay). |
320
+ | `stopReplay()` | Stops the session replay recorder and drops each replay event that is not sent. |
315
321
 
316
322
  The level methods give records with `log.type: "log"`. Records of the library itself have `log.type: "system"`. `logMetric` drops a value that is not finite and counts `record.dropped_malformed`.
317
323
 
@@ -336,6 +342,129 @@ measure.end();
336
342
  - With `tracesEndpoint`, the measure is a span of kind INTERNAL with one child span for each phase. The outcome `"error"` marks the measure span and its open phase as failed.
337
343
  - A shutdown drops a measure that has no end. With isolation, a new delivery identity also drops it.
338
344
 
345
+ ### Profiler
346
+
347
+ `profiler.probe()` gives a probe that times a span that runs very often, for example a grid transaction, a sort or a render. `startMeasure()` makes a handle for each operation. A probe is one handle for all spans of its name. The profiler code makes no object for a `begin()` and `end()` pair, except one timer at the first value of each interval. The clock read of the platform can make one, for example in Node.js. The library sends one summary record for each probe at each interval, not one record for each span.
348
+
349
+ ```ts
350
+ configure({ profiler: { enabled: true } });
351
+
352
+ const probe = profiler.probe("grid.applyTransaction");
353
+
354
+ const token = probe.begin();
355
+ grid.applyTransaction(update);
356
+ probe.end(token);
357
+
358
+ // Add a duration from another source, in milliseconds.
359
+ probe.record(durationMs);
360
+
361
+ // Measure one span of each 10 spans.
362
+ const sort = profiler.probe("grid.sort", { sampleEvery: 10 });
363
+
364
+ // End the span after the next paint. A span longer than 16 ms adds a breadcrumb.
365
+ const render = profiler.probe("grid.render", { slowMs: 16 });
366
+ const renderToken = render.begin();
367
+ grid.render();
368
+ render.endAfterPaint(renderToken);
369
+
370
+ // Time one call of a function. A promise result ends the span when it settles.
371
+ const rows = await profiler.time("rows.fetch", () => fetchRows());
372
+
373
+ // A span that an await splits needs an async probe.
374
+ const load = profiler.probe("blotter.load", { async: true });
375
+ ```
376
+
377
+ - The profiler is off by default. While it is off, `begin()` returns `-1`. A probe then reads no clock.
378
+ - A probe stays valid across `configure()` and `shutdown()`. An app can make a probe before `configure()`. The same name gives the same probe. The first options of a name stay. A call never throws.
379
+ - A probe sums its durations for `profiler.flushIntervalMs`. The default is 10 seconds. Then the library sends one `ui.profile.duration` histogram record for each probe with data. `flush()`, `shutdown()`, `newSession()` and the exit flush also send the open interval.
380
+ - A record has the count, the sum, the minimum, the maximum and the buckets. Its attributes are `profile.probe`, `profile.sample_every`, `profile.p50`, `profile.p90`, `profile.p99`, `profile.self_p99` and `profile.overhead_ns`. See [Profile Attributes](docs/attributes.md#profile-attributes).
381
+ - The library counts each duration in a bucket, in whole microseconds. Each power of two has 16 buckets. Below 16 microseconds, a bucket is 1 microsecond wide. Above that, a bucket is at most 6.25 percent wide. The minimum and the maximum are exact. A duration above approximately 67 seconds counts in the last bucket. A record has at most 100 buckets. For a wider range of durations, the library merges adjacent buckets in the record.
382
+ - `sampleEvery: n` measures one span of each `n` spans. The probe uses a counter, not a random number. A span that the probe does not measure reads no clock. Its `begin()` returns `-1`. `record()` uses the same counter. The count in the record is the count of measured spans. A backend multiplies it by `profile.sample_every` for an estimate of all spans.
383
+ - A record of a probe with nested spans also has `profile.self_p99`. The self time of a span is its duration without the durations of the measured spans inside it. The library keeps the open spans on a stack of 32 levels. A span gets a self time when its `begin()` and `end()` run in nested order.
384
+ - A span with no `end()` call loses its stack level when a span around it ends, or when the stack is full. A span at level 33 clears the stack. The spans below it keep their durations and get no self time.
385
+ - `async: true` is for a probe with a span that an `await` splits. Its spans are not on the stack. They give the total time only. They take no time from the self time of another span. Without the option, the spans of other tasks count as spans inside the open span.
386
+ - `profiler.time(name, fn)` calls `fn` and times the call with the probe of the name. An error of `fn` goes to the caller. For a result with a `then` function, the span ends when the result settles. `time()` then returns the result of that `then` call, not the result of `fn`.
387
+ - `endAfterPaint(token)` ends the span in the first task after the next paint. The duration then includes the style, the layout and the paint of the browser. In a hidden page, or in a context with no `requestAnimationFrame`, it ends the span at once. A page that becomes hidden ends each span that waits. The span has no self time. `endAfterPaint()` and a `wrap()` call with a promise make a small number of objects.
388
+ - `slowMs` adds a breadcrumb for each span that is longer than the value. The breadcrumb has the category `profile` and a message such as `grid.render 48 ms`. The next error record carries it. Use a threshold that only a slow span passes, because each breadcrumb is an object.
389
+ - `profiler.framePhases: true` adds the phases of each long animation frame to each probe with a span of 1 ms or more in that frame. The library sends them as the histogram `ui.profile.frame.duration` with the attributes `profile.probe` and `profile.frame_phase`. The phases are `script`, `render`, `style_layout` and `forced_layout`. `forced_layout` is the layout time that a script forced with a read after a write. It is a part of the `script` phase.
390
+ - `framePhases` uses the last 256 spans of the probes that are not async. `capturePolicy.longFramesPerWindow` limits the frames in each window. A browser with no long animation frames reports `capture.install_failed` one time. `framePhases` is then off. Firefox and Safari are such browsers.
391
+ - `profiler.framePacing: true` measures the time between two frames with the probe `frame.interval`. The probe uses one of the `maxProbes` slots. The library runs one frame callback for each frame while the page is visible. The first frame after a hidden time gives no value.
392
+ - `framePhases` and `framePacing` load as a separate chunk. They need `profiler.enabled`.
393
+ - `profiler.maxProbes` is the maximum number of probes. The default is 64. The range is 1 to 1024. You cannot change it after startup. A probe above the limit does nothing. The library reports `config.invalid` one time for each start of the profiler. The diagnostics throttle can drop that report. The library then reports again each time it collects the profiler points, until one report passes the throttle. Each try adds 1 to the `config.invalid` counter.
394
+ - Each probe slot holds 2 times 368 bucket counts of 4 bytes, 4 numbers of 8 bytes and 2 numbers of 4 bytes. One slot is 2984 bytes. The library allocates one slot more than `maxProbes` when the profiler first turns on. The default of 64 probes uses 65 slots. That is 193,960 bytes.
395
+ - At the end of the first interval with data, the library measures the cost of one `begin()` and `end()` pair. The measurement runs one time. It blocks the thread for approximately 2 ms to 3 ms. Each record from that time has the result as `profile.overhead_ns`. The result is the cost of a pair in a short loop. A pair in app code can cost more or less. `flush()`, `shutdown()` and the exit flush do not run the measurement. A clock that is too coarse gives no value. The measurement can then block for longer.
396
+ - With `metricsEndpoint`, a record is an OTLP histogram point. Its point attributes are `profile.probe` and `profile.sample_every` only. The percentiles and the overhead value are on the log record and the ECS document only. A backend computes percentiles from the buckets.
397
+ - `processors` and `redact` apply to the `profile.*` attributes of the record. Use a small number of fixed probe names, because each name is one series.
398
+ - A rotation sends the open interval as records of the old context. With `securityContext.isolation` (the default), the values of the rotation add no value. Each span that is open at its end also adds no value. On a coarse clock, this includes a span that begins in the last clock tick of the rotation.
399
+ - A span that is open when `configure()` turns the profiler off adds no value. During a rotation, `shutdown()` and the exit flush do not send the open interval.
400
+ - A name that is not a string, or an empty name, gives a probe that does nothing. A `sampleEvery` value that is not an integer from 1 to 2147483647 uses 1. A `slowMs` value that is not a finite number of 0 or more adds no breadcrumb. An `async` value that is not a boolean uses `false`. Each of these reports `config.invalid` to the current runtime. A call before the first `configure()` reports nothing.
401
+ - A probe name stays for the life of the page. The library keeps at most 1024 names. The order of the `probe()` calls decides which probes are in the `maxProbes` limit.
402
+ - The clock of the platform limits the resolution of one span. A browser rounds `performance.now()`, for example to 0.1 ms or to 1 ms. A span shorter than one clock step reads 0 or one step.
403
+ - Give `end()` only the token of `begin()`. `end(-1)` does nothing. Another token that is not a number, is below 0 or gives a negative duration adds no value. While the profiler is on, the library counts that token as `record.dropped_malformed`.
404
+
405
+ ### Session replay
406
+
407
+ The session replay records the DOM of the page with the recorder of your app, [`@rrweb/record`](https://rrweb.com/docs/guide). The library keeps the recent events in memory. After an ERROR or FATAL record, it sends them in segments to a separate endpoint. A person can then watch what the user saw before the error.
408
+
409
+ ```ts
410
+ configure({
411
+ replay: {
412
+ enabled: true,
413
+ endpoint: "https://replay.example/v1/replay",
414
+ // Your app owns the import. The library has no recorder of its own.
415
+ loader: () => import("@rrweb/record"),
416
+ },
417
+ });
418
+ ```
419
+
420
+ - The replay is off by default. `@rrweb/record` is an optional peer. An app with the replay off does not need it.
421
+ - The buffer keeps the last `replay.bufferMs` (60 seconds by default), and at most 1.5 times that. The recorder takes a full snapshot at each half of that time. `replay.maxBufferBytes` limits the buffer. Above it, the buffer drops its oldest part and reports `capture.rate_limited` at the next upload.
422
+ - An ERROR or FATAL record starts an upload. The library sends the buffer, then each new event for `replay.afterErrorMs`. An error in that time is a part of the same upload and does not extend the time. `replay.uploadsPerWindow` limits the uploads in each window of `capturePolicy.windowMs`. A stream of errors then cannot upload the full session. An upload always starts with a full snapshot. For an empty buffer, the library takes a new one.
423
+ - The library sends the events in segments. A segment closes at `replay.batchSize` events, at `replay.batchBytes` or after `replay.flushIntervalMs`. One event that is larger than `batchBytes` is a segment of its own. A full snapshot of a large page is such an event.
424
+ - One segment is in flight at a time. A failed send has `replay.maxAttempts` attempts, with the wait of `delivery.retryBaseDelayMs` and `delivery.retryMaxDelayMs`. `delivery.requestTimeoutMs` limits each request. The segments that wait have the limit `replay.maxQueueBytes`. A segment is only in memory. The exit flush sends no segment.
425
+ - The request has the headers of `replay.headers`, an object or a function. It does not have the `headers` of the log endpoint, because that token can be for another host. `credentials` applies to the replay request also.
426
+ - `replay.maxBufferBytes`, `replay.batchBytes` and `replay.maxQueueBytes` count the length of the JSON text. A text with a character above U+00FF uses 2 bytes of memory for each character.
427
+ - Each segment has `replay.id`, `session.id`, `tab.id`, `service.name` and a `sequence` number. Each record has the attribute `replay.id` while the recorder runs. Use it to find the replay of a log record.
428
+ - `replay.onSegment` gets each segment in place of the request. Use it for your own transport. A call that does not end in `delivery.requestTimeoutMs` drops the segment. If the function sends a request, add its URL to `capture.ignoreUrls`. Without that, a failed request gives an error record, and that record gives a new upload.
429
+ - **Privacy.** The recorder masks the text of each element. It masks the value of each `input`, `textarea` and `select`, also of a hidden input and a file input. A masked value is `********`. A masked text keeps the length of each word. The text in an element with the attribute `data-observability-unmask` stays. `replay.maskSelectors` is a list of CSS selectors with text that is always masked. `replay.blockSelectors` is a list of CSS selectors of elements that the recorder does not record. A password input is always masked. `redact` and `processors` do not apply to a replay event.
430
+ - **What stays in clear text.** The recorder does not mask an attribute value, for example `title`, `alt`, `placeholder`, `aria-label`, `data-*`, `id` and `class`. It does not mask the `value` of a checkbox, a radio button, a button and an `<option>`. It does not mask a URL in `href` or `src` with its query, the CSS text, the content of a `<meta>` element and a comment. It records the mouse positions and the scroll positions. The library removes the query of the page URL unless `capture.fullUrls` is set. Block an element with `replay.blockSelectors` when one of these can identify a person or an account.
431
+ - Do not put `data-observability-unmask` on an element that shows content from a user. That content can then add text that stays in clear text. With `replay.maskText: false`, a `maskSelectors` entry does not reach an element inside a shadow root.
432
+ - A `maskSelectors` or `blockSelectors` entry that is not valid CSS reports `config.invalid`. The replay then does not start, because a missing mask shows text that you wanted to hide.
433
+ - With `replay.requireConsent: true`, nothing records before `startReplay()`. `stopReplay()` stops the recorder, stops the request in flight and drops each event that is not sent. The recorder then stays off until the next `startReplay()`, also after a later `configure()`.
434
+ - `newSession()` and `rotateSecurityContext()` drop the buffer and start a new recording with a new `replay.id`. The next user of a shared device does not get the page of the previous user.
435
+ - A change of another capture setting in `configure()` keeps the recording and its buffer. A change of `replay.endpoint`, a mask setting, a selector list, `recordCanvas`, `bufferMs`, `requireConsent`, `capture.fullUrls` or `capture.ignoreUrls` starts a new recording with a new `replay.id` and drops the buffer. The batch settings, the limits and `replay.headers` apply to the recording that runs. See [Runtime policies](docs/runtime-policies.md).
436
+ - `replay.recordOptions` gives other options to the recorder. The library accepts `sampling`, `slimDOMOptions`, `ignoreClass`, `ignoreSelector`, `ignoreCSSAttributes`, `userTriggeredOnInput`, `recordAfter`, `inlineStylesheet` and `dataURLOptions`. It sets each mask, block, canvas, plugin and event option itself. It ignores another key and reports `config.invalid`.
437
+ - The recorder reads each DOM change. A change of many nodes costs time and memory. Block a large list with `replay.blockSelectors` when its content is not necessary in the replay.
438
+
439
+ `replay.plugins` is a list of functions that make the record plugins of the recorder. Your app owns each import.
440
+
441
+ ```ts
442
+ configure({
443
+ replay: {
444
+ plugins: [
445
+ async () =>
446
+ (await import("@rrweb/rrweb-plugin-sequential-id-record")).getRecordSequentialIdPlugin(),
447
+ async () =>
448
+ (await import("@rrweb/rrweb-plugin-console-record")).getRecordConsolePlugin({
449
+ level: ["warn", "error"],
450
+ }),
451
+ async ({ transformRequest }) =>
452
+ (await import("@rrweb/rrweb-plugin-network-record")).getRecordNetworkPlugin({
453
+ recordHeaders: false,
454
+ recordBody: false,
455
+ transformRequestFn: transformRequest,
456
+ }),
457
+ ],
458
+ },
459
+ });
460
+ ```
461
+
462
+ - The sequential id plugin numbers each event. A server can then find a lost event.
463
+ - The console plugin and the network plugin wrap the same functions as the console capture and the network capture of the library. Both pairs work together. A plugin event does not pass through `redact`. Do not record headers or bodies unless you mask them in the options of the plugin.
464
+ - Give `transformRequest` to the network plugin. It skips each request to a URL in `capture.ignoreUrls`. That list has each endpoint of the library, also `replay.endpoint`. Without it, an upload gives a new event, and that event gives a new upload. It also removes the query of a URL unless `capture.fullUrls` is set.
465
+ - The network plugin gives its event some time after the request. An upload directly after a request does not have that event.
466
+ - A new `loader` function, `onSegment` function, `recordOptions` object or plugin function in `configure()` starts a new recording and drops the buffer. The library compares the references. Keep them stable, and do not make a new function or object in each `configure()` call.
467
+
339
468
  ### Context & Correlation
340
469
 
341
470
  | Function | Description |
@@ -375,90 +504,92 @@ See [runtime policies, operational budgets and migration](docs/runtime-policies.
375
504
 
376
505
  ## Configuration Options
377
506
 
378
- No key is required. Set `endpoint` to send records. A value of the wrong type or outside its range reports `config.invalid`. The value in force stays. Level names can have any case. You cannot change `batching` and `retention` after the delivery stack loads. You cannot change `limits` and `journey.maxAgeMs` after the first `configure()`. [Runtime policies](docs/runtime-policies.md) gives each default and range of the policy sections.
379
-
380
- | Key | Default | Description |
381
- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
382
- | `endpoint` | `""` | HTTP endpoint that receives the batches. `null` selects console-only mode. `""` reports `config.invalid`. |
383
- | `metricsEndpoint` | `""` | OTLP metrics endpoint, for example `https://ingest.example/v1/metrics`. With it, each batch of metric records goes there as an OTLP `ExportMetricsServiceRequest`. Without it, metric records are log records on `endpoint`. It needs `serializer: "otlp"`, and `endpoint` or `transport`. |
384
- | `tracesEndpoint` | `""` | OTLP traces endpoint, for example `https://ingest.example/v1/traces`. With it, the library records spans and sends them there as an OTLP `ExportTraceServiceRequest`. Without it, the library sends no span. It needs `serializer: "otlp"`, and `endpoint` or `transport`. See [Spans](#spans). |
385
- | `serviceName` | `""` | `service.name` on every record. |
386
- | `serviceVersion` | `""` | `service.version` on every record. |
387
- | `environment` | `""` | `deployment.environment` on every record. |
388
- | `enabled` | `true` | Set `false` to stop all logging. Every log call then does nothing. |
389
- | `payloadMode` | `"copy"` | `"defer"` keeps payload references until idle time. The debug buffer always builds records at the call. |
390
- | `minLevel` | `"INFO"` | Lowest level that the library sends (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`). It does not drop actions and metrics. |
391
- | `minLevels` | `{}` | Lowest level for each namespace prefix, for example `{ "trading.ticks": "DEBUG" }`. The longest matching prefix wins. A prefix matches its own namespace and the namespaces below it after a dot. A namespace with no match uses `minLevel`. A new map replaces the map in force. |
392
- | `compression` | `"gzip"` | `gzip` or `none`. The library compresses a payload above 1 KB only. |
393
- | `serializer` | `"otlp"` | `otlp`, `ecs`, or a custom `LogSerializer`. `ecs` writes ECS 8.10 NDJSON. It maps `app.namespace` to `log.logger`, `error.type`, `error.message` and `error.stack_trace` to `error.*`, and `log.type` to `event.kind`. The other attributes go to `labels`. |
394
- | `credentials` | `"omit"` | Fetch credentials mode. Set `"include"` for cookie auth. |
395
- | `headers` | `{}` | Static headers, or a function that returns them. After a 401 or 403, a function gets one more call and the batch one more send. The exit flush sends the last headers. Before a function gives its first result, the exit flush puts the batch in the emergency queue. `headers: undefined` removes the headers. |
396
- | `storage` | `"auto"` | Store for undelivered batches: `auto`, `indexeddb`, `localstorage`, `memory` or `none`. Fixed at startup. |
397
- | `identity` | `"storage"` | Store for session, tab and journey ids. `memory` writes no key. Fixed at startup. |
398
- | `sampling.defaultRate` | `1` | Keep rate for a namespace with no rule. |
399
- | `sampling.rates` | `{}` | Keep rate per namespace. The longest matching prefix wins. |
400
- | `sampling.alwaysSampleTypes` | `["action"]` | Record types that ignore the rate. |
401
- | `sampling.alwaysSampleFrom` | `"ERROR"` | Lowest level that ignores the rate. `capturePolicy.errorCeiling` limits these log records. |
402
- | `sampling.remote` | `false` | Reads sampling rules from the `X-UiObs-Sampling` header of each accepted batch (see Remote Sampling). |
403
- | `sampling.remoteMaxRate` | `1` | Highest rate that a remote rule can set. It applies to the remote `defaultRate` and to each remote namespace rate. |
404
- | `bus.mode` | `"auto"` | `auto`, `sender`, `forwarder` or `off`. With `off`, this context sends its own records and opens no link. A same-origin child frame that the page registers can still forward to it. |
405
- | `bus.trustedOrigins` | `[]` | Origins of other documents that this document trusts. A cross-origin child frame forwards its records only to a parent on these origins. With `bus.sourcePolicy: "trusted-origin"`, a parent also accepts records from a child frame on these origins. With the default policy, use `registerFrame()`. The library keeps the origin of each URL. For a sandboxed frame, set `bus.mode: "sender"` in the frame. A trusted origin is also trusted for metric points. Its points bypass the sampling and the limit of 100 attribute sets of this document. |
406
- | `bus.sourcePolicy` | `"registered"` | `registered` accepts only the frames and workers that the page registers. `trusted-origin` also accepts each frame on the page origin or in `bus.trustedOrigins`. |
407
- | `bus.validation` | `"strict"` | `strict` checks the fields of each bus message. `envelope` checks the envelope only. |
408
- | `bus.maxMessageBytes`, `bus.maxRecordsPerMessage`, `bus.maxMessagesPerSecond`, `bus.maxTrackedSources` | `262144`, `100`, `100`, `256` | Bus budgets for each message and each source. `0` turns a limit off. |
409
- | `bus.openFinRole` | `"auto"` | `auto`, `provider` or `client`. |
410
- | `journey.scope` | `"auto"` | Which contexts adopt a journey. `context`: each context keeps its own. `tab`: a frame or a worker adopts the journey of its owner. `origin`: each context of the origin, also in other tabs. `auto` is `origin` in OpenFin and `tab` in a browser. |
411
- | `journey.maxAgeMs` | `1800000` | Maximum open time of a journey, in milliseconds. Then the library ends it. The range is 60000 to 86400000. |
412
- | `batching.logFlushIntervalMs` | `2000` | Maximum wait of a partial log batch, in milliseconds. The range is 100 to 60000. |
413
- | `batching.logBatchSize` | `100` | Maximum records in one log batch. The range is 1 to 1000. |
414
- | `batching.metricFlushIntervalMs` | `10000` | Maximum wait of a partial metric batch, in milliseconds. The range is 100 to 60000. |
415
- | `batching.metricBatchSize` | `500` | Maximum records in one metric batch. The range is 1 to 1000. |
416
- | `retention.mode` | `"limited"` | `limited` or `until-delivered`. With `until-delivered`, a stored batch has no age limit and no attempt limit. `retention.maxBatches` still applies. A permanent error still drops the batch. A batch that always gets a temporary error stays first. The batches of the same endpoint behind it wait. |
417
- | `retention.maxBatches` | `500` | Maximum stored batches. A new batch evicts the oldest batch without an action first. The range is 1 to 5000. |
418
- | `retention.maxAgeMs` | `86400000` | Maximum age of a stored batch, in milliseconds. The range is 60000 to 604800000. |
419
- | `retention.maxAttempts` | `5` | Maximum send attempts of a stored batch. The range is 1 to 20. |
420
- | `limits.maxBodyChars` | `4096` | Maximum body length, in characters. The range is 256 to 65536. |
421
- | `limits.maxAttributeChars` | `8192` | Maximum length of a string attribute, in characters. The range is 256 to 65536. |
422
- | `limits.maxAttributeCount` | `128` | Maximum keys in one object. The range is 1 to 1024. |
423
- | `limits.maxStackChars` | `8192` | Maximum length of an error stack, in characters. The range is 256 to 65536. |
424
- | `limits.maxDepth` | `6` | Maximum depth of a nested value. The range is 1 to 16. |
425
- | `limits.maxArrayLength` | `100` | Maximum items in one array, set or map. The range is 1 to 10000. |
426
- | `limits.maxNodes` | `10000` | Maximum values in one sanitize pass. The range is 100 to 100000. |
427
- | `limits.maxRecordBytes` | `32768` | Maximum attribute bytes of one record. Above it, the library drops the caller attributes. The range is 1024 to 60000. |
428
- | `securityContext.id` | Generated | Delivery identity of this runtime. Supply a stable opaque id to send stored batches after a reload. Do not put secrets or personal data in it. |
429
- | `securityContext.isolation` | `true` | Keeps the stored batches of each identity apart. Delivery changes then need `rotateSecurityContext()`. |
430
- | `lockConfiguration` | `false` | Refuses changes through `configure()`. Identical repeated settings are accepted. `setConfigurationLocked(false)` unlocks. |
431
- | `loggerCache.maxEntries` | `256` | LRU limit of cached loggers. `0` turns the cache off. `null` sets no limit. |
432
- | `delivery` | See policies | Request timeout, request concurrency, retry delays, batches in one retry pass and fetch priority (`"low"` by default). |
433
- | `buffering` | 10,000 records, 16 MiB, `"drop-oldest"` | Limits of the live buffers, and the overflow rule. |
434
- | `debugBuffer` | `{ enabled: false, maxRecords: 200, maxAgeMs: 60000 }` | Keeps the records that `minLevel` or sampling drops. An ERROR or FATAL record of this context sends them first, with `uiobs.debug_buffer: true`. A later change of `redact` or `processors` empties the buffer. |
435
- | `metrics` | See policies | Limits of instrument names, attribute sets and histogram boundaries. |
436
- | `correlation` | See policies | Session idle time, session write interval and trace age. Fixed at startup. |
437
- | `capturePolicy` | See policies | Breadcrumb capacity, error duplicate check, capture rate limits and the error ceiling. |
438
- | `diagnostics` | `{ throttleMs: 1000, consoleFallback: false, records: false }` | Report interval of each diagnostic code, and the console fallback when `onDiagnostic` throws. `records: true`, or a list of codes, also sends each report as a record in the namespace `uiobs.diagnostics`. |
439
- | `persistence.namespace` | `""` | Separates the batch stores, the emergency queue and the retry locks of one application. Fixed at startup. |
440
- | `persistence.requestPersistent` | `false` | Asks the browser to keep the stored batches under storage pressure. Firefox can show a prompt. `getHealth()` reports the answer. Fixed at startup. |
441
- | `metadata` | All `true` | `pageUrl`, `userAgent` and `openfin` include `page.url`, `browser.user_agent` and the OpenFin fields. `clockOffset` adds `uiobs.clock_offset_ms` to logs and spans. |
442
- | `capture` | See below | Auto-capture settings. |
443
- | `capture.remoteToggles` | `[]` | Capture switches that remote rules can change for their TTL. Requires `sampling.remote`. Privacy controls stay local. |
444
- | `capture.serverTiming` | `false` | Adds Server-Timing response entries to fetch and XHR records. Links a valid traceparent entry to the client span. |
445
- | `capture.reports` | `false` | Records deprecations, interventions and CSP reports as WARN `ui.report`. |
446
- | `capture.resourceTiming` | `false` | Records `ui.resource.duration` by initiator type and host. Accepts `true` or an object with `slowMs`. |
447
- | `capture.resourceTiming.slowMs` | `1000` | Minimum duration of a `ui.resource.slow` event, in milliseconds. Set `0` for no slow events. |
448
- | `capture.lifecycle` | `false` | Records visible, hidden, frozen, resumed and restored states with the duration of the previous state. |
449
- | `capturePolicy.reportsPerWindow` | `20` | Maximum browser reports in each capture window. Set `0` for no limit. |
450
- | `capturePolicy.resourcesPerWindow` | `100` | Maximum resource entries in each capture window. Set `0` for no limit. |
451
- | `capturePolicy.lifecyclePerWindow` | `20` | Maximum lifecycle events in each capture window. Set `0` for no limit. |
452
- | `console` | `false` | Prints records to devtools. `true` prints from `DEBUG` up. A level name prints from that level up. An object sets `level` and `styles` (see Console Output). It does not depend on `minLevel`. |
453
- | `transport(request)` | `undefined` | Sends batches through a channel of your app in place of HTTP (see Custom Transport). |
454
- | `transportWorker()` | `undefined` | Creates a dedicated HTTP worker. It calls `serveTransportWorker()`. Retry, storage, header functions and exit sends stay on the main thread. |
455
- | `transportOnExit(request)` | `undefined` | Sends the last batch while the page closes. It must return a boolean and must not wait. |
456
- | `otelLoader()` | `undefined` | Loads `@opentelemetry/api`. Without it, OTel is off. |
457
- | `contextProvider()` | `undefined` | Returns attributes for each built record, including console/breadcrumb-only candidates, for example the current route. Its values override `setContext()` values. The logger scope and the call payload override its values. Keep it fast and synchronous. A provider that throws reports `handler.threw`. A value that is not an object reports `config.invalid`. The record is still built. |
458
- | `processors` | `[]` | Functions that change or drop a record. They run in list order, before `redact`. A processor has the contract of `redact`. Return the record or a new record to keep it, or `null` to drop it. If a processor throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_processor`. A new list replaces the list in force. |
459
- | `redact(record)` | `undefined` | Changes a record before the library sends or prints it, including console-only candidates. Return `null` to drop the record. If the hook throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_redact`. The sender also runs its `redact` on each record from a frame or a worker. A record that the child already redacted then runs through `redact` again. Write `redact` so that a second run gives the same result. |
460
- | `onDiagnostic(event)` | `undefined` | Receives the faults of the library itself. |
461
- | `onDrop(summary)` | `undefined` | Receives a summary when the library loses records that it built. The summary has `reason`, `records`, `batchIds`, `journeyIds` and `actions`. Sampling, `minLevel`, `processors` and `redact` do not cause a loss. Do not log through the library in the hook. A record from the hook can evict a stored batch. A batch that storage evicts during its send can still reach the server. |
507
+ No key is required. Set `endpoint` to send records. A value of the wrong type or outside its range reports `config.invalid`. The current value stays. Level names can have any case. You cannot change `batching` and `retention` after the delivery stack loads. You cannot change `limits`, `journey.maxAgeMs` and `profiler.maxProbes` after the first `configure()`. [Runtime policies](docs/runtime-policies.md) gives each default and range of the policy sections.
508
+
509
+ | Key | Default | Description |
510
+ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
511
+ | `endpoint` | `""` | HTTP endpoint that receives the batches. `null` selects console-only mode. `""` reports `config.invalid`. |
512
+ | `metricsEndpoint` | `""` | OTLP metrics endpoint, for example `https://ingest.example/v1/metrics`. With it, each batch of metric records goes there as an OTLP `ExportMetricsServiceRequest`. Without it, metric records are log records on `endpoint`. It needs `serializer: "otlp"`, and `endpoint` or `transport`. |
513
+ | `tracesEndpoint` | `""` | OTLP traces endpoint, for example `https://ingest.example/v1/traces`. With it, the library records spans and sends them there as an OTLP `ExportTraceServiceRequest`. Without it, the library sends no span. It needs `serializer: "otlp"`, and `endpoint` or `transport`. See [Spans](#spans). |
514
+ | `serviceName` | `""` | `service.name` on every record. |
515
+ | `serviceVersion` | `""` | `service.version` on every record. |
516
+ | `environment` | `""` | `deployment.environment` on every record. |
517
+ | `enabled` | `true` | Set `false` to stop all logging. Every log call then does nothing. |
518
+ | `payloadMode` | `"copy"` | `"defer"` keeps payload references until idle time. The debug buffer always builds records at the call. |
519
+ | `minLevel` | `"INFO"` | Lowest level that the library sends (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`). It does not drop actions and metrics. |
520
+ | `minLevels` | `{}` | Lowest level for each namespace prefix, for example `{ "trading.ticks": "DEBUG" }`. The longest matching prefix wins. A prefix matches its own namespace and the namespaces below it after a dot. A namespace with no match uses `minLevel`. A new map replaces the current map. |
521
+ | `compression` | `"gzip"` | `gzip` or `none`. The library compresses a payload above 1 KB only. |
522
+ | `serializer` | `"otlp"` | `otlp`, `ecs`, or a custom `LogSerializer`. `ecs` writes ECS 8.10 NDJSON. It maps `app.namespace` to `log.logger`, `error.type`, `error.message` and `error.stack_trace` to `error.*`, and `log.type` to `event.kind`. The other attributes go to `labels`. |
523
+ | `credentials` | `"omit"` | Fetch credentials mode. Set `"include"` for cookie auth. |
524
+ | `headers` | `{}` | Static headers, or a function that returns them. After a 401 or 403, a function gets one more call and the batch one more send. The exit flush sends the last headers. Before a function gives its first result, the exit flush puts the batch in the emergency queue. `headers: undefined` removes the headers. |
525
+ | `storage` | `"auto"` | Store for undelivered batches: `auto`, `indexeddb`, `localstorage`, `memory` or `none`. Fixed at startup. |
526
+ | `identity` | `"storage"` | Store for session, tab and journey ids. `memory` writes no key. Fixed at startup. |
527
+ | `sampling.defaultRate` | `1` | Keep rate for a namespace with no rule. |
528
+ | `sampling.rates` | `{}` | Keep rate per namespace. The longest matching prefix wins. |
529
+ | `sampling.alwaysSampleTypes` | `["action"]` | Record types that ignore the rate. |
530
+ | `sampling.alwaysSampleFrom` | `"ERROR"` | Lowest level that ignores the rate. `capturePolicy.errorCeiling` limits these log records. |
531
+ | `sampling.remote` | `false` | Reads sampling rules from the `X-UiObs-Sampling` header of each accepted batch (see Remote Sampling). |
532
+ | `sampling.remoteMaxRate` | `1` | Highest rate that a remote rule can set. It applies to the remote `defaultRate` and to each remote namespace rate. |
533
+ | `bus.mode` | `"auto"` | `auto`, `sender`, `forwarder` or `off`. With `off`, this context sends its own records and opens no link. A same-origin child frame that the page registers can still forward to it. |
534
+ | `bus.trustedOrigins` | `[]` | Origins of other documents that this document trusts. A cross-origin child frame forwards its records only to a parent on these origins. With `bus.sourcePolicy: "trusted-origin"`, a parent also accepts records from a child frame on these origins. With the default policy, use `registerFrame()`. The library keeps the origin of each URL. For a sandboxed frame, set `bus.mode: "sender"` in the frame. A trusted origin is also trusted for metric points. Its points bypass the sampling and the limit of 100 attribute sets of this document. |
535
+ | `bus.sourcePolicy` | `"registered"` | `registered` accepts only the frames and workers that the page registers. `trusted-origin` also accepts each frame on the page origin or in `bus.trustedOrigins`. |
536
+ | `bus.validation` | `"strict"` | `strict` checks the fields of each bus message. `envelope` checks the envelope only. |
537
+ | `bus.maxMessageBytes`, `bus.maxRecordsPerMessage`, `bus.maxMessagesPerSecond`, `bus.maxTrackedSources` | `262144`, `100`, `100`, `256` | Bus budgets for each message and each source. `0` turns a limit off. |
538
+ | `bus.openFinRole` | `"auto"` | `auto`, `provider` or `client`. |
539
+ | `journey.scope` | `"auto"` | Which contexts adopt a journey. `context`: each context keeps its own. `tab`: a frame or a worker adopts the journey of its owner. `origin`: each context of the origin, also in other tabs. `auto` is `origin` in OpenFin and `tab` in a browser. |
540
+ | `journey.maxAgeMs` | `1800000` | Maximum open time of a journey, in milliseconds. Then the library ends it. The range is 60000 to 86400000. |
541
+ | `batching.logFlushIntervalMs` | `2000` | Maximum wait of a partial log batch, in milliseconds. The range is 100 to 60000. |
542
+ | `batching.logBatchSize` | `100` | Maximum records in one log batch. The range is 1 to 1000. |
543
+ | `batching.metricFlushIntervalMs` | `10000` | Maximum wait of a partial metric batch, in milliseconds. The range is 100 to 60000. |
544
+ | `batching.metricBatchSize` | `500` | Maximum records in one metric batch. The range is 1 to 1000. |
545
+ | `retention.mode` | `"limited"` | `limited` or `until-delivered`. With `until-delivered`, a stored batch has no age limit and no attempt limit. `retention.maxBatches` still applies. A permanent error still drops the batch. A batch that always gets a temporary error stays first. The batches of the same endpoint behind it wait. |
546
+ | `retention.maxBatches` | `500` | Maximum stored batches. A new batch evicts the oldest batch without an action first. The range is 1 to 5000. |
547
+ | `retention.maxAgeMs` | `86400000` | Maximum age of a stored batch, in milliseconds. The range is 60000 to 604800000. |
548
+ | `retention.maxAttempts` | `5` | Maximum send attempts of a stored batch. The range is 1 to 20. |
549
+ | `limits.maxBodyChars` | `4096` | Maximum body length, in characters. The range is 256 to 65536. |
550
+ | `limits.maxAttributeChars` | `8192` | Maximum length of a string attribute, in characters. The range is 256 to 65536. |
551
+ | `limits.maxAttributeCount` | `128` | Maximum keys in one object. The range is 1 to 1024. |
552
+ | `limits.maxStackChars` | `8192` | Maximum length of an error stack, in characters. The range is 256 to 65536. |
553
+ | `limits.maxDepth` | `6` | Maximum depth of a nested value. The range is 1 to 16. |
554
+ | `limits.maxArrayLength` | `100` | Maximum items in one array, set or map. The range is 1 to 10000. |
555
+ | `limits.maxNodes` | `10000` | Maximum values in one sanitize pass. The range is 100 to 100000. |
556
+ | `limits.maxRecordBytes` | `32768` | Maximum attribute bytes of one record. Above it, the library drops the caller attributes. The range is 1024 to 60000. |
557
+ | `securityContext.id` | Generated | Delivery identity of this runtime. Supply a stable opaque id to send stored batches after a reload. Do not put secrets or personal data in it. |
558
+ | `securityContext.isolation` | `true` | Keeps the stored batches of each identity apart. Delivery changes then need `rotateSecurityContext()`. |
559
+ | `lockConfiguration` | `false` | Refuses changes through `configure()`. Identical repeated settings are accepted. `setConfigurationLocked(false)` unlocks. |
560
+ | `loggerCache.maxEntries` | `256` | LRU limit of cached loggers. `0` turns the cache off. `null` sets no limit. |
561
+ | `delivery` | See policies | Request timeout, request concurrency, retry delays, batches in one retry pass and fetch priority (`"low"` by default). |
562
+ | `buffering` | 10,000 records, 16 MiB, `"drop-oldest"` | Limits of the live buffers, and the overflow rule. |
563
+ | `debugBuffer` | `{ enabled: false, maxRecords: 200, maxAgeMs: 60000 }` | Keeps the records that `minLevel` or sampling drops. An ERROR or FATAL record of this context sends them first, with `uiobs.debug_buffer: true`. A later change of `redact` or `processors` empties the buffer. |
564
+ | `profiler` | `{ enabled: false, flushIntervalMs: 10000, maxProbes: 64, framePhases: false, framePacing: false }` | Times code spans with probes. The library sends one histogram summary record for each probe at each interval of `flushIntervalMs`. The range of `flushIntervalMs` is 1000 to 600000. This range is different from the range of `batching.metricFlushIntervalMs`. The range of `maxProbes` is 1 to 1024. `maxProbes` is fixed at startup. `framePhases` adds the phases of each long animation frame to the probes in that frame. `framePacing` measures the time between two frames. See [Profiler](#profiler). |
565
+ | `replay` | `{ enabled: false, mode: "onError", bufferMs: 60000, maxBufferBytes: 10000000, afterErrorMs: 5000, batchSize: 200, batchBytes: 512000, flushIntervalMs: 2000, maskText: true, maskInputs: true, ... }` | Records the DOM with the recorder of your app and sends the recent events in segments after an error. It needs `loader`, and `endpoint` or `onSegment`. See [Session replay](#session-replay) and [Runtime policies](docs/runtime-policies.md) for each key and range. |
566
+ | `metrics` | See policies | Limits of instrument names, attribute sets and histogram boundaries. |
567
+ | `correlation` | See policies | Session idle time, session write interval and trace age. Fixed at startup. |
568
+ | `capturePolicy` | See policies | Breadcrumb capacity, error duplicate check, capture rate limits and the error ceiling. |
569
+ | `diagnostics` | `{ throttleMs: 1000, consoleFallback: false, records: false }` | Report interval of each diagnostic code, and the console fallback when `onDiagnostic` throws. `records: true`, or a list of codes, also sends each report as a record in the namespace `uiobs.diagnostics`. |
570
+ | `persistence.namespace` | `""` | Separates the batch stores, the emergency queue and the retry locks of one application. Fixed at startup. |
571
+ | `persistence.requestPersistent` | `false` | Asks the browser to keep the stored batches under storage pressure. Firefox can show a prompt. `getHealth()` reports the answer. Fixed at startup. |
572
+ | `metadata` | All `true` | `pageUrl`, `userAgent` and `openfin` include `page.url`, `browser.user_agent` and the OpenFin fields. `clockOffset` adds `uiobs.clock_offset_ms` to logs and spans. |
573
+ | `capture` | See below | Auto-capture settings. |
574
+ | `capture.remoteToggles` | `[]` | Capture switches that remote rules can change for their TTL. Requires `sampling.remote`. Privacy controls stay local. |
575
+ | `capture.serverTiming` | `false` | Adds Server-Timing response entries to fetch and XHR records. Links a valid traceparent entry to the client span. |
576
+ | `capture.reports` | `false` | Records deprecations, interventions and CSP reports as WARN `ui.report`. |
577
+ | `capture.resourceTiming` | `false` | Records `ui.resource.duration` by initiator type and host. Accepts `true` or an object with `slowMs`. |
578
+ | `capture.resourceTiming.slowMs` | `1000` | Minimum duration of a `ui.resource.slow` event, in milliseconds. Set `0` for no slow events. |
579
+ | `capture.lifecycle` | `false` | Records visible, hidden, frozen, resumed and restored states with the duration of the previous state. |
580
+ | `capturePolicy.reportsPerWindow` | `20` | Maximum browser reports in each capture window. Set `0` for no limit. |
581
+ | `capturePolicy.resourcesPerWindow` | `100` | Maximum resource entries in each capture window. Set `0` for no limit. |
582
+ | `capturePolicy.lifecyclePerWindow` | `20` | Maximum lifecycle events in each capture window. Set `0` for no limit. |
583
+ | `console` | `false` | Prints records to devtools. `true` prints from `DEBUG` up. A level name prints from that level up. An object sets `level` and `styles` (see Console Output). It does not depend on `minLevel`. |
584
+ | `transport(request)` | `undefined` | Sends batches through a channel of your app in place of HTTP (see Custom Transport). |
585
+ | `transportWorker()` | `undefined` | Creates a dedicated HTTP worker. It calls `serveTransportWorker()`. Retry, storage, header functions and exit sends stay on the main thread. |
586
+ | `transportOnExit(request)` | `undefined` | Sends the last batch while the page closes. It must return a boolean and must not wait. |
587
+ | `otelLoader()` | `undefined` | Loads `@opentelemetry/api`. Without it, OTel is off. |
588
+ | `contextProvider()` | `undefined` | Returns attributes for each built record, including console/breadcrumb-only candidates, for example the current route. Its values override `setContext()` values. The logger scope and the call payload override its values. Keep it fast and synchronous. A provider that throws reports `handler.threw`. A value that is not an object reports `config.invalid`. The record is still built. |
589
+ | `processors` | `[]` | Functions that change or drop a record. They run in list order, before `redact`. A processor has the contract of `redact`. Return the record or a new record to keep it, or `null` to drop it. If a processor throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_processor`. A new list replaces the current list. |
590
+ | `redact(record)` | `undefined` | Changes a record before the library sends or prints it, including console-only candidates. Return `null` to drop the record. If the hook throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_redact`. The sender also runs its `redact` on each record from a frame or a worker. A record that the child already redacted then runs through `redact` again. Write `redact` so that a second run gives the same result. |
591
+ | `onDiagnostic(event)` | `undefined` | Receives the faults of the library itself. |
592
+ | `onDrop(summary)` | `undefined` | Receives a summary when the library loses records that it built. The summary has `reason`, `records`, `batchIds`, `journeyIds` and `actions`. Sampling, `minLevel`, `processors` and `redact` do not cause a loss. Do not log through the library in the hook. A record from the hook can evict a stored batch. A batch that storage evicts during its send can still reach the server. |
462
593
 
463
594
  ### Deferred payloads
464
595
 
@@ -469,7 +600,7 @@ getLogger("orders").info("Order state", payload);
469
600
  payload.status = "after";
470
601
  ```
471
602
 
472
- With `defer`, the record sees `status: "after"` if the idle build runs after the assignment. With the default `copy`, it sees `"before"`. The queue keeps the payload reference without reading its fields. Error reasons and metric attributes also wait for the build. Console output and breadcrumbs wait with the record. A call below the level queues nothing unless the console uses it. Sampling checks use the rules in force at build time.
603
+ With `defer`, the record sees `status: "after"` if the idle build runs after the assignment. With the default `copy`, it sees `"before"`. The queue keeps the payload reference without reading its fields. Error reasons and metric attributes also wait for the build. Console output and breadcrumbs wait with the record. A call below the level queues nothing unless the console uses it. Sampling checks use the current rules at build time.
473
604
 
474
605
  The call keeps its timestamp, trace, journey and a shallow copy of the ambient context. The builder reads `contextProvider`, scoped context and payload fields at build time. Processors and `redact` also run at build time. The queue can hold raw values until then. Debug bundle output does not include those raw queued values.
475
606
 
@@ -512,7 +643,7 @@ capture: {
512
643
  navigation: false, // Single-page navigation URL changes
513
644
  webVitals: false, // Core Web Vitals (LCP, CLS, INP, FCP, TTFB)
514
645
  longFrames: false, // Frames that freeze the page, as ui.long_frame.duration
515
- longFrameThresholdMs: 100, // Minimum frame duration that longFrames records
646
+ longFrameMs: 100, // Minimum frame duration that longFrames records
516
647
  console: false, // App console calls: true, or a list such as ["error", "warn", "info"]
517
648
  fullUrls: false, // Keep query strings and fragments on recorded URLs
518
649
  urlTransform: undefined, // Function that replaces the default URL rule
@@ -557,7 +688,7 @@ For cross-origin requests, expose `Server-Timing` with `Access-Control-Expose-He
557
688
 
558
689
  The three captures have separate rate limits in `capturePolicy`. They use `capturePolicy.windowMs`, which defaults to 10000 ms. Disabling a capture removes its listeners or disconnects its observer.
559
690
 
560
- `longFrames` records each frame at or above `longFrameThresholdMs` as the histogram `ui.long_frame.duration`. Each long frame also adds a breadcrumb. The next error record then shows the freeze before it.
691
+ `longFrames` records each frame at or above `longFrameMs` as the histogram `ui.long_frame.duration`. Each long frame also adds a breadcrumb. The next error record then shows the freeze before it.
561
692
 
562
693
  - The library observes `long-animation-frame`. A browser without it gives `longtask` entries, with no script attributes.
563
694
  - The attributes are `frame.type`, `frame.blocking_ms`, `frame.script.invoker` and `frame.script.source`. The source URL follows `fullUrls`.
@@ -672,11 +803,12 @@ With `persistence.namespace`, the batch keys start with `ui-observability:namesp
672
803
  - **Server (Node):** On Node, for example during server-side rendering, the library runs console-only. It installs no capture, keeps the ids in memory, uses no storage and has no exit flush. If you set `endpoint`, `metricsEndpoint`, `tracesEndpoint` or `transport`, it reports `config.invalid` one time.
673
804
  - **One library version on a page:** If a copy of another version owns the page runtime, this copy runs console-only. It installs no capture and reports `runtime.version_mismatch`. Load one version of the library on the page.
674
805
  - **Emergency queue:** The emergency queue is best effort. With `storage: "memory"` or `"none"`, the exit flush does not use it. A batch that it cannot send is then lost, and `onDrop` reports `not_stored`. It writes to `localStorage` synchronously, because no other storage works while the page unloads. If the browser refuses the write, the library reports `storage.quota_exceeded`. The library then loses the batch.
675
- - **Configuration after startup:** A second `configure()` call merges accepted options into an unlocked live runtime. Isolation is on by default. Then `configure()` refuses changes to delivery settings and to the context ID. It keeps the values in force, reports `config.invalid` and applies the other settings. Use `rotateSecurityContext()` for these changes. `securityContext.isolation: false` restores ordinary mutable routing. The runtime also refuses these 5 changes and reports `config.invalid` for each:
806
+ - **Configuration after startup:** A second `configure()` call merges accepted options into an unlocked live runtime. Isolation is on by default. Then `configure()` refuses changes to delivery settings and to the context ID. It keeps the current values, reports `config.invalid` and applies the other settings. Use `rotateSecurityContext()` for these changes. `securityContext.isolation: false` restores ordinary mutable routing. The runtime also refuses these 6 changes and reports `config.invalid` for each:
676
807
  - A change to `storage`. The stored batches stay in the adapter that the runtime built at startup.
677
808
  - A change to `identity`. The ids exist from startup.
678
809
  - A change to `batching` or `retention` after the delivery stack loads. The stack reads them one time.
679
810
  - A change to `limits` or `journey.maxAgeMs` after the first `configure()`. The record builder and the journey engine read them one time.
811
+ - A change to `profiler.maxProbes` after the first `configure()`. The profiler sets the size of its typed arrays from the startup value.
680
812
  - An `endpoint` change to `null` or `""` after the delivery stack loads. Without an endpoint, the stored batches would be lost. With isolation off, a change to another endpoint URL is accepted.
681
813
  - **Deterministic sampling:** FNV-1a hashing applies one keep rate to a whole journey. Sampling always keeps an explicit action and each record at or above `sampling.alwaysSampleFrom`, default `"ERROR"`.
682
814
 
@@ -706,6 +838,15 @@ The ingest server must meet these requirements:
706
838
  7. **Remote sampling (optional):** To send sampling rules, add `X-UiObs-Sampling` to a `2xx` answer. Expose the header with `Access-Control-Expose-Headers: x-uiobs-sampling`.
707
839
  8. **Clock offset (optional):** Expose the `Date` header with `Access-Control-Expose-Headers: date`. Each later log and span record then carries `uiobs.clock_offset_ms`.
708
840
 
841
+ **Replay endpoint (only with `replay.endpoint`).** It is a separate URL. It gets one `POST` for each segment of the session replay.
842
+
843
+ - The body is JSON, with `Content-Encoding: gzip` when `compression` is `gzip`. It has `replay.id`, `session.id`, `tab.id`, `service.name`, `sequence`, `bytes` and `events`. `events` is the list of recorder events.
844
+ - The request has `X-UiObs-Batch-Id` with the value `<replay.id>-<sequence>`, `X-UiObs-Attempt` and the headers of your `replay.headers` option. Allow them in the preflight, as for the log endpoint. Store a segment one time for each batch id.
845
+ - Answer `2xx` for a stored segment. The library sends a segment again after `429`, `5xx`, `401` and `403`. It drops a segment after another `4xx` status.
846
+ - Accept a large body. The first segment of an upload has a full snapshot of the page. One snapshot of a page with 35,000 table cells was 4.7 MB of JSON. The library does not split one event.
847
+ - Keep the segments of one `replay.id` in the order of `sequence`. A player needs the segment with the full snapshot before the later segments.
848
+ - `tools/mock-ingest-server.mjs` and `tools/reference-collector.mjs` accept `/v1/replay` and print one line for each segment. The reference collector accepts a replay body of at most `MAX_REPLAY_BODY_BYTES` (16 MB by default). `uiobs doctor` tests the replay endpoint with the option `--replay`. See [Check an ingest server](#check-an-ingest-server).
849
+
709
850
  `tools/reference-collector.mjs` implements each rule with no dependencies. It is not part of the package. Run `node tools/reference-collector.mjs`. Set `ALLOWED_ORIGINS` to the origins of your app. Set `UPSTREAM_URL` to an OTLP/HTTP collector, for example `http://localhost:4318`, to forward each OTLP batch there. The file lists the other settings: `PORT`, `AUTH_TOKEN`, `SAMPLING_RULES`, `MAX_BODY_BYTES` and `MAX_REQUESTS_PER_SECOND`.
710
851
 
711
852
  ### Check an ingest server
@@ -718,17 +859,47 @@ pnpm dlx @utk09/ui-observability doctor https://ingest.example/v1/logs --origin
718
859
 
719
860
  The tool prints `PASS` or `FAIL` for each rule. The exit code is 0 when each rule passes, 1 when a rule fails and 2 for a wrong command.
720
861
 
721
- | Rule | Check |
722
- | ----------------- | ------------------------------------------------------------------------------------------- |
723
- | `preflight` | `OPTIONS` answers with a `2xx` status and permits the origin. |
724
- | `allowed headers` | The preflight allows each request header of the library. |
725
- | `test batch` | A `POST` of an OTLP batch gets a `2xx` status and permits the origin. |
726
- | `exposed headers` | The batch answer exposes `Retry-After`. The output names optional headers that stay hidden. |
727
- | `gzip` | A `POST` with `Content-Encoding: gzip` gets a `2xx` status. |
728
- | `deduplication` | A second `POST` with the same `X-UiObs-Batch-Id` gets a `2xx` status. |
729
-
730
- - The tool sends real test batches. Each record has `service.name: "uiobs-doctor"`. Expect three test batches in the store of the server.
731
- - The tool sends no credentials and no `Authorization` header. A server that requires them fails `test batch`.
862
+ | Rule | Check |
863
+ | ----------------- | ------------------------------------------------------------------------------------------------ |
864
+ | `preflight` | `OPTIONS` answers with a `2xx` status and permits the origin. |
865
+ | `allowed headers` | The preflight allows each request header of the library. |
866
+ | `test batch` | A `POST` of an OTLP batch gets a `2xx` status and permits the origin. |
867
+ | `exposed headers` | The batch answer exposes `Retry-After`. The output names optional headers that stay hidden. |
868
+ | `gzip` | A `POST` with `Content-Encoding: gzip` gets a `2xx` status. |
869
+ | `deduplication` | A second `POST` with the same `X-UiObs-Batch-Id` gets a `2xx` status. |
870
+ | `beacon` | A `POST` with `Content-Type: text/plain;charset=UTF-8` and no custom header gets a `2xx` status. |
871
+
872
+ - The tool sends real test batches. Each record has `service.name: "uiobs-doctor"`. Expect four test batches in the store of the server.
873
+ - The `beacon` batch has its batch id in `uiobs_batch_id` and the reason `pagehide` in `uiobs_exit`, as in the exit flush of the library.
874
+ - The tool sends no credentials by default. Add a request header with `--header "Name: value"`. You can give the option more than one time.
875
+
876
+ ```bash
877
+ pnpm dlx @utk09/ui-observability doctor https://ingest.example/v1/logs --origin https://app.example --header "Authorization: Bearer $TOKEN"
878
+ ```
879
+
880
+ - The tool sends each custom header with each batch. The preflight names the header, and `allowed headers` tests that the server allows it.
881
+ - With a custom header, the tool sends no beacon. The exit flush of the library then uses a keepalive fetch, because `sendBeacon` cannot set a header.
882
+
883
+ To test a replay endpoint, give the value of `replay.endpoint` and add `--replay` directly after the origin. Give each header of your `replay.headers` option with `--header`.
884
+
885
+ ```bash
886
+ pnpm dlx @utk09/ui-observability doctor https://ingest.example/v1/replay --origin https://app.example --replay
887
+ ```
888
+
889
+ | Rule | Check |
890
+ | ----------------- | ------------------------------------------------------------------------ |
891
+ | `preflight` | `OPTIONS` answers with a `2xx` status and permits the origin. |
892
+ | `allowed headers` | The preflight allows each request header of the library. |
893
+ | `test segment` | A `POST` of a small segment gets a `2xx` status and permits the origin. |
894
+ | `gzip` | A `POST` of a segment with `Content-Encoding: gzip` gets a `2xx` status. |
895
+ | `large segment` | A `POST` of a segment of 5 MB without gzip gets a `2xx` status. |
896
+ | `deduplication` | A second `POST` with the same `X-UiObs-Batch-Id` gets a `2xx` status. |
897
+
898
+ - The tool sends four real test segments with one `replay.id`. Each segment has `service.name: "uiobs-doctor"` and one custom event of the recorder. One segment has 5 MB.
899
+ - The `large segment` rule finds a body limit that is too low. The library drops a segment after a `413` status, and the first segment of an upload has a full snapshot of the page.
900
+ - The tool sends no beacon to a replay endpoint, because the exit flush sends no segment.
901
+ - The tool prints no header value. A header value stays in the history of your shell. Use an environment variable for a token.
902
+ - A custom header cannot have the name of a header that the tool sets, for example `Content-Type` or `Origin`.
732
903
  - A client cannot see the store of the server. `deduplication` proves only that the server accepts a repeated id.
733
904
  - The tool follows no redirect. A `3xx` answer is a failure, because a browser refuses a preflight that redirects.
734
905
  - An origin has no path and no trailing slash. A wrong command prints the usage and the arguments that the tool received.