@cloudcare/browser-rum 3.2.19 → 3.2.22

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 (222) hide show
  1. package/README.md +128 -194
  2. package/bundle/dataflux-rum.js +1 -1
  3. package/cjs/boot/buildEnv.js +2 -3
  4. package/cjs/boot/buildEnv.js.map +1 -1
  5. package/cjs/boot/perStartRum.js +9 -2
  6. package/cjs/boot/perStartRum.js.map +1 -1
  7. package/cjs/boot/recorderApi.js +1 -1
  8. package/cjs/boot/recorderApi.js.map +1 -1
  9. package/cjs/boot/rum.entry.js +1 -2
  10. package/cjs/boot/rum.entry.js.map +1 -1
  11. package/cjs/boot/rum.js.map +1 -1
  12. package/cjs/boot/rumPublicApi.js +1 -1
  13. package/cjs/boot/rumPublicApi.js.map +1 -1
  14. package/cjs/boot/startRecording.js +51 -39
  15. package/cjs/boot/startRecording.js.map +1 -1
  16. package/cjs/constants.js +13 -26
  17. package/cjs/constants.js.map +1 -1
  18. package/cjs/domain/assembly.js +6 -6
  19. package/cjs/domain/assembly.js.map +1 -1
  20. package/cjs/domain/configuration.js.map +1 -1
  21. package/cjs/domain/contexts/displayContext.js.map +1 -1
  22. package/cjs/domain/contexts/foregroundContexts.js +2 -4
  23. package/cjs/domain/contexts/foregroundContexts.js.map +1 -1
  24. package/cjs/domain/contexts/internalContext.js.map +1 -1
  25. package/cjs/domain/contexts/pageStateHistory.js +4 -8
  26. package/cjs/domain/contexts/pageStateHistory.js.map +1 -1
  27. package/cjs/domain/contexts/urlContexts.js +1 -2
  28. package/cjs/domain/contexts/urlContexts.js.map +1 -1
  29. package/cjs/domain/contexts/viewContexts.js +1 -2
  30. package/cjs/domain/contexts/viewContexts.js.map +1 -1
  31. package/cjs/domain/deflate/deflateEncoder.js +1 -2
  32. package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
  33. package/cjs/domain/deflate/deflateWorker.js +3 -5
  34. package/cjs/domain/deflate/deflateWorker.js.map +1 -1
  35. package/cjs/domain/firstInputPolyfill.js.map +1 -1
  36. package/cjs/domain/locationChangeObservable.js.map +1 -1
  37. package/cjs/domain/performanceObservable.js +1 -2
  38. package/cjs/domain/performanceObservable.js.map +1 -1
  39. package/cjs/domain/performanceUtils.js.map +1 -1
  40. package/cjs/domain/replay/record/elementsScrollPositions.js.map +1 -1
  41. package/cjs/domain/replay/record/mutationBatch.js +1 -2
  42. package/cjs/domain/replay/record/mutationBatch.js.map +1 -1
  43. package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
  44. package/cjs/domain/replay/record/observers.js +5 -6
  45. package/cjs/domain/replay/record/observers.js.map +1 -1
  46. package/cjs/domain/replay/record/privacy.js +2 -4
  47. package/cjs/domain/replay/record/privacy.js.map +1 -1
  48. package/cjs/domain/replay/record/record.js.map +1 -1
  49. package/cjs/domain/replay/record/serializationUtils.js +3 -6
  50. package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
  51. package/cjs/domain/replay/record/serialize.js +5 -7
  52. package/cjs/domain/replay/record/serialize.js.map +1 -1
  53. package/cjs/domain/replay/record/shadowRootsController.js +1 -2
  54. package/cjs/domain/replay/record/shadowRootsController.js.map +1 -1
  55. package/cjs/domain/replay/record/viewports.js +2 -4
  56. package/cjs/domain/replay/record/viewports.js.map +1 -1
  57. package/cjs/domain/replay/replayStats.js +1 -2
  58. package/cjs/domain/replay/replayStats.js.map +1 -1
  59. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
  60. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
  61. package/cjs/domain/replay/segmentCollection/segment.js +3 -3
  62. package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
  63. package/cjs/domain/replay/segmentCollection/segmentCollection.js +3 -4
  64. package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  65. package/cjs/domain/replay/startRecordBridge.js +19 -0
  66. package/cjs/domain/replay/startRecordBridge.js.map +1 -0
  67. package/cjs/domain/requestCollection.js.map +1 -1
  68. package/cjs/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
  69. package/cjs/domain/rumEventsCollection/actions/clickChain.js +2 -4
  70. package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
  71. package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +1 -2
  72. package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
  73. package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +1 -2
  74. package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
  75. package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -4
  76. package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
  77. package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
  78. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +2 -2
  79. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  80. package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  81. package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  82. package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
  83. package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
  84. package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  85. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  86. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +2 -5
  87. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
  88. package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  89. package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js +1 -2
  90. package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
  91. package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  92. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +1 -2
  93. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  94. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +1 -2
  95. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
  96. package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
  97. package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  98. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +1 -2
  99. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
  100. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +1 -2
  101. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  102. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +1 -2
  103. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  104. package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
  105. package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  106. package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +1 -2
  107. package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
  108. package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
  109. package/cjs/domain/rumEventsCollection/view/trackViews.js +18 -12
  110. package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  111. package/cjs/domain/rumSessionManager.js +5 -9
  112. package/cjs/domain/rumSessionManager.js.map +1 -1
  113. package/cjs/domain/tracing/ddtraceTracer.js.map +1 -1
  114. package/cjs/domain/tracing/getDocumentTraceId.js +1 -2
  115. package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -1
  116. package/cjs/domain/tracing/jaegerTracer.js.map +1 -1
  117. package/cjs/domain/tracing/sampler.js +69 -0
  118. package/cjs/domain/tracing/sampler.js.map +1 -0
  119. package/cjs/domain/tracing/skywalkingTracer.js.map +1 -1
  120. package/cjs/domain/tracing/traceIdentifier.js.map +1 -1
  121. package/cjs/domain/tracing/tracer.js +8 -2
  122. package/cjs/domain/tracing/tracer.js.map +1 -1
  123. package/cjs/domain/tracing/w3cTraceParentTracer.js.map +1 -1
  124. package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -1
  125. package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -1
  126. package/cjs/domain/trackEventCounts.js.map +1 -1
  127. package/cjs/domain/usr/index.js +3 -6
  128. package/cjs/domain/usr/index.js.map +1 -1
  129. package/cjs/domain/waitPageActivityEnd.js +2 -4
  130. package/cjs/domain/waitPageActivityEnd.js.map +1 -1
  131. package/cjs/types/sessionReplayConstants.js +5 -10
  132. package/cjs/types/sessionReplayConstants.js.map +1 -1
  133. package/esm/boot/buildEnv.js +1 -1
  134. package/esm/boot/perStartRum.js +10 -3
  135. package/esm/boot/perStartRum.js.map +1 -1
  136. package/esm/boot/recorderApi.js +2 -2
  137. package/esm/boot/recorderApi.js.map +1 -1
  138. package/esm/boot/rum.js.map +1 -1
  139. package/esm/boot/rumPublicApi.js +1 -1
  140. package/esm/boot/rumPublicApi.js.map +1 -1
  141. package/esm/boot/startRecording.js +51 -38
  142. package/esm/boot/startRecording.js.map +1 -1
  143. package/esm/domain/assembly.js +6 -6
  144. package/esm/domain/configuration.js.map +1 -1
  145. package/esm/domain/contexts/displayContext.js.map +1 -1
  146. package/esm/domain/contexts/foregroundContexts.js.map +1 -1
  147. package/esm/domain/contexts/internalContext.js.map +1 -1
  148. package/esm/domain/contexts/pageStateHistory.js.map +1 -1
  149. package/esm/domain/contexts/urlContexts.js.map +1 -1
  150. package/esm/domain/contexts/viewContexts.js.map +1 -1
  151. package/esm/domain/deflate/deflateEncoder.js.map +1 -1
  152. package/esm/domain/deflate/deflateWorker.js +1 -1
  153. package/esm/domain/firstInputPolyfill.js.map +1 -1
  154. package/esm/domain/locationChangeObservable.js.map +1 -1
  155. package/esm/domain/performanceUtils.js.map +1 -1
  156. package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
  157. package/esm/domain/replay/record/mutationBatch.js.map +1 -1
  158. package/esm/domain/replay/record/mutationObserver.js.map +1 -1
  159. package/esm/domain/replay/record/observers.js +5 -6
  160. package/esm/domain/replay/record/observers.js.map +1 -1
  161. package/esm/domain/replay/record/record.js.map +1 -1
  162. package/esm/domain/replay/record/serialize.js +4 -5
  163. package/esm/domain/replay/record/serialize.js.map +1 -1
  164. package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
  165. package/esm/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
  166. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  167. package/esm/domain/replay/startRecordBridge.js +13 -0
  168. package/esm/domain/replay/startRecordBridge.js.map +1 -0
  169. package/esm/domain/requestCollection.js.map +1 -1
  170. package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
  171. package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
  172. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
  173. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
  174. package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  175. package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  176. package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  177. package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
  178. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
  179. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  180. package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  181. package/esm/domain/rumEventsCollection/resource/resourceUtils.js +0 -1
  182. package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
  183. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  184. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  185. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  186. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
  187. package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  188. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  189. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  190. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
  191. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  192. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
  193. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
  194. package/esm/domain/rumEventsCollection/view/trackViews.js +15 -6
  195. package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  196. package/esm/domain/rumSessionManager.js +2 -2
  197. package/esm/domain/rumSessionManager.js.map +1 -1
  198. package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
  199. package/esm/domain/tracing/jaegerTracer.js.map +1 -1
  200. package/esm/domain/tracing/sampler.js +61 -0
  201. package/esm/domain/tracing/sampler.js.map +1 -0
  202. package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
  203. package/esm/domain/tracing/traceIdentifier.js.map +1 -1
  204. package/esm/domain/tracing/tracer.js +8 -2
  205. package/esm/domain/tracing/tracer.js.map +1 -1
  206. package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
  207. package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
  208. package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
  209. package/esm/domain/trackEventCounts.js.map +1 -1
  210. package/esm/domain/usr/index.js.map +1 -1
  211. package/esm/types/sessionReplayConstants.js +0 -1
  212. package/esm/types/sessionReplayConstants.js.map +1 -1
  213. package/package.json +35 -35
  214. package/src/boot/perStartRum.js +13 -4
  215. package/src/boot/recorderApi.js +6 -2
  216. package/src/boot/rumPublicApi.js +0 -1
  217. package/src/boot/startRecording.js +59 -47
  218. package/src/domain/replay/startRecordBridge.js +14 -0
  219. package/src/domain/rumEventsCollection/view/trackViews.js +18 -9
  220. package/src/domain/rumSessionManager.js +6 -2
  221. package/src/domain/tracing/sampler.js +65 -0
  222. package/src/domain/tracing/tracer.js +11 -5
@@ -1 +1 @@
1
- {"version":3,"file":"sessionReplayConstants.js","names":["RecordType","FullSnapshot","IncrementalSnapshot","Meta","Focus","ViewEnd","VisualViewport","FrustrationRecord","NodeType","Document","DocumentType","Element","Text","CDATA","DocumentFragment","IncrementalSource","Mutation","MouseMove","MouseInteraction","Scroll","ViewportResize","Input","TouchMove","MediaInteraction","StyleSheetRule","MouseInteractionType","MouseUp","MouseDown","Click","ContextMenu","DblClick","Blur","TouchStart","TouchEnd","MediaInteractionType","Play","Pause"],"sources":["../../src/types/sessionReplayConstants.js"],"sourcesContent":["export var RecordType = {\n FullSnapshot: 2,\n IncrementalSnapshot: 3,\n Meta: 4,\n Focus: 6,\n ViewEnd: 7,\n VisualViewport: 8,\n FrustrationRecord: 9\n}\n\nexport var NodeType = {\n Document: 0,\n DocumentType: 1,\n Element: 2,\n Text: 3,\n CDATA: 4,\n DocumentFragment: 11\n}\n\nexport var IncrementalSource = {\n Mutation: 0,\n MouseMove: 1,\n MouseInteraction: 2,\n Scroll: 3,\n ViewportResize: 4,\n Input: 5,\n TouchMove: 6,\n MediaInteraction: 7,\n StyleSheetRule: 8\n // CanvasMutation : 9,\n // Font : 10,\n}\n\nexport var MouseInteractionType = {\n MouseUp: 0,\n MouseDown: 1,\n Click: 2,\n ContextMenu: 3,\n DblClick: 4,\n Focus: 5,\n Blur: 6,\n TouchStart: 7,\n TouchEnd: 9\n}\n\nexport var MediaInteractionType = {\n Play: 0,\n Pause: 1\n}\n"],"mappings":"AAAA,OAAO,IAAIA,UAAU,GAAG;EACtBC,YAAY,EAAE,CAAC;EACfC,mBAAmB,EAAE,CAAC;EACtBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,OAAO,EAAE,CAAC;EACVC,cAAc,EAAE,CAAC;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAED,OAAO,IAAIC,QAAQ,GAAG;EACpBC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,gBAAgB,EAAE;AACpB,CAAC;AAED,OAAO,IAAIC,iBAAiB,GAAG;EAC7BC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,CAAC;EACnBC,MAAM,EAAE,CAAC;EACTC,cAAc,EAAE,CAAC;EACjBC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,CAAC;EACnBC,cAAc,EAAE;EAChB;EACA;AACF,CAAC;;AAED,OAAO,IAAIC,oBAAoB,GAAG;EAChCC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,KAAK,EAAE,CAAC;EACRC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACX1B,KAAK,EAAE,CAAC;EACR2B,IAAI,EAAE,CAAC;EACPC,UAAU,EAAE,CAAC;EACbC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,IAAIC,oBAAoB,GAAG;EAChCC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"sessionReplayConstants.js","names":["RecordType","FullSnapshot","IncrementalSnapshot","Meta","Focus","ViewEnd","VisualViewport","FrustrationRecord","NodeType","Document","DocumentType","Element","Text","CDATA","DocumentFragment","IncrementalSource","Mutation","MouseMove","MouseInteraction","Scroll","ViewportResize","Input","TouchMove","MediaInteraction","StyleSheetRule","MouseInteractionType","MouseUp","MouseDown","Click","ContextMenu","DblClick","Blur","TouchStart","TouchEnd","MediaInteractionType","Play","Pause"],"sources":["../../src/types/sessionReplayConstants.js"],"sourcesContent":["export var RecordType = {\n FullSnapshot: 2,\n IncrementalSnapshot: 3,\n Meta: 4,\n Focus: 6,\n ViewEnd: 7,\n VisualViewport: 8,\n FrustrationRecord: 9\n}\n\nexport var NodeType = {\n Document: 0,\n DocumentType: 1,\n Element: 2,\n Text: 3,\n CDATA: 4,\n DocumentFragment: 11\n}\n\nexport var IncrementalSource = {\n Mutation: 0,\n MouseMove: 1,\n MouseInteraction: 2,\n Scroll: 3,\n ViewportResize: 4,\n Input: 5,\n TouchMove: 6,\n MediaInteraction: 7,\n StyleSheetRule: 8\n // CanvasMutation : 9,\n // Font : 10,\n}\n\nexport var MouseInteractionType = {\n MouseUp: 0,\n MouseDown: 1,\n Click: 2,\n ContextMenu: 3,\n DblClick: 4,\n Focus: 5,\n Blur: 6,\n TouchStart: 7,\n TouchEnd: 9\n}\n\nexport var MediaInteractionType = {\n Play: 0,\n Pause: 1\n}\n"],"mappings":"AAAA,OAAO,IAAIA,UAAU,GAAG;EACtBC,YAAY,EAAE,CAAC;EACfC,mBAAmB,EAAE,CAAC;EACtBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,OAAO,EAAE,CAAC;EACVC,cAAc,EAAE,CAAC;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAED,OAAO,IAAIC,QAAQ,GAAG;EACpBC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,gBAAgB,EAAE;AACpB,CAAC;AAED,OAAO,IAAIC,iBAAiB,GAAG;EAC7BC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,CAAC;EACnBC,MAAM,EAAE,CAAC;EACTC,cAAc,EAAE,CAAC;EACjBC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,CAAC;EACnBC,cAAc,EAAE;EAChB;EACA;AACF,CAAC;AAED,OAAO,IAAIC,oBAAoB,GAAG;EAChCC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,KAAK,EAAE,CAAC;EACRC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACX1B,KAAK,EAAE,CAAC;EACR2B,IAAI,EAAE,CAAC;EACPC,UAAU,EAAE,CAAC;EACbC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,IAAIC,oBAAoB,GAAG;EAChCC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
- "name": "@cloudcare/browser-rum",
3
- "version": "3.2.19",
4
- "main": "cjs/index.js",
5
- "module": "esm/index.js",
6
- "types": "types/index.d.ts",
7
- "dependencies": {
8
- "@cloudcare/browser-core": "3.2.19",
9
- "@cloudcare/browser-worker": "3.2.19"
10
- },
11
- "scripts": {
12
- "dev": "webpack serve --open --mode=development",
13
- "build": "run-p build:cjs build:esm build:bundle",
14
- "build:cjs": "rm -rf cjs && babel --config-file ./babel.cjs.json --out-dir cjs ./src && npm run replace-build-env cjs",
15
- "build:esm": "rm -rf esm && babel --config-file ./babel.esm.json --out-dir esm ./src && npm run replace-build-env esm",
16
- "build:bundle": "rm -rf bundle && webpack --mode=production",
17
- "replace-build-env": "node ../../scripts/replace-build-env.js",
18
- "publish:oss:current": "npm run build:bundle && node ./scripts/publish-oss.js current",
19
- "publish:oss:lts": "npm run build:bundle && node ./scripts/publish-oss.js lts",
20
- "publish:oss:test": "npm run build:bundle && node ./scripts/publish-oss.js test"
21
- },
22
- "keywords": [
23
- "dataflux",
24
- "rum",
25
- "sdk"
26
- ],
27
- "repository": {
28
- "url": "https://github.com/DataFlux-cn/datakit-js",
29
- "type": "git",
30
- "directory": "packages/rum"
31
- },
32
- "author": "dataflux",
33
- "license": "MIT",
34
- "homepage": "https://github.com/CloudCare/dataflux-rum-sdk-javascript/blob/master/packages/rum/README.md",
35
- "description": "DataFlux RUM Web 端数据指标监控",
36
- "gitHead": "215b9477d2050f8f4769e9fba99323e7070b8dad"
2
+ "name": "@cloudcare/browser-rum",
3
+ "version": "3.2.22",
4
+ "main": "cjs/index.js",
5
+ "module": "esm/index.js",
6
+ "types": "types/index.d.ts",
7
+ "dependencies": {
8
+ "@cloudcare/browser-core": "3.2.22",
9
+ "@cloudcare/browser-worker": "3.2.22"
10
+ },
11
+ "scripts": {
12
+ "dev": "webpack serve --open --mode=development",
13
+ "build": "run-p build:cjs build:esm build:bundle",
14
+ "build:cjs": "rm -rf cjs && babel --config-file ./babel.cjs.json --out-dir cjs ./src && npm run replace-build-env cjs",
15
+ "build:esm": "rm -rf esm && babel --config-file ./babel.esm.json --out-dir esm ./src && npm run replace-build-env esm",
16
+ "build:bundle": "rm -rf bundle && webpack --mode=production",
17
+ "replace-build-env": "node ../../scripts/replace-build-env.js",
18
+ "publish:oss:current": "npm run build:bundle && node ./scripts/publish-oss.js current",
19
+ "publish:oss:lts": "npm run build:bundle && node ./scripts/publish-oss.js lts",
20
+ "publish:oss:test": "npm run build:bundle && node ./scripts/publish-oss.js test"
21
+ },
22
+ "keywords": [
23
+ "dataflux",
24
+ "rum",
25
+ "sdk"
26
+ ],
27
+ "repository": {
28
+ "url": "https://github.com/DataFlux-cn/datakit-js",
29
+ "type": "git",
30
+ "directory": "packages/rum"
31
+ },
32
+ "author": "dataflux",
33
+ "license": "MIT",
34
+ "homepage": "https://github.com/CloudCare/dataflux-rum-sdk-javascript/blob/master/packages/rum/README.md",
35
+ "description": "DataFlux RUM Web 端数据指标监控",
36
+ "gitHead": "b2098679ee0435c9d35ac9596680c9084a32f936"
37
37
  }
@@ -10,7 +10,9 @@ import {
10
10
  assign,
11
11
  addTelemetryConfiguration,
12
12
  initFetchObservable,
13
- deepClone
13
+ deepClone,
14
+ fetchAndApplyRemoteConfiguration,
15
+ getEventBridge
14
16
  } from '@cloudcare/browser-core'
15
17
  import { validateAndBuildRumConfiguration } from '../domain/configuration'
16
18
 
@@ -134,8 +136,11 @@ export function createPreStartStrategy(
134
136
  if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {
135
137
  return
136
138
  }
137
-
138
- doInit(initConfiguration)
139
+ if (initConfiguration.remoteConfiguration) {
140
+ fetchAndApplyRemoteConfiguration(initConfiguration, doInit)
141
+ } else {
142
+ doInit(initConfiguration)
143
+ }
139
144
  },
140
145
 
141
146
  getInitConfiguration: function () {
@@ -209,6 +214,10 @@ export function createPreStartStrategy(
209
214
  function overrideInitConfigurationForBridge(initConfiguration) {
210
215
  return assign({}, initConfiguration, {
211
216
  applicationId: '00000000-aaaa-0000-aaaa-000000000000',
212
- sessionSampleRate: 100
217
+ clientToken: 'empty',
218
+ sessionSampleRate: 100,
219
+ defaultPrivacyLevel:
220
+ initConfiguration.defaultPrivacyLevel ??
221
+ getEventBridge()?.getPrivacyLevel()
213
222
  })
214
223
  }
@@ -3,6 +3,8 @@ import {
3
3
  runOnReadyState,
4
4
  LifeCycleEventType,
5
5
  canUseEventBridge,
6
+ bridgeSupports,
7
+ BridgeCapability,
6
8
  PageExitReason
7
9
  } from '@cloudcare/browser-core'
8
10
 
@@ -27,7 +29,10 @@ var RecorderStatus = {
27
29
  }
28
30
 
29
31
  export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
30
- if (canUseEventBridge() || !isBrowserSupported()) {
32
+ if (
33
+ (canUseEventBridge() && !bridgeSupports(BridgeCapability.RECORDS)) ||
34
+ !isBrowserSupported()
35
+ ) {
31
36
  return {
32
37
  start: noop,
33
38
  stop: noop,
@@ -131,7 +136,6 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
131
136
  return
132
137
  }
133
138
  var deflateEncoder = getOrCreateDeflateEncoder()
134
-
135
139
  if (!deflateEncoder) {
136
140
  state = {
137
141
  status: RecorderStatus.Stopped
@@ -86,7 +86,6 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
86
86
  }
87
87
  : createIdentityEncoder
88
88
  )
89
-
90
89
  recorderApi.onRumStart(
91
90
  startRumResult.lifeCycle,
92
91
  configuration,
@@ -3,9 +3,11 @@ import {
3
3
  createHttpRequest,
4
4
  LifeCycleEventType,
5
5
  addTelemetryDebug,
6
- ONE_SECOND
6
+ ONE_SECOND,
7
+ canUseEventBridge
7
8
  } from '@cloudcare/browser-core'
8
9
  import { record } from '../domain/replay/record'
10
+ import { startRecordBridge } from '../domain/replay/startRecordBridge'
9
11
  import {
10
12
  startSegmentCollection,
11
13
  SEGMENT_BYTES_LIMIT
@@ -38,58 +40,68 @@ export function startRecording(
38
40
  configuration.retryMaxSize,
39
41
  reportError
40
42
  )
41
- const session = sessionManager.findTrackedSession()
42
- let isRecordErrorSessionReplay =
43
- session && session.errorSessionReplayAllowed && !session.sessionHasError
44
- var segmentCollection = startSegmentCollection(
45
- lifeCycle,
46
- configuration,
47
- sessionManager,
48
- viewContexts,
49
- replayRequest,
50
- encoder,
51
- isRecordErrorSessionReplay
52
- )
53
- var addRecord = segmentCollection.addRecord
54
- var flushBufferSegment = segmentCollection.flushBufferSegment
55
- var unlockSegment = segmentCollection.unlockSegment
56
- cleanupTasks.push(segmentCollection.stop)
57
- if (isRecordErrorSessionReplay) {
58
- sessionManager.sessionStateUpdateObservable.subscribe(
59
- ({ previousState, newState }) => {
60
- if (!previousState.hasError && newState.hasError) {
61
- isRecordErrorSessionReplay = false
62
- unlockSegment()
63
- }
64
- }
43
+
44
+ let addRecord, _record
45
+ if (!canUseEventBridge()) {
46
+ const session = sessionManager.findTrackedSession()
47
+ let isRecordErrorSessionReplay =
48
+ session && session.errorSessionReplayAllowed && !session.sessionHasError
49
+ var segmentCollection = startSegmentCollection(
50
+ lifeCycle,
51
+ configuration,
52
+ sessionManager,
53
+ viewContexts,
54
+ replayRequest,
55
+ encoder,
56
+ isRecordErrorSessionReplay
65
57
  )
66
- }
67
- let lastFullSnapshotEvent = null
68
- const wrappedEmit = (recordData) => {
69
- addRecord(recordData)
58
+ addRecord = segmentCollection.addRecord
59
+ let flushBufferSegment = segmentCollection.flushBufferSegment
60
+ let unlockSegment = segmentCollection.unlockSegment
61
+ cleanupTasks.push(segmentCollection.stop)
70
62
  if (isRecordErrorSessionReplay) {
71
- if (recordData.type === RecordType.FullSnapshot) {
72
- lastFullSnapshotEvent = recordData
73
- } else if (recordData.type === RecordType.IncrementalSnapshot) {
74
- const exceedTime =
75
- recordData.timestamp - lastFullSnapshotEvent.timestamp >
76
- BUFFER_CHECKOUT_TIME
77
- // If the time between the last full snapshot and the incremental snapshot is greater than the buffer time, we need to take a new full snapshot
78
- if (exceedTime) {
79
- flushBufferSegment(() => {
80
- deleteOldestStats()
81
- takeSubsequentFullSnapshot()
82
- })
63
+ sessionManager.sessionStateUpdateObservable.subscribe(
64
+ ({ previousState, newState }) => {
65
+ if (!previousState.hasError && newState.hasError) {
66
+ isRecordErrorSessionReplay = false
67
+ unlockSegment()
68
+ }
69
+ }
70
+ )
71
+ }
72
+ let lastFullSnapshotEvent = null
73
+ const wrappedEmit = (recordData) => {
74
+ addRecord(recordData)
75
+ if (isRecordErrorSessionReplay) {
76
+ if (recordData.type === RecordType.FullSnapshot) {
77
+ lastFullSnapshotEvent = recordData
78
+ } else if (recordData.type === RecordType.IncrementalSnapshot) {
79
+ const exceedTime =
80
+ recordData.timestamp - lastFullSnapshotEvent.timestamp >
81
+ BUFFER_CHECKOUT_TIME
82
+ // If the time between the last full snapshot and the incremental snapshot is greater than the buffer time, we need to take a new full snapshot
83
+ if (exceedTime) {
84
+ flushBufferSegment(() => {
85
+ deleteOldestStats()
86
+ takeSubsequentFullSnapshot()
87
+ })
88
+ }
83
89
  }
84
90
  }
85
91
  }
92
+ _record = record({
93
+ emit: wrappedEmit,
94
+ configuration: configuration,
95
+ lifeCycle: lifeCycle
96
+ })
97
+ } else {
98
+ ;({ addRecord } = startRecordBridge(viewContexts))
99
+ _record = record({
100
+ emit: addRecord,
101
+ configuration: configuration,
102
+ lifeCycle: lifeCycle
103
+ })
86
104
  }
87
-
88
- var _record = record({
89
- emit: wrappedEmit,
90
- configuration: configuration,
91
- lifeCycle: lifeCycle
92
- })
93
105
  cleanupTasks.push(_record.stop)
94
106
  var takeSubsequentFullSnapshot = _record.takeSubsequentFullSnapshot
95
107
  var flushMutations = _record.flushMutations
@@ -0,0 +1,14 @@
1
+ import { getEventBridge } from '@cloudcare/browser-core'
2
+
3
+ export function startRecordBridge(viewHistory) {
4
+ const bridge = getEventBridge()
5
+
6
+ return {
7
+ addRecord: (record) => {
8
+ // Get the current active view, not at the time of the record, aligning with the segment logic.
9
+ // This approach could potentially associate the record to an incorrect view, in case the record date is in the past (e.g. frustration records).
10
+ const view = viewHistory.findView()
11
+ bridge.send('session_replay', record, view.id)
12
+ }
13
+ }
14
+ }
@@ -79,15 +79,15 @@ export function trackViews(
79
79
  lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function () {
80
80
  currentView.end({ sessionIsActive: false })
81
81
  })
82
- // End the current view on page unload
83
- lifeCycle.subscribe(
84
- LifeCycleEventType.PAGE_EXITED,
85
- function (pageExitEvent) {
86
- if (pageExitEvent.reason === PageExitReason.UNLOADING) {
87
- currentView.end()
88
- }
89
- }
90
- )
82
+ // // End the current view on page unload
83
+ // lifeCycle.subscribe(
84
+ // LifeCycleEventType.PAGE_EXITED,
85
+ // function (pageExitEvent) {
86
+ // if (pageExitEvent.reason === PageExitReason.UNLOADING) {
87
+ // currentView.end()
88
+ // }
89
+ // }
90
+ // )
91
91
  }
92
92
 
93
93
  function renewViewOnLocationChange(locationChangeObservable) {
@@ -229,6 +229,14 @@ function newView(
229
229
  triggerViewUpdate,
230
230
  SESSION_KEEP_ALIVE_INTERVAL
231
231
  )
232
+ const pageMayExitSubscription = lifeCycle.subscribe(
233
+ LifeCycleEventType.PAGE_EXITED,
234
+ (pageMayExitEvent) => {
235
+ if (pageMayExitEvent.reason === PageExitReason.UNLOADING) {
236
+ triggerViewUpdate()
237
+ }
238
+ }
239
+ )
232
240
  triggerViewUpdate()
233
241
  // View context update should always be throttled
234
242
  contextManager.changeObservable.subscribe(scheduleViewUpdate)
@@ -297,6 +305,7 @@ function newView(
297
305
  clearInterval(keepAliveIntervalId)
298
306
  setViewEnd(endClocks.relative)
299
307
  stopCommonViewMetricsTracking()
308
+ pageMayExitSubscription.unsubscribe()
300
309
  triggerViewUpdate()
301
310
  setTimeout(function () {
302
311
  result.stop()
@@ -4,7 +4,9 @@ import {
4
4
  LifeCycleEventType,
5
5
  noop,
6
6
  Observable,
7
- timeStampNow
7
+ timeStampNow,
8
+ bridgeSupports,
9
+ BridgeCapability
8
10
  } from '@cloudcare/browser-core'
9
11
 
10
12
  export var RUM_SESSION_KEY = 'rum'
@@ -118,7 +120,9 @@ export function startRumSessionManagerStub() {
118
120
  plan: RumSessionPlan.WITHOUT_SESSION_REPLAY, // plan value should not be taken into account for mobile
119
121
  isErrorSession: false,
120
122
  sessionErrorTimestamp: 0,
121
- sessionReplayAllowed: false,
123
+ sessionReplayAllowed: bridgeSupports(BridgeCapability.RECORDS)
124
+ ? true
125
+ : false,
122
126
  errorSessionReplayAllowed: false,
123
127
  sessionHasError: false
124
128
  }
@@ -0,0 +1,65 @@
1
+ import { performDraw } from '@cloudcare/browser-core'
2
+
3
+ let sampleDecisionCache
4
+
5
+ export function isTraceSampled(sessionId, sampleRate) {
6
+ // Shortcuts for common cases. This is not strictly necessary, but it makes the code faster for
7
+ // customers willing to ingest all traces.
8
+ if (sampleRate === 100) {
9
+ return true
10
+ }
11
+
12
+ if (sampleRate === 0) {
13
+ return false
14
+ }
15
+
16
+ if (sampleDecisionCache && sessionId === sampleDecisionCache.sessionId) {
17
+ return sampleDecisionCache.decision
18
+ }
19
+
20
+ let decision
21
+ // @ts-expect-error BigInt might not be defined in every browser we support
22
+ if (window.BigInt) {
23
+ decision = sampleUsingKnuthFactor(
24
+ BigInt(`0x${sessionId.split('-')[4]}`),
25
+ sampleRate
26
+ )
27
+ } else {
28
+ // For simplicity, we don't use consistent sampling for browser without BigInt support
29
+ // TODO: remove this when all browser we support have BigInt support
30
+ decision = performDraw(sampleRate)
31
+ }
32
+ sampleDecisionCache = { sessionId, decision }
33
+ return decision
34
+ }
35
+
36
+ // Exported for tests
37
+ export function resetSampleDecisionCache() {
38
+ sampleDecisionCache = undefined
39
+ }
40
+
41
+ /**
42
+ * Perform sampling using the Knuth factor method. This method offer consistent sampling result
43
+ * based on the provided identifier.
44
+ *
45
+ * @param identifier The identifier to use for sampling.
46
+ * @param sampleRate The sample rate in percentage between 0 and 100.
47
+ */
48
+ export function sampleUsingKnuthFactor(identifier, sampleRate) {
49
+ // The formula is:
50
+ //
51
+ // (identifier * knuthFactor) % 2^64 < sampleRate * 2^64
52
+ //
53
+ // Because JavaScript numbers are 64-bit floats, we can't represent 64-bit integers, and the
54
+ // modulo would be incorrect. Thus, we are using BigInts here.
55
+
56
+ // Note: All implementations have slight variations. Some of them use '<=' instead of '<', and
57
+ // use `sampleRate * 2^64 - 1` instead of `sampleRate * 2^64`. The following implementation
58
+ // should adhere to the spec and is a bit simpler than using a 2^64-1 limit as there are less
59
+ // BigInt arithmetic to write. In practice this does not matter, as we are using floating point
60
+ // numbers in the end, and Number(2n**64n-1n) === Number(2n**64n).
61
+ const knuthFactor = BigInt('1111111111111111111')
62
+ const twoPow64 = BigInt('0x10000000000000000') // 2n ** 64n
63
+ const hash = (identifier * knuthFactor) % twoPow64
64
+ return Number(hash) <= (sampleRate / 100) * Number(twoPow64)
65
+ }
@@ -18,7 +18,7 @@ import { JaegerTracer } from './jaegerTracer'
18
18
  import { ZipkinSingleTracer } from './zipkinSingleTracer'
19
19
  import { ZipkinMultiTracer } from './zipkinMultiTracer'
20
20
  import { W3cTraceParentTracer } from './w3cTraceParentTracer'
21
-
21
+ import { isTraceSampled } from './sampler'
22
22
  export function isTracingOption(item) {
23
23
  var expectedItem = item
24
24
  return (
@@ -103,7 +103,8 @@ export function injectHeadersIfTracingAllowed(
103
103
  sessionManager,
104
104
  inject
105
105
  ) {
106
- if (!sessionManager.findTrackedSession()) {
106
+ const session = sessionManager.findTrackedSession()
107
+ if (!session) {
107
108
  return
108
109
  }
109
110
  var tracingOption = find(
@@ -115,9 +116,14 @@ export function injectHeadersIfTracingAllowed(
115
116
  if (!tracingOption) {
116
117
  return
117
118
  }
118
- var traceSampled =
119
- !isNumber(configuration.tracingSampleRate) ||
120
- performDraw(configuration.tracingSampleRate)
119
+ const traceSampled = isTraceSampled(
120
+ session.id,
121
+ configuration.tracingSampleRate
122
+ )
123
+
124
+ // var traceSampled =
125
+ // !isNumber(configuration.tracingSampleRate) ||
126
+ // performDraw(configuration.tracingSampleRate)
121
127
  var tracer,
122
128
  traceType = tracingOption.traceType
123
129
  switch (traceType) {