@openobserve/browser-core 0.2.10 → 0.2.11-rc1

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 (393) hide show
  1. package/cjs/boot/init.js +1 -1
  2. package/cjs/boot/init.js.map +1 -1
  3. package/cjs/browser/addEventListener.d.ts +12 -4
  4. package/cjs/browser/addEventListener.js +50 -8
  5. package/cjs/browser/addEventListener.js.map +1 -1
  6. package/cjs/browser/cookie.d.ts +7 -0
  7. package/cjs/browser/cookie.js +19 -2
  8. package/cjs/browser/cookie.js.map +1 -1
  9. package/cjs/browser/fetchObservable.js +14 -19
  10. package/cjs/browser/fetchObservable.js.map +1 -1
  11. package/cjs/browser/pageExitObservable.js +6 -7
  12. package/cjs/browser/pageExitObservable.js.map +1 -1
  13. package/cjs/browser/runOnReadyState.js +1 -1
  14. package/cjs/browser/runOnReadyState.js.map +1 -1
  15. package/cjs/browser/xhrObservable.d.ts +1 -2
  16. package/cjs/browser/xhrObservable.js +26 -34
  17. package/cjs/browser/xhrObservable.js.map +1 -1
  18. package/cjs/domain/configuration/configuration.d.ts +17 -12
  19. package/cjs/domain/configuration/configuration.js +8 -9
  20. package/cjs/domain/configuration/configuration.js.map +1 -1
  21. package/cjs/domain/configuration/endpointBuilder.d.ts +6 -10
  22. package/cjs/domain/configuration/endpointBuilder.js +23 -33
  23. package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
  24. package/cjs/domain/configuration/index.d.ts +2 -1
  25. package/cjs/domain/configuration/index.js +3 -1
  26. package/cjs/domain/configuration/index.js.map +1 -1
  27. package/cjs/domain/configuration/tags.js.map +1 -1
  28. package/cjs/domain/configuration/transportConfiguration.js +1 -1
  29. package/cjs/domain/configuration/transportConfiguration.js.map +1 -1
  30. package/cjs/domain/connectivity/connectivity.d.ts +13 -0
  31. package/cjs/domain/connectivity/connectivity.js +14 -0
  32. package/cjs/domain/connectivity/connectivity.js.map +1 -0
  33. package/cjs/domain/connectivity/index.d.ts +1 -0
  34. package/cjs/domain/{deflate → connectivity}/index.js +1 -1
  35. package/cjs/domain/connectivity/index.js.map +1 -0
  36. package/cjs/domain/console/consoleObservable.js +4 -7
  37. package/cjs/domain/console/consoleObservable.js.map +1 -1
  38. package/cjs/domain/context/contextConstants.d.ts +5 -0
  39. package/cjs/domain/{tracekit/types.js → context/contextConstants.js} +1 -1
  40. package/cjs/domain/context/contextConstants.js.map +1 -0
  41. package/cjs/domain/context/contextManager.d.ts +12 -0
  42. package/cjs/domain/context/contextManager.js +43 -0
  43. package/cjs/domain/context/contextManager.js.map +1 -0
  44. package/cjs/domain/context/customerDataTracker.d.ts +45 -0
  45. package/cjs/domain/context/customerDataTracker.js +107 -0
  46. package/cjs/domain/context/customerDataTracker.js.map +1 -0
  47. package/cjs/domain/context/storeContextManager.d.ts +6 -0
  48. package/cjs/domain/context/storeContextManager.js +38 -0
  49. package/cjs/domain/context/storeContextManager.js.map +1 -0
  50. package/cjs/domain/deflate/types.d.ts +0 -26
  51. package/cjs/domain/error/computeStackTrace.d.ts +33 -0
  52. package/cjs/domain/{tracekit → error}/computeStackTrace.js +28 -4
  53. package/cjs/domain/error/computeStackTrace.js.map +1 -0
  54. package/cjs/domain/error/error.d.ts +1 -1
  55. package/cjs/domain/error/error.js +3 -3
  56. package/cjs/domain/error/error.js.map +1 -1
  57. package/cjs/domain/error/error.types.d.ts +2 -2
  58. package/cjs/domain/error/error.types.js.map +1 -1
  59. package/cjs/domain/error/trackRuntimeError.d.ts +8 -0
  60. package/cjs/domain/error/trackRuntimeError.js +39 -6
  61. package/cjs/domain/error/trackRuntimeError.js.map +1 -1
  62. package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
  63. package/cjs/domain/report/browser.types.d.ts +10 -0
  64. package/cjs/domain/report/reportObservable.d.ts +2 -0
  65. package/cjs/domain/report/reportObservable.js +7 -7
  66. package/cjs/domain/report/reportObservable.js.map +1 -1
  67. package/cjs/domain/session/oldCookiesMigration.js +4 -4
  68. package/cjs/domain/session/oldCookiesMigration.js.map +1 -1
  69. package/cjs/domain/session/sessionManager.js +2 -2
  70. package/cjs/domain/session/sessionManager.js.map +1 -1
  71. package/cjs/domain/session/sessionState.js.map +1 -1
  72. package/cjs/domain/session/sessionStore.js.map +1 -1
  73. package/cjs/domain/session/sessionStoreOperations.d.ts +0 -5
  74. package/cjs/domain/session/sessionStoreOperations.js +6 -14
  75. package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
  76. package/cjs/domain/session/storeStrategies/sessionInCookie.js +13 -2
  77. package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
  78. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
  79. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
  80. package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
  81. package/cjs/domain/synthetics/syntheticsWorkerValues.js +3 -3
  82. package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
  83. package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +4 -0
  84. package/cjs/domain/telemetry/telemetry.d.ts +5 -1
  85. package/cjs/domain/telemetry/telemetry.js +17 -6
  86. package/cjs/domain/telemetry/telemetry.js.map +1 -1
  87. package/cjs/domain/telemetry/telemetryEvent.types.d.ts +18 -2
  88. package/cjs/domain/user/user.js.map +1 -1
  89. package/cjs/tools/abstractLifeCycle.js.map +1 -1
  90. package/cjs/tools/boundedBuffer.js.map +1 -1
  91. package/cjs/tools/catchUserErrors.js.map +1 -1
  92. package/cjs/tools/display.d.ts +2 -2
  93. package/cjs/tools/display.js +13 -17
  94. package/cjs/tools/display.js.map +1 -1
  95. package/cjs/tools/encoder.d.ts +53 -0
  96. package/cjs/tools/encoder.js +41 -0
  97. package/cjs/tools/encoder.js.map +1 -0
  98. package/cjs/tools/experimentalFeatures.d.ts +3 -5
  99. package/cjs/tools/experimentalFeatures.js +2 -4
  100. package/cjs/tools/experimentalFeatures.js.map +1 -1
  101. package/cjs/tools/getGlobalObject.js.map +1 -1
  102. package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
  103. package/cjs/tools/instrumentMethod.d.ts +50 -10
  104. package/cjs/tools/instrumentMethod.js +59 -36
  105. package/cjs/tools/instrumentMethod.js.map +1 -1
  106. package/cjs/tools/matchOption.js.map +1 -1
  107. package/cjs/tools/mergeInto.js.map +1 -1
  108. package/cjs/tools/monitor.d.ts +1 -2
  109. package/cjs/tools/monitor.js +6 -6
  110. package/cjs/tools/monitor.js.map +1 -1
  111. package/cjs/tools/observable.d.ts +1 -1
  112. package/cjs/tools/observable.js +2 -3
  113. package/cjs/tools/observable.js.map +1 -1
  114. package/cjs/tools/readBytesFromStream.js.map +1 -1
  115. package/cjs/tools/sendToExtension.js.map +1 -1
  116. package/cjs/tools/serialisation/jsonStringify.d.ts +1 -2
  117. package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
  118. package/cjs/tools/serialisation/sanitize.js.map +1 -1
  119. package/cjs/tools/utils/browserDetection.d.ts +8 -0
  120. package/cjs/tools/utils/browserDetection.js +33 -3
  121. package/cjs/tools/utils/browserDetection.js.map +1 -1
  122. package/cjs/tools/utils/byteUtils.js.map +1 -1
  123. package/cjs/tools/utils/functionUtils.js.map +1 -1
  124. package/cjs/tools/utils/objectUtils.js.map +1 -1
  125. package/cjs/tools/utils/polyfills.js.map +1 -1
  126. package/cjs/tools/utils/responseUtils.js.map +1 -1
  127. package/cjs/tools/utils/stringUtils.d.ts +1 -0
  128. package/cjs/tools/utils/stringUtils.js +31 -4
  129. package/cjs/tools/utils/stringUtils.js.map +1 -1
  130. package/cjs/tools/utils/timeUtils.js.map +1 -1
  131. package/cjs/tools/utils/typeUtils.js.map +1 -1
  132. package/cjs/tools/utils/urlPolyfill.js.map +1 -1
  133. package/cjs/tools/valueHistory.js.map +1 -1
  134. package/cjs/transport/batch.d.ts +5 -3
  135. package/cjs/transport/batch.js +73 -29
  136. package/cjs/transport/batch.js.map +1 -1
  137. package/cjs/transport/eventBridge.js.map +1 -1
  138. package/cjs/transport/flushController.d.ts +12 -2
  139. package/cjs/transport/flushController.js +22 -7
  140. package/cjs/transport/flushController.js.map +1 -1
  141. package/cjs/transport/httpRequest.d.ts +3 -2
  142. package/cjs/transport/httpRequest.js +21 -17
  143. package/cjs/transport/httpRequest.js.map +1 -1
  144. package/cjs/transport/sendWithRetryStrategy.d.ts +2 -2
  145. package/cjs/transport/sendWithRetryStrategy.js +9 -9
  146. package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
  147. package/cjs/transport/startBatchWithReplica.d.ts +9 -4
  148. package/cjs/transport/startBatchWithReplica.js +9 -4
  149. package/cjs/transport/startBatchWithReplica.js.map +1 -1
  150. package/esm/boot/init.js +1 -1
  151. package/esm/boot/init.js.map +1 -1
  152. package/esm/browser/addEventListener.d.ts +12 -4
  153. package/esm/browser/addEventListener.js +49 -7
  154. package/esm/browser/addEventListener.js.map +1 -1
  155. package/esm/browser/cookie.d.ts +7 -0
  156. package/esm/browser/cookie.js +17 -2
  157. package/esm/browser/cookie.js.map +1 -1
  158. package/esm/browser/fetchObservable.js +15 -20
  159. package/esm/browser/fetchObservable.js.map +1 -1
  160. package/esm/browser/pageExitObservable.js +7 -8
  161. package/esm/browser/pageExitObservable.js.map +1 -1
  162. package/esm/browser/runOnReadyState.js +2 -2
  163. package/esm/browser/runOnReadyState.js.map +1 -1
  164. package/esm/browser/xhrObservable.d.ts +1 -2
  165. package/esm/browser/xhrObservable.js +28 -36
  166. package/esm/browser/xhrObservable.js.map +1 -1
  167. package/esm/domain/configuration/configuration.d.ts +17 -12
  168. package/esm/domain/configuration/configuration.js +8 -9
  169. package/esm/domain/configuration/configuration.js.map +1 -1
  170. package/esm/domain/configuration/endpointBuilder.d.ts +6 -10
  171. package/esm/domain/configuration/endpointBuilder.js +22 -32
  172. package/esm/domain/configuration/endpointBuilder.js.map +1 -1
  173. package/esm/domain/configuration/index.d.ts +2 -1
  174. package/esm/domain/configuration/index.js +1 -0
  175. package/esm/domain/configuration/index.js.map +1 -1
  176. package/esm/domain/configuration/tags.js.map +1 -1
  177. package/esm/domain/configuration/transportConfiguration.js +1 -1
  178. package/esm/domain/configuration/transportConfiguration.js.map +1 -1
  179. package/esm/domain/connectivity/connectivity.d.ts +13 -0
  180. package/esm/domain/connectivity/connectivity.js +10 -0
  181. package/esm/domain/connectivity/connectivity.js.map +1 -0
  182. package/esm/domain/connectivity/index.d.ts +1 -0
  183. package/esm/domain/connectivity/index.js +2 -0
  184. package/esm/domain/connectivity/index.js.map +1 -0
  185. package/esm/domain/console/consoleObservable.js +2 -5
  186. package/esm/domain/console/consoleObservable.js.map +1 -1
  187. package/esm/domain/context/contextConstants.d.ts +5 -0
  188. package/esm/domain/context/contextConstants.js +2 -0
  189. package/esm/domain/context/contextConstants.js.map +1 -0
  190. package/esm/domain/context/contextManager.d.ts +12 -0
  191. package/esm/domain/context/contextManager.js +39 -0
  192. package/esm/domain/context/contextManager.js.map +1 -0
  193. package/esm/domain/context/customerDataTracker.d.ts +45 -0
  194. package/esm/domain/context/customerDataTracker.js +102 -0
  195. package/esm/domain/context/customerDataTracker.js.map +1 -0
  196. package/esm/domain/context/storeContextManager.d.ts +6 -0
  197. package/esm/domain/context/storeContextManager.js +32 -0
  198. package/esm/domain/context/storeContextManager.js.map +1 -0
  199. package/esm/domain/deflate/types.d.ts +12 -0
  200. package/esm/domain/error/computeStackTrace.d.ts +33 -0
  201. package/esm/domain/{tracekit → error}/computeStackTrace.js +26 -3
  202. package/esm/domain/error/computeStackTrace.js.map +1 -0
  203. package/esm/domain/error/error.d.ts +1 -1
  204. package/esm/domain/error/error.js +1 -1
  205. package/esm/domain/error/error.js.map +1 -1
  206. package/esm/domain/error/error.types.d.ts +2 -2
  207. package/esm/domain/error/error.types.js.map +1 -1
  208. package/esm/domain/error/trackRuntimeError.d.ts +8 -0
  209. package/esm/domain/error/trackRuntimeError.js +35 -4
  210. package/esm/domain/error/trackRuntimeError.js.map +1 -1
  211. package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
  212. package/esm/domain/report/browser.types.d.ts +10 -0
  213. package/esm/domain/report/reportObservable.d.ts +2 -0
  214. package/esm/domain/report/reportObservable.js +8 -8
  215. package/esm/domain/report/reportObservable.js.map +1 -1
  216. package/esm/domain/session/oldCookiesMigration.js +5 -5
  217. package/esm/domain/session/oldCookiesMigration.js.map +1 -1
  218. package/esm/domain/session/sessionManager.js +3 -3
  219. package/esm/domain/session/sessionManager.js.map +1 -1
  220. package/esm/domain/session/sessionState.js.map +1 -1
  221. package/esm/domain/session/sessionStore.js.map +1 -1
  222. package/esm/domain/session/sessionStoreOperations.d.ts +0 -5
  223. package/esm/domain/session/sessionStoreOperations.js +5 -12
  224. package/esm/domain/session/sessionStoreOperations.js.map +1 -1
  225. package/esm/domain/session/storeStrategies/sessionInCookie.js +13 -2
  226. package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
  227. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
  228. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
  229. package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
  230. package/esm/domain/synthetics/syntheticsWorkerValues.js +4 -4
  231. package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
  232. package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +4 -0
  233. package/esm/domain/telemetry/telemetry.d.ts +5 -1
  234. package/esm/domain/telemetry/telemetry.js +16 -5
  235. package/esm/domain/telemetry/telemetry.js.map +1 -1
  236. package/esm/domain/telemetry/telemetryEvent.types.d.ts +18 -2
  237. package/esm/domain/user/user.js.map +1 -1
  238. package/esm/index.d.ts +9 -5
  239. package/esm/index.js +8 -5
  240. package/esm/index.js.map +1 -1
  241. package/esm/tools/abstractLifeCycle.js.map +1 -1
  242. package/esm/tools/boundedBuffer.js.map +1 -1
  243. package/esm/tools/catchUserErrors.js.map +1 -1
  244. package/esm/tools/display.d.ts +2 -2
  245. package/esm/tools/display.js +12 -15
  246. package/esm/tools/display.js.map +1 -1
  247. package/esm/tools/encoder.d.ts +53 -0
  248. package/esm/tools/encoder.js +37 -0
  249. package/esm/tools/encoder.js.map +1 -0
  250. package/esm/tools/experimentalFeatures.d.ts +3 -5
  251. package/esm/tools/experimentalFeatures.js +2 -4
  252. package/esm/tools/experimentalFeatures.js.map +1 -1
  253. package/esm/tools/getGlobalObject.js.map +1 -1
  254. package/esm/tools/getZoneJsOriginalValue.js.map +1 -1
  255. package/esm/tools/instrumentMethod.d.ts +50 -10
  256. package/esm/tools/instrumentMethod.js +58 -34
  257. package/esm/tools/instrumentMethod.js.map +1 -1
  258. package/esm/tools/matchOption.js.map +1 -1
  259. package/esm/tools/mergeInto.js.map +1 -1
  260. package/esm/tools/monitor.d.ts +1 -2
  261. package/esm/tools/monitor.js +7 -7
  262. package/esm/tools/monitor.js.map +1 -1
  263. package/esm/tools/observable.d.ts +1 -1
  264. package/esm/tools/observable.js +2 -3
  265. package/esm/tools/observable.js.map +1 -1
  266. package/esm/tools/readBytesFromStream.js.map +1 -1
  267. package/esm/tools/sendToExtension.js.map +1 -1
  268. package/esm/tools/serialisation/jsonStringify.d.ts +1 -2
  269. package/esm/tools/serialisation/jsonStringify.js.map +1 -1
  270. package/esm/tools/serialisation/sanitize.js.map +1 -1
  271. package/esm/tools/utils/browserDetection.d.ts +8 -0
  272. package/esm/tools/utils/browserDetection.js +30 -2
  273. package/esm/tools/utils/browserDetection.js.map +1 -1
  274. package/esm/tools/utils/byteUtils.js.map +1 -1
  275. package/esm/tools/utils/functionUtils.js.map +1 -1
  276. package/esm/tools/utils/objectUtils.js.map +1 -1
  277. package/esm/tools/utils/polyfills.js.map +1 -1
  278. package/esm/tools/utils/responseUtils.js.map +1 -1
  279. package/esm/tools/utils/stringUtils.d.ts +1 -0
  280. package/esm/tools/utils/stringUtils.js +29 -3
  281. package/esm/tools/utils/stringUtils.js.map +1 -1
  282. package/esm/tools/utils/timeUtils.js.map +1 -1
  283. package/esm/tools/utils/typeUtils.js.map +1 -1
  284. package/esm/tools/utils/urlPolyfill.js.map +1 -1
  285. package/esm/tools/valueHistory.js.map +1 -1
  286. package/esm/transport/batch.d.ts +5 -3
  287. package/esm/transport/batch.js +73 -29
  288. package/esm/transport/batch.js.map +1 -1
  289. package/esm/transport/eventBridge.js.map +1 -1
  290. package/esm/transport/flushController.d.ts +12 -2
  291. package/esm/transport/flushController.js +22 -7
  292. package/esm/transport/flushController.js.map +1 -1
  293. package/esm/transport/httpRequest.d.ts +3 -2
  294. package/esm/transport/httpRequest.js +21 -17
  295. package/esm/transport/httpRequest.js.map +1 -1
  296. package/esm/transport/sendWithRetryStrategy.d.ts +2 -2
  297. package/esm/transport/sendWithRetryStrategy.js +9 -9
  298. package/esm/transport/sendWithRetryStrategy.js.map +1 -1
  299. package/esm/transport/startBatchWithReplica.d.ts +9 -4
  300. package/esm/transport/startBatchWithReplica.js +9 -4
  301. package/esm/transport/startBatchWithReplica.js.map +1 -1
  302. package/package.json +1 -1
  303. package/src/browser/addEventListener.ts +37 -31
  304. package/src/browser/cookie.ts +21 -2
  305. package/src/browser/fetchObservable.ts +21 -25
  306. package/src/browser/pageExitObservable.ts +1 -3
  307. package/src/browser/xhrObservable.ts +31 -37
  308. package/src/domain/configuration/configuration.ts +24 -22
  309. package/src/domain/configuration/endpointBuilder.ts +33 -46
  310. package/src/domain/configuration/index.ts +2 -1
  311. package/src/domain/configuration/transportConfiguration.ts +1 -1
  312. package/src/domain/connectivity/connectivity.ts +27 -0
  313. package/src/domain/connectivity/index.ts +1 -0
  314. package/src/domain/console/consoleObservable.ts +3 -7
  315. package/src/domain/context/contextConstants.ts +5 -0
  316. package/src/domain/context/contextManager.ts +48 -0
  317. package/src/domain/context/customerDataTracker.ts +134 -0
  318. package/src/domain/context/storeContextManager.ts +51 -0
  319. package/src/domain/deflate/types.ts +14 -0
  320. package/src/domain/{tracekit → error}/computeStackTrace.ts +49 -4
  321. package/src/domain/error/error.ts +2 -2
  322. package/src/domain/error/error.types.ts +11 -2
  323. package/src/domain/error/trackRuntimeError.ts +44 -12
  324. package/src/domain/report/browser.types.ts +12 -0
  325. package/src/domain/report/reportObservable.ts +8 -6
  326. package/src/domain/session/oldCookiesMigration.ts +5 -5
  327. package/src/domain/session/sessionStoreOperations.ts +5 -13
  328. package/src/domain/session/storeStrategies/sessionInCookie.ts +13 -2
  329. package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +1 -0
  330. package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +1 -0
  331. package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
  332. package/src/domain/telemetry/rawTelemetryEvent.types.ts +5 -0
  333. package/src/domain/telemetry/telemetry.ts +22 -7
  334. package/src/domain/telemetry/telemetryEvent.types.ts +18 -2
  335. package/src/index.ts +13 -7
  336. package/src/tools/display.ts +14 -13
  337. package/src/tools/encoder.ts +102 -0
  338. package/src/tools/experimentalFeatures.ts +2 -4
  339. package/src/tools/instrumentMethod.ts +103 -59
  340. package/src/tools/mergeInto.ts +16 -16
  341. package/src/tools/monitor.ts +5 -5
  342. package/src/tools/observable.ts +3 -5
  343. package/src/tools/utils/browserDetection.ts +43 -2
  344. package/src/tools/utils/polyfills.ts +1 -4
  345. package/src/tools/utils/stringUtils.ts +30 -4
  346. package/src/transport/batch.ts +86 -31
  347. package/src/transport/flushController.ts +22 -7
  348. package/src/transport/httpRequest.ts +23 -16
  349. package/src/transport/sendWithRetryStrategy.ts +10 -10
  350. package/src/transport/startBatchWithReplica.ts +22 -6
  351. package/cjs/domain/deflate/index.d.ts +0 -1
  352. package/cjs/domain/deflate/index.js.map +0 -1
  353. package/cjs/domain/tracekit/computeStackTrace.d.ts +0 -5
  354. package/cjs/domain/tracekit/computeStackTrace.js.map +0 -1
  355. package/cjs/domain/tracekit/index.d.ts +0 -3
  356. package/cjs/domain/tracekit/index.js +0 -8
  357. package/cjs/domain/tracekit/index.js.map +0 -1
  358. package/cjs/domain/tracekit/tracekit.d.ts +0 -35
  359. package/cjs/domain/tracekit/tracekit.js +0 -95
  360. package/cjs/domain/tracekit/tracekit.js.map +0 -1
  361. package/cjs/domain/tracekit/types.d.ts +0 -44
  362. package/cjs/domain/tracekit/types.js.map +0 -1
  363. package/cjs/index.d.ts +0 -63
  364. package/cjs/index.js +0 -155
  365. package/cjs/index.js.map +0 -1
  366. package/cjs/tools/serialisation/contextManager.d.ts +0 -21
  367. package/cjs/tools/serialisation/contextManager.js +0 -70
  368. package/cjs/tools/serialisation/contextManager.js.map +0 -1
  369. package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
  370. package/cjs/tools/serialisation/heavyCustomerDataWarning.js +0 -18
  371. package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
  372. package/esm/domain/tracekit/computeStackTrace.d.ts +0 -5
  373. package/esm/domain/tracekit/computeStackTrace.js.map +0 -1
  374. package/esm/domain/tracekit/index.d.ts +0 -3
  375. package/esm/domain/tracekit/index.js +0 -3
  376. package/esm/domain/tracekit/index.js.map +0 -1
  377. package/esm/domain/tracekit/tracekit.d.ts +0 -35
  378. package/esm/domain/tracekit/tracekit.js +0 -91
  379. package/esm/domain/tracekit/tracekit.js.map +0 -1
  380. package/esm/domain/tracekit/types.d.ts +0 -44
  381. package/esm/domain/tracekit/types.js +0 -2
  382. package/esm/domain/tracekit/types.js.map +0 -1
  383. package/esm/tools/serialisation/contextManager.d.ts +0 -21
  384. package/esm/tools/serialisation/contextManager.js +0 -66
  385. package/esm/tools/serialisation/contextManager.js.map +0 -1
  386. package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
  387. package/esm/tools/serialisation/heavyCustomerDataWarning.js +0 -14
  388. package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
  389. package/src/domain/tracekit/index.ts +0 -3
  390. package/src/domain/tracekit/tracekit.ts +0 -96
  391. package/src/domain/tracekit/types.ts +0 -47
  392. package/src/tools/serialisation/contextManager.ts +0 -79
  393. package/src/tools/serialisation/heavyCustomerDataWarning.ts +0 -26
@@ -0,0 +1,134 @@
1
+ import { ONE_KIBI_BYTE, computeBytesCount } from '../../tools/utils/byteUtils'
2
+ import { throttle } from '../../tools/utils/functionUtils'
3
+ import type { Context } from '../../tools/serialisation/context'
4
+ import { jsonStringify } from '../../tools/serialisation/jsonStringify'
5
+ import { display } from '../../tools/display'
6
+ import { isEmptyObject } from '../../tools/utils/objectUtils'
7
+ import type { CustomerDataType } from './contextConstants'
8
+
9
+ // RUM and logs batch bytes limit is 16KB
10
+ // ensure that we leave room for other event attributes and maintain a decent amount of event per batch
11
+ // (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
12
+ export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
13
+
14
+ // We observed that the compression ratio is around 8 in general, but we also want to keep a margin
15
+ // because some data might not be compressed (ex: last view update on page exit). We chose 16KiB
16
+ // because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this
17
+ // is a bit arbitrary.
18
+ export const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE
19
+
20
+ export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
21
+
22
+ export type CustomerDataTracker = ReturnType<typeof createCustomerDataTracker>
23
+ export type CustomerDataTrackerManager = ReturnType<typeof createCustomerDataTrackerManager>
24
+
25
+ export const enum CustomerDataCompressionStatus {
26
+ Unknown,
27
+ Enabled,
28
+ Disabled,
29
+ }
30
+
31
+ export function createCustomerDataTrackerManager(
32
+ compressionStatus: CustomerDataCompressionStatus = CustomerDataCompressionStatus.Disabled
33
+ ) {
34
+ const customerDataTrackers = new Map<CustomerDataType, CustomerDataTracker>()
35
+
36
+ let alreadyWarned = false
37
+ function checkCustomerDataLimit(initialBytesCount = 0) {
38
+ if (alreadyWarned || compressionStatus === CustomerDataCompressionStatus.Unknown) {
39
+ return
40
+ }
41
+
42
+ const bytesCountLimit =
43
+ compressionStatus === CustomerDataCompressionStatus.Disabled
44
+ ? CUSTOMER_DATA_BYTES_LIMIT
45
+ : CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT
46
+
47
+ let bytesCount = initialBytesCount
48
+ customerDataTrackers.forEach((tracker) => {
49
+ bytesCount += tracker.getBytesCount()
50
+ })
51
+
52
+ if (bytesCount > bytesCountLimit) {
53
+ displayCustomerDataLimitReachedWarning(bytesCountLimit)
54
+ alreadyWarned = true
55
+ }
56
+ }
57
+
58
+ return {
59
+ /**
60
+ * Creates a detached tracker. The manager will not store a reference to that tracker, and the
61
+ * bytes count will be counted independently from other detached trackers.
62
+ *
63
+ * This is particularly useful when we don't know when the tracker will be unused, so we don't
64
+ * leak memory (ex: when used in Logger instances).
65
+ */
66
+ createDetachedTracker: () => {
67
+ const tracker = createCustomerDataTracker(() => checkCustomerDataLimit(tracker.getBytesCount()))
68
+ return tracker
69
+ },
70
+
71
+ /**
72
+ * Creates a tracker if it doesn't exist, and returns it.
73
+ */
74
+ getOrCreateTracker: (type: CustomerDataType) => {
75
+ if (!customerDataTrackers.has(type)) {
76
+ customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit))
77
+ }
78
+ return customerDataTrackers.get(type)!
79
+ },
80
+
81
+ setCompressionStatus: (newCompressionStatus: CustomerDataCompressionStatus) => {
82
+ if (compressionStatus === CustomerDataCompressionStatus.Unknown) {
83
+ compressionStatus = newCompressionStatus
84
+ checkCustomerDataLimit()
85
+ }
86
+ },
87
+
88
+ getCompressionStatus: () => compressionStatus,
89
+
90
+ stop: () => {
91
+ customerDataTrackers.forEach((tracker) => tracker.stop())
92
+ customerDataTrackers.clear()
93
+ },
94
+ }
95
+ }
96
+
97
+ export function createCustomerDataTracker(checkCustomerDataLimit: () => void) {
98
+ let bytesCountCache = 0
99
+
100
+ // Throttle the bytes computation to minimize the impact on performance.
101
+ // Especially useful if the user call context APIs synchronously multiple times in a row
102
+ const { throttled: computeBytesCountThrottled, cancel: cancelComputeBytesCount } = throttle((context: Context) => {
103
+ bytesCountCache = computeBytesCount(jsonStringify(context)!)
104
+ checkCustomerDataLimit()
105
+ }, BYTES_COMPUTATION_THROTTLING_DELAY)
106
+
107
+ const resetBytesCount = () => {
108
+ cancelComputeBytesCount()
109
+ bytesCountCache = 0
110
+ }
111
+
112
+ return {
113
+ updateCustomerData: (context: Context) => {
114
+ if (isEmptyObject(context)) {
115
+ resetBytesCount()
116
+ } else {
117
+ computeBytesCountThrottled(context)
118
+ }
119
+ },
120
+ resetCustomerData: resetBytesCount,
121
+ getBytesCount: () => bytesCountCache,
122
+ stop: () => {
123
+ cancelComputeBytesCount()
124
+ },
125
+ }
126
+ }
127
+
128
+ function displayCustomerDataLimitReachedWarning(bytesCountLimit: number) {
129
+ display.warn(
130
+ `Customer data exceeds the recommended ${
131
+ bytesCountLimit / ONE_KIBI_BYTE
132
+ }KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning`
133
+ )
134
+ }
@@ -0,0 +1,51 @@
1
+ import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
2
+ import type { Context } from '../../tools/serialisation/context'
3
+ import type { Configuration } from '../configuration'
4
+ import { combine } from '../../tools/mergeInto'
5
+ import type { ContextManager } from './contextManager'
6
+ import type { CustomerDataType } from './contextConstants'
7
+
8
+ const CONTEXT_STORE_KEY_PREFIX = '_oo_c'
9
+
10
+ const storageListeners: Array<{ stop: () => void }> = []
11
+
12
+ export function storeContextManager(
13
+ configuration: Configuration,
14
+ contextManager: ContextManager,
15
+ productKey: string,
16
+ customerDataType: CustomerDataType
17
+ ) {
18
+ const storageKey = buildStorageKey(productKey, customerDataType)
19
+
20
+ storageListeners.push(
21
+ addEventListener(configuration, window, DOM_EVENT.STORAGE, ({ key }) => {
22
+ if (storageKey === key) {
23
+ synchronizeWithStorage()
24
+ }
25
+ })
26
+ )
27
+ contextManager.changeObservable.subscribe(dumpToStorage)
28
+
29
+ contextManager.setContext(combine(getFromStorage(), contextManager.getContext()))
30
+
31
+ function synchronizeWithStorage() {
32
+ contextManager.setContext(getFromStorage())
33
+ }
34
+
35
+ function dumpToStorage() {
36
+ localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()))
37
+ }
38
+
39
+ function getFromStorage() {
40
+ const rawContext = localStorage.getItem(storageKey)
41
+ return rawContext !== null ? (JSON.parse(rawContext) as Context) : {}
42
+ }
43
+ }
44
+
45
+ export function buildStorageKey(productKey: string, customerDataType: CustomerDataType) {
46
+ return `${CONTEXT_STORE_KEY_PREFIX}_${productKey}_${customerDataType}`
47
+ }
48
+
49
+ export function removeStorageListeners() {
50
+ storageListeners.map((listener) => listener.stop())
51
+ }
@@ -1,3 +1,5 @@
1
+ import type { Encoder } from '../../tools/encoder'
2
+
1
3
  export type DeflateWorkerAction =
2
4
  // Action to send when creating the worker to check if the communication is working correctly.
3
5
  // The worker should respond with a 'initialized' response.
@@ -39,3 +41,15 @@ export type DeflateWorkerResponse =
39
41
  streamId?: number
40
42
  error: Error | string
41
43
  }
44
+
45
+ export interface DeflateWorker extends Worker {
46
+ postMessage(message: DeflateWorkerAction): void
47
+ }
48
+
49
+ export type DeflateEncoder = Encoder<Uint8Array> & { stop: () => void }
50
+
51
+ export const enum DeflateEncoderStreamId {
52
+ REPLAY = 1,
53
+ RUM = 2,
54
+ RUM_REPLICA = 3,
55
+ }
@@ -1,11 +1,33 @@
1
+ /**
2
+ * Cross-browser stack trace computation.
3
+ *
4
+ * Reference implementation: https://github.com/csnover/TraceKit/blob/04530298073c3823de72deb0b97e7b38ca7bcb59/tracekit.js
5
+ */
6
+
1
7
  import { startsWith } from '../../tools/utils/polyfills'
2
- import type { StackTrace, StackFrame } from './types'
8
+
9
+ export interface StackFrame {
10
+ url?: string
11
+ func?: string
12
+ /** The arguments passed to the function, if known. */
13
+ args?: string[]
14
+ line?: number
15
+ column?: number
16
+ /** An array of source code lines; the middle element corresponds to the correct line. */
17
+ context?: string[]
18
+ }
19
+
20
+ export interface StackTrace {
21
+ name?: string
22
+ message?: string
23
+ url?: string
24
+ stack: StackFrame[]
25
+ incomplete?: boolean
26
+ partial?: boolean
27
+ }
3
28
 
4
29
  const UNKNOWN_FUNCTION = '?'
5
30
 
6
- /**
7
- * Computes a stack trace for an exception.
8
- */
9
31
  export function computeStackTrace(ex: unknown): StackTrace {
10
32
  const stack: StackFrame[] = []
11
33
 
@@ -139,3 +161,26 @@ function tryToGetString(candidate: unknown, property: string) {
139
161
  const value = (candidate as { [k: string]: unknown })[property]
140
162
  return typeof value === 'string' ? value : undefined
141
163
  }
164
+
165
+ export function computeStackTraceFromOnErrorMessage(messageObj: unknown, url?: string, line?: number, column?: number) {
166
+ const stack = [{ url, column, line }]
167
+ const { name, message } = tryToParseMessage(messageObj)
168
+ return {
169
+ name,
170
+ message,
171
+ stack,
172
+ }
173
+ }
174
+
175
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
176
+ const ERROR_TYPES_RE =
177
+ /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/
178
+
179
+ function tryToParseMessage(messageObj: unknown) {
180
+ let name
181
+ let message
182
+ if ({}.toString.call(messageObj) === '[object String]') {
183
+ ;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
184
+ }
185
+ return { name, message }
186
+ }
@@ -1,11 +1,11 @@
1
- import type { StackTrace } from '../tracekit'
2
- import { computeStackTrace } from '../tracekit'
3
1
  import { callMonitored } from '../../tools/monitor'
4
2
  import { sanitize } from '../../tools/serialisation/sanitize'
5
3
  import type { ClocksState } from '../../tools/utils/timeUtils'
6
4
  import { noop } from '../../tools/utils/functionUtils'
7
5
  import { jsonStringify } from '../../tools/serialisation/jsonStringify'
8
6
  import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
7
+ import type { StackTrace } from './computeStackTrace'
8
+ import { computeStackTrace } from './computeStackTrace'
9
9
 
10
10
  export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
11
11
 
@@ -1,7 +1,16 @@
1
1
  import type { ClocksState } from '../../tools/utils/timeUtils'
2
2
 
3
- export interface ErrorWithCause extends Error {
4
- cause?: Error
3
+ // TS v4.6 introduced Error.cause[1] typed as `Error`. TS v4.8 changed Error.cause to be
4
+ // `unknown`[2].
5
+ //
6
+ // Because we still support TS 3.8, we need to declare our own type. We can remove it once we drop
7
+ // support for TS v4.7 and before. The 'cause' property defined by TS needs to be omitted because
8
+ // we define it with a type `unknown` which is incompatible with TS 4.6 and 4.7.
9
+ //
10
+ // [1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022
11
+ // [2]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates
12
+ export interface ErrorWithCause extends Omit<Error, 'cause'> {
13
+ cause?: unknown
5
14
  }
6
15
 
7
16
  export type RawErrorCause = {
@@ -1,21 +1,53 @@
1
+ import { instrumentMethod } from '../../tools/instrumentMethod'
1
2
  import type { Observable } from '../../tools/observable'
2
3
  import { clocksNow } from '../../tools/utils/timeUtils'
3
- import { startUnhandledErrorCollection } from '../tracekit'
4
+ import type { StackTrace } from './computeStackTrace'
5
+ import { computeStackTrace, computeStackTraceFromOnErrorMessage } from './computeStackTrace'
4
6
  import { computeRawError } from './error'
5
7
  import type { RawError } from './error.types'
6
8
  import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
7
9
 
10
+ export type UnhandledErrorCallback = (stackTrace: StackTrace, originalError?: any) => any
11
+
8
12
  export function trackRuntimeError(errorObservable: Observable<RawError>) {
9
- return startUnhandledErrorCollection((stackTrace, originalError) => {
10
- errorObservable.notify(
11
- computeRawError({
12
- stackTrace,
13
- originalError,
14
- startClocks: clocksNow(),
15
- nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
16
- source: ErrorSource.SOURCE,
17
- handling: ErrorHandling.UNHANDLED,
18
- })
19
- )
13
+ const handleRuntimeError = (stackTrace: StackTrace, originalError?: any) => {
14
+ const test = computeRawError({
15
+ stackTrace,
16
+ originalError,
17
+ startClocks: clocksNow(),
18
+ nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
19
+ source: ErrorSource.SOURCE,
20
+ handling: ErrorHandling.UNHANDLED,
21
+ })
22
+ errorObservable.notify(test)
23
+ }
24
+ const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError)
25
+ const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError)
26
+
27
+ return {
28
+ stop: () => {
29
+ stopInstrumentingOnError()
30
+ stopInstrumentingOnUnhandledRejection()
31
+ },
32
+ }
33
+ }
34
+
35
+ export function instrumentOnError(callback: UnhandledErrorCallback) {
36
+ return instrumentMethod(window, 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
37
+ let stackTrace
38
+ if (errorObj instanceof Error) {
39
+ stackTrace = computeStackTrace(errorObj)
40
+ } else {
41
+ stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column)
42
+ }
43
+ callback(stackTrace, errorObj ?? messageObj)
44
+ })
45
+ }
46
+
47
+ export function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
48
+ return instrumentMethod(window, 'onunhandledrejection', ({ parameters: [e] }) => {
49
+ const reason = e.reason || 'Empty reason'
50
+ const stack = computeStackTrace(reason)
51
+ callback(stack, reason)
20
52
  })
21
53
  }
@@ -1,5 +1,16 @@
1
1
  export type ReportType = DeprecationReport['type'] | InterventionReport['type']
2
2
 
3
+ interface Report {
4
+ type: ReportType
5
+ url: string
6
+ body: DeprecationReportBody | InterventionReportBody
7
+ toJSON(): any
8
+ }
9
+
10
+ interface ReportBody {
11
+ toJSON(): any
12
+ }
13
+
3
14
  export interface DeprecationReport extends Report {
4
15
  type: 'deprecation'
5
16
  body: DeprecationReportBody
@@ -17,6 +28,7 @@ export interface InterventionReport extends Report {
17
28
  type: 'intervention'
18
29
  body: InterventionReportBody
19
30
  }
31
+
20
32
  export interface InterventionReportBody extends ReportBody {
21
33
  id: string
22
34
  message: string
@@ -19,6 +19,7 @@ export interface RawReport {
19
19
  type: RawReportType
20
20
  subtype: string
21
21
  message: string
22
+ originalReport: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
22
23
  stack?: string
23
24
  }
24
25
 
@@ -38,7 +39,7 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
38
39
  }
39
40
 
40
41
  function createReportObservable(reportTypes: ReportType[]) {
41
- const observable = new Observable<RawReport>(() => {
42
+ return new Observable<RawReport>((observable) => {
42
43
  if (!window.ReportingObserver) {
43
44
  return
44
45
  }
@@ -59,26 +60,26 @@ function createReportObservable(reportTypes: ReportType[]) {
59
60
  observer.disconnect()
60
61
  }
61
62
  })
62
-
63
- return observable
64
63
  }
65
64
 
66
65
  function createCspViolationReportObservable(configuration: Configuration) {
67
- const observable = new Observable<RawReport>(() => {
66
+ return new Observable<RawReport>((observable) => {
68
67
  const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
69
68
  observable.notify(buildRawReportFromCspViolation(event))
70
69
  })
71
70
 
72
71
  return stop
73
72
  })
74
- return observable
75
73
  }
76
74
 
77
- function buildRawReportFromReport({ type, body }: DeprecationReport | InterventionReport): RawReport {
75
+ function buildRawReportFromReport(report: DeprecationReport | InterventionReport): RawReport {
76
+ const { type, body } = report
77
+
78
78
  return {
79
79
  type,
80
80
  subtype: body.id,
81
81
  message: `${type}: ${body.message}`,
82
+ originalReport: report,
82
83
  stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
83
84
  }
84
85
  }
@@ -99,6 +100,7 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
99
100
  event.lineNumber,
100
101
  event.columnNumber
101
102
  ),
103
+ originalReport: event,
102
104
  }
103
105
  }
104
106
 
@@ -1,4 +1,4 @@
1
- import { getCookie } from '../../browser/cookie'
1
+ import { getInitCookie } from '../../browser/cookie'
2
2
  import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
3
3
  import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
4
4
  import type { SessionState } from './sessionState'
@@ -17,11 +17,11 @@ export const LOGS_SESSION_KEY = 'logs'
17
17
  * to allow older sdk versions to be upgraded to newer versions without compatibility issues.
18
18
  */
19
19
  export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
20
- const sessionString = getCookie(SESSION_STORE_KEY)
20
+ const sessionString = getInitCookie(SESSION_STORE_KEY)
21
21
  if (!sessionString) {
22
- const oldSessionId = getCookie(OLD_SESSION_COOKIE_NAME)
23
- const oldRumType = getCookie(OLD_RUM_COOKIE_NAME)
24
- const oldLogsType = getCookie(OLD_LOGS_COOKIE_NAME)
22
+ const oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME)
23
+ const oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME)
24
+ const oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME)
25
25
  const session: SessionState = {}
26
26
 
27
27
  if (oldSessionId) {
@@ -1,6 +1,5 @@
1
1
  import { setTimeout } from '../../tools/timer'
2
2
  import { generateUUID } from '../../tools/utils/stringUtils'
3
- import { isChromium } from '../../tools/utils/browserDetection'
4
3
  import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
5
4
  import type { SessionState } from './sessionState'
6
5
  import { expandSessionState, isSessionInExpiredState } from './sessionState'
@@ -20,8 +19,7 @@ export function processSessionStoreOperations(
20
19
  sessionStoreStrategy: SessionStoreStrategy,
21
20
  numberOfRetries = 0
22
21
  ) {
23
- const { retrieveSession, persistSession, clearSession } = sessionStoreStrategy
24
- const lockEnabled = isLockEnabled()
22
+ const { isLockEnabled, retrieveSession, persistSession, clearSession } = sessionStoreStrategy
25
23
 
26
24
  if (!ongoingOperations) {
27
25
  ongoingOperations = operations
@@ -30,13 +28,13 @@ export function processSessionStoreOperations(
30
28
  bufferedOperations.push(operations)
31
29
  return
32
30
  }
33
- if (lockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
31
+ if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
34
32
  next(sessionStoreStrategy)
35
33
  return
36
34
  }
37
35
  let currentLock: string
38
36
  let currentSession = retrieveSession()
39
- if (lockEnabled) {
37
+ if (isLockEnabled) {
40
38
  // if someone has lock, retry later
41
39
  if (currentSession.lock) {
42
40
  retryLater(operations, sessionStoreStrategy, numberOfRetries)
@@ -54,7 +52,7 @@ export function processSessionStoreOperations(
54
52
  }
55
53
  }
56
54
  let processedSession = operations.process(currentSession)
57
- if (lockEnabled) {
55
+ if (isLockEnabled) {
58
56
  // if lock corrupted after process, retry later
59
57
  currentSession = retrieveSession()
60
58
  if (currentSession.lock !== currentLock!) {
@@ -70,7 +68,7 @@ export function processSessionStoreOperations(
70
68
  persistSession(processedSession)
71
69
  }
72
70
  }
73
- if (lockEnabled) {
71
+ if (isLockEnabled) {
74
72
  // correctly handle lock around expiration would require to handle this case properly at several levels
75
73
  // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it
76
74
  if (!(processedSession && isSessionInExpiredState(processedSession))) {
@@ -91,12 +89,6 @@ export function processSessionStoreOperations(
91
89
  next(sessionStoreStrategy)
92
90
  }
93
91
 
94
- /**
95
- * Lock strategy allows mitigating issues due to concurrent access to cookie.
96
- * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
97
- */
98
- export const isLockEnabled = () => isChromium()
99
-
100
92
  function retryLater(operations: Operations, sessionStore: SessionStoreStrategy, currentNumberOfRetries: number) {
101
93
  setTimeout(() => {
102
94
  processSessionStoreOperations(operations, sessionStore, currentNumberOfRetries + 1)
@@ -1,3 +1,4 @@
1
+ import { isChromium } from '../../../tools/utils/browserDetection'
1
2
  import type { CookieOptions } from '../../../browser/cookie'
2
3
  import { getCurrentSite, areCookiesAuthorized, deleteCookie, getCookie, setCookie } from '../../../browser/cookie'
3
4
  import type { InitConfiguration } from '../../configuration'
@@ -15,6 +16,11 @@ export function selectCookieStrategy(initConfiguration: InitConfiguration): Sess
15
16
 
16
17
  export function initCookieStrategy(cookieOptions: CookieOptions): SessionStoreStrategy {
17
18
  const cookieStore = {
19
+ /**
20
+ * Lock strategy allows mitigating issues due to concurrent access to cookie.
21
+ * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
22
+ */
23
+ isLockEnabled: isChromium(),
18
24
  persistSession: persistSessionCookie(cookieOptions),
19
25
  retrieveSession: retrieveSessionCookie,
20
26
  clearSession: deleteSessionCookie(cookieOptions),
@@ -45,8 +51,13 @@ function deleteSessionCookie(options: CookieOptions) {
45
51
  export function buildCookieOptions(initConfiguration: InitConfiguration) {
46
52
  const cookieOptions: CookieOptions = {}
47
53
 
48
- cookieOptions.secure = !!initConfiguration.useSecureSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
49
- cookieOptions.crossSite = !!initConfiguration.useCrossSiteSessionCookie
54
+ cookieOptions.secure =
55
+ !!initConfiguration.useSecureSessionCookie ||
56
+ !!initConfiguration.usePartitionedCrossSiteSessionCookie ||
57
+ !!initConfiguration.useCrossSiteSessionCookie
58
+ cookieOptions.crossSite =
59
+ !!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
60
+ cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie
50
61
 
51
62
  if (initConfiguration.trackSessionAcrossSubdomains) {
52
63
  cookieOptions.domain = getCurrentSite()
@@ -21,6 +21,7 @@ export function selectLocalStorageStrategy(): SessionStoreStrategyType | undefin
21
21
 
22
22
  export function initLocalStorageStrategy(): SessionStoreStrategy {
23
23
  return {
24
+ isLockEnabled: false,
24
25
  persistSession: persistInLocalStorage,
25
26
  retrieveSession: retrieveSessionFromLocalStorage,
26
27
  clearSession: clearSessionFromLocalStorage,
@@ -6,6 +6,7 @@ export const SESSION_STORE_KEY = '_oo_s'
6
6
  export type SessionStoreStrategyType = { type: 'Cookie'; cookieOptions: CookieOptions } | { type: 'LocalStorage' }
7
7
 
8
8
  export interface SessionStoreStrategy {
9
+ isLockEnabled: boolean
9
10
  persistSession: (session: SessionState) => void
10
11
  retrieveSession: () => SessionState
11
12
  clearSession: () => void
@@ -1,4 +1,4 @@
1
- import { getCookie } from '../../browser/cookie'
1
+ import { getInitCookie } from '../../browser/cookie'
2
2
 
3
3
  export const SYNTHETICS_TEST_ID_COOKIE_NAME = 'openobserve-synthetics-public-id'
4
4
  export const SYNTHETICS_RESULT_ID_COOKIE_NAME = 'openobserve-synthetics-result-id'
@@ -12,16 +12,16 @@ export interface BrowserWindow extends Window {
12
12
 
13
13
  export function willSyntheticsInjectRum(): boolean {
14
14
  return Boolean(
15
- (window as BrowserWindow)._OO_SYNTHETICS_INJECTS_RUM || getCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME)
15
+ (window as BrowserWindow)._OO_SYNTHETICS_INJECTS_RUM || getInitCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME)
16
16
  )
17
17
  }
18
18
 
19
19
  export function getSyntheticsTestId(): string | undefined {
20
- const value = (window as BrowserWindow)._OO_SYNTHETICS_PUBLIC_ID || getCookie(SYNTHETICS_TEST_ID_COOKIE_NAME)
20
+ const value = (window as BrowserWindow)._OO_SYNTHETICS_PUBLIC_ID || getInitCookie(SYNTHETICS_TEST_ID_COOKIE_NAME)
21
21
  return typeof value === 'string' ? value : undefined
22
22
  }
23
23
 
24
24
  export function getSyntheticsResultId(): string | undefined {
25
- const value = (window as BrowserWindow)._OO_SYNTHETICS_RESULT_ID || getCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME)
25
+ const value = (window as BrowserWindow)._OO_SYNTHETICS_RESULT_ID || getInitCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME)
26
26
  return typeof value === 'string' ? value : undefined
27
27
  }
@@ -10,5 +10,10 @@ export const enum StatusType {
10
10
  error = 'error',
11
11
  }
12
12
 
13
+ export interface RuntimeEnvInfo {
14
+ is_local_file: boolean
15
+ is_worker: boolean
16
+ }
17
+
13
18
  export type RawTelemetryEvent = TelemetryEvent['telemetry']
14
19
  export type RawTelemetryConfiguration = TelemetryConfigurationEvent['telemetry']['configuration']