@sentry/browser 10.70.0 → 11.0.0-alpha.1

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 (344) hide show
  1. package/build/npm/cjs/dev/client.js +1 -0
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/eventbuilder.js +8 -8
  4. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  5. package/build/npm/cjs/dev/index.js +3 -9
  6. package/build/npm/cjs/dev/index.js.map +1 -1
  7. package/build/npm/cjs/dev/integrations/browsersession.js +1 -1
  8. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  9. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +2 -1
  10. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -1
  11. package/build/npm/cjs/dev/integrations/graphqlClient.js +4 -4
  12. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  13. package/build/npm/cjs/dev/integrations/httpclient.js +1 -6
  14. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  15. package/build/npm/cjs/dev/integrations/httpcontext.js +18 -10
  16. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  17. package/build/npm/cjs/dev/integrations/spanstreaming.js +4 -19
  18. package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
  19. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  20. package/build/npm/cjs/dev/integrations/view-hierarchy.js +1 -0
  21. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  22. package/build/npm/cjs/dev/integrations/webVitals.js +9 -14
  23. package/build/npm/cjs/dev/integrations/webVitals.js.map +1 -1
  24. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  25. package/build/npm/cjs/dev/profiling/integration.js +21 -91
  26. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  27. package/build/npm/cjs/dev/profiling/utils.js +1 -284
  28. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  29. package/build/npm/cjs/dev/sdk.js +10 -7
  30. package/build/npm/cjs/dev/sdk.js.map +1 -1
  31. package/build/npm/cjs/dev/tracing/backgroundtab.js +6 -2
  32. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  33. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +30 -42
  34. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  35. package/build/npm/cjs/dev/tracing/linkedTraces.js +4 -2
  36. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  37. package/build/npm/cjs/dev/tracing/request.js +10 -17
  38. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  39. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  40. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +2 -8
  41. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  42. package/build/npm/cjs/prod/client.js +1 -0
  43. package/build/npm/cjs/prod/client.js.map +1 -1
  44. package/build/npm/cjs/prod/eventbuilder.js +8 -8
  45. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  46. package/build/npm/cjs/prod/index.js +3 -9
  47. package/build/npm/cjs/prod/index.js.map +1 -1
  48. package/build/npm/cjs/prod/integrations/browsersession.js +1 -1
  49. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  50. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +2 -1
  51. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -1
  52. package/build/npm/cjs/prod/integrations/graphqlClient.js +4 -4
  53. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  54. package/build/npm/cjs/prod/integrations/httpclient.js +1 -6
  55. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  56. package/build/npm/cjs/prod/integrations/httpcontext.js +18 -10
  57. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  58. package/build/npm/cjs/prod/integrations/spanstreaming.js +4 -19
  59. package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
  60. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  61. package/build/npm/cjs/prod/integrations/view-hierarchy.js +1 -0
  62. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  63. package/build/npm/cjs/prod/integrations/webVitals.js +9 -14
  64. package/build/npm/cjs/prod/integrations/webVitals.js.map +1 -1
  65. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  66. package/build/npm/cjs/prod/profiling/integration.js +21 -91
  67. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  68. package/build/npm/cjs/prod/profiling/utils.js +1 -284
  69. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  70. package/build/npm/cjs/prod/sdk.js +10 -7
  71. package/build/npm/cjs/prod/sdk.js.map +1 -1
  72. package/build/npm/cjs/prod/tracing/backgroundtab.js +6 -2
  73. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  74. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +30 -42
  75. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  76. package/build/npm/cjs/prod/tracing/linkedTraces.js +4 -2
  77. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  78. package/build/npm/cjs/prod/tracing/request.js +10 -17
  79. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  80. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  81. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +2 -8
  82. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  83. package/build/npm/esm/dev/client.js +1 -0
  84. package/build/npm/esm/dev/client.js.map +1 -1
  85. package/build/npm/esm/dev/eventbuilder.js +8 -8
  86. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  87. package/build/npm/esm/dev/index.js +2 -2
  88. package/build/npm/esm/dev/integrations/browsersession.js +1 -1
  89. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  90. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +3 -2
  91. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -1
  92. package/build/npm/esm/dev/integrations/graphqlClient.js +6 -6
  93. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  94. package/build/npm/esm/dev/integrations/httpclient.js +1 -6
  95. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  96. package/build/npm/esm/dev/integrations/httpcontext.js +19 -11
  97. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  98. package/build/npm/esm/dev/integrations/spanstreaming.js +5 -21
  99. package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
  100. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  101. package/build/npm/esm/dev/integrations/view-hierarchy.js +1 -0
  102. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  103. package/build/npm/esm/dev/integrations/webVitals.js +10 -15
  104. package/build/npm/esm/dev/integrations/webVitals.js.map +1 -1
  105. package/build/npm/esm/dev/package.json +1 -1
  106. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  107. package/build/npm/esm/dev/profiling/integration.js +22 -92
  108. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  109. package/build/npm/esm/dev/profiling/utils.js +3 -273
  110. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  111. package/build/npm/esm/dev/sdk.js +11 -8
  112. package/build/npm/esm/dev/sdk.js.map +1 -1
  113. package/build/npm/esm/dev/tracing/backgroundtab.js +6 -2
  114. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  115. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +32 -44
  116. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  117. package/build/npm/esm/dev/tracing/linkedTraces.js +4 -2
  118. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  119. package/build/npm/esm/dev/tracing/request.js +12 -19
  120. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  121. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  122. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +2 -8
  123. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  124. package/build/npm/esm/prod/client.js +1 -0
  125. package/build/npm/esm/prod/client.js.map +1 -1
  126. package/build/npm/esm/prod/eventbuilder.js +8 -8
  127. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  128. package/build/npm/esm/prod/index.js +2 -2
  129. package/build/npm/esm/prod/integrations/browsersession.js +1 -1
  130. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  131. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +3 -2
  132. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -1
  133. package/build/npm/esm/prod/integrations/graphqlClient.js +6 -6
  134. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  135. package/build/npm/esm/prod/integrations/httpclient.js +1 -6
  136. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  137. package/build/npm/esm/prod/integrations/httpcontext.js +19 -11
  138. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  139. package/build/npm/esm/prod/integrations/spanstreaming.js +5 -21
  140. package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
  141. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  142. package/build/npm/esm/prod/integrations/view-hierarchy.js +1 -0
  143. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  144. package/build/npm/esm/prod/integrations/webVitals.js +10 -15
  145. package/build/npm/esm/prod/integrations/webVitals.js.map +1 -1
  146. package/build/npm/esm/prod/package.json +1 -1
  147. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  148. package/build/npm/esm/prod/profiling/integration.js +22 -92
  149. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  150. package/build/npm/esm/prod/profiling/utils.js +3 -273
  151. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  152. package/build/npm/esm/prod/sdk.js +11 -8
  153. package/build/npm/esm/prod/sdk.js.map +1 -1
  154. package/build/npm/esm/prod/tracing/backgroundtab.js +6 -2
  155. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  156. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +32 -44
  157. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  158. package/build/npm/esm/prod/tracing/linkedTraces.js +4 -2
  159. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  160. package/build/npm/esm/prod/tracing/request.js +12 -19
  161. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  162. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  163. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +2 -8
  164. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  165. package/build/npm/types/client.d.ts.map +1 -1
  166. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  167. package/build/npm/types/exports.d.ts +1 -1
  168. package/build/npm/types/exports.d.ts.map +1 -1
  169. package/build/npm/types/index.bundle.d.ts +2 -2
  170. package/build/npm/types/index.bundle.d.ts.map +1 -1
  171. package/build/npm/types/index.bundle.feedback.d.ts +2 -2
  172. package/build/npm/types/index.bundle.feedback.d.ts.map +1 -1
  173. package/build/npm/types/index.bundle.logs.metrics.d.ts +1 -1
  174. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  175. package/build/npm/types/index.bundle.replay.d.ts +2 -2
  176. package/build/npm/types/index.bundle.replay.d.ts.map +1 -1
  177. package/build/npm/types/index.bundle.replay.feedback.d.ts +2 -2
  178. package/build/npm/types/index.bundle.replay.feedback.d.ts.map +1 -1
  179. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +1 -1
  180. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  181. package/build/npm/types/index.bundle.tracing.d.ts +2 -2
  182. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  183. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +1 -1
  184. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  185. package/build/npm/types/index.bundle.tracing.replay.d.ts +2 -2
  186. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  187. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +2 -2
  188. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  189. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -1
  190. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  191. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +1 -1
  192. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  193. package/build/npm/types/index.d.ts +2 -2
  194. package/build/npm/types/index.d.ts.map +1 -1
  195. package/build/npm/types/integrations/browsersession.d.ts +3 -5
  196. package/build/npm/types/integrations/browsersession.d.ts.map +1 -1
  197. package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts.map +1 -1
  198. package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts +9 -9
  199. package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts.map +1 -1
  200. package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -1
  201. package/build/npm/types/integrations/graphqlClient.d.ts.map +1 -1
  202. package/build/npm/types/integrations/httpcontext.d.ts.map +1 -1
  203. package/build/npm/types/integrations/spanstreaming.d.ts +1 -0
  204. package/build/npm/types/integrations/spanstreaming.d.ts.map +1 -1
  205. package/build/npm/types/integrations/spotlight.d.ts +1 -1
  206. package/build/npm/types/integrations/usertiming.d.ts +2 -0
  207. package/build/npm/types/integrations/usertiming.d.ts.map +1 -0
  208. package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -1
  209. package/build/npm/types/integrations/webVitals.d.ts +1 -8
  210. package/build/npm/types/integrations/webVitals.d.ts.map +1 -1
  211. package/build/npm/types/integrations/webWorker.d.ts +1 -1
  212. package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
  213. package/build/npm/types/profiling/index.d.ts.map +1 -1
  214. package/build/npm/types/profiling/integration.d.ts.map +1 -1
  215. package/build/npm/types/profiling/utils.d.ts +1 -74
  216. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  217. package/build/npm/types/sdk.d.ts.map +1 -1
  218. package/build/npm/types/tracing/backgroundtab.d.ts.map +1 -1
  219. package/build/npm/types/tracing/browserTracingIntegration.d.ts +1 -47
  220. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  221. package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -1
  222. package/build/npm/types/tracing/request.d.ts +0 -13
  223. package/build/npm/types/tracing/request.d.ts.map +1 -1
  224. package/build/npm/types/utils/lazyLoadIntegration.d.ts +1 -1
  225. package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -1
  226. package/package.json +12 -21
  227. package/build/npm/cjs/dev/profiling/startProfileForSpan.js +0 -91
  228. package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +0 -1
  229. package/build/npm/cjs/prod/profiling/startProfileForSpan.js +0 -91
  230. package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +0 -1
  231. package/build/npm/esm/dev/profiling/startProfileForSpan.js +0 -89
  232. package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +0 -1
  233. package/build/npm/esm/prod/profiling/startProfileForSpan.js +0 -89
  234. package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +0 -1
  235. package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts +0 -2
  236. package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts.map +0 -1
  237. package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts +0 -2
  238. package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts.map +0 -1
  239. package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +0 -2
  240. package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts.map +0 -1
  241. package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts +0 -2
  242. package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts.map +0 -1
  243. package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts +0 -2
  244. package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts.map +0 -1
  245. package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts +0 -2
  246. package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts.map +0 -1
  247. package/build/npm/types/integrations-bundle/index.instrumentstategraph.d.ts +0 -2
  248. package/build/npm/types/integrations-bundle/index.instrumentstategraph.d.ts.map +0 -1
  249. package/build/npm/types/profiling/startProfileForSpan.d.ts +0 -8
  250. package/build/npm/types/profiling/startProfileForSpan.d.ts.map +0 -1
  251. package/build/npm/types-ts3.8/client.d.ts +0 -76
  252. package/build/npm/types-ts3.8/debug-build.d.ts +0 -7
  253. package/build/npm/types-ts3.8/diagnose-sdk.d.ts +0 -11
  254. package/build/npm/types-ts3.8/eventbuilder.d.ts +0 -40
  255. package/build/npm/types-ts3.8/exports.d.ts +0 -21
  256. package/build/npm/types-ts3.8/feedbackAsync.d.ts +0 -7
  257. package/build/npm/types-ts3.8/feedbackSync.d.ts +0 -4
  258. package/build/npm/types-ts3.8/helpers.d.ts +0 -27
  259. package/build/npm/types-ts3.8/index.bundle.base.d.ts +0 -2
  260. package/build/npm/types-ts3.8/index.bundle.d.ts +0 -5
  261. package/build/npm/types-ts3.8/index.bundle.feedback.d.ts +0 -7
  262. package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +0 -6
  263. package/build/npm/types-ts3.8/index.bundle.replay.d.ts +0 -6
  264. package/build/npm/types-ts3.8/index.bundle.replay.feedback.d.ts +0 -8
  265. package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +0 -7
  266. package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +0 -13
  267. package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +0 -13
  268. package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +0 -14
  269. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +0 -16
  270. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +0 -14
  271. package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +0 -14
  272. package/build/npm/types-ts3.8/index.d.ts +0 -38
  273. package/build/npm/types-ts3.8/integrations/breadcrumbs.d.ts +0 -16
  274. package/build/npm/types-ts3.8/integrations/browserapierrors.d.ts +0 -23
  275. package/build/npm/types-ts3.8/integrations/browserprofiling.d.ts +0 -2
  276. package/build/npm/types-ts3.8/integrations/browsersession.d.ts +0 -25
  277. package/build/npm/types-ts3.8/integrations/contextlines.d.ts +0 -32
  278. package/build/npm/types-ts3.8/integrations/culturecontext.d.ts +0 -18
  279. package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/index.d.ts +0 -2
  280. package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/integration.d.ts +0 -25
  281. package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/types.d.ts +0 -6
  282. package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/index.d.ts +0 -2
  283. package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/integration.d.ts +0 -27
  284. package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/types.d.ts +0 -44
  285. package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/index.d.ts +0 -2
  286. package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/integration.d.ts +0 -18
  287. package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/types.d.ts +0 -78
  288. package/build/npm/types-ts3.8/integrations/featureFlags/statsig/index.d.ts +0 -2
  289. package/build/npm/types-ts3.8/integrations/featureFlags/statsig/integration.d.ts +0 -30
  290. package/build/npm/types-ts3.8/integrations/featureFlags/statsig/types.d.ts +0 -14
  291. package/build/npm/types-ts3.8/integrations/featureFlags/unleash/index.d.ts +0 -2
  292. package/build/npm/types-ts3.8/integrations/featureFlags/unleash/integration.d.ts +0 -31
  293. package/build/npm/types-ts3.8/integrations/featureFlags/unleash/types.d.ts +0 -21
  294. package/build/npm/types-ts3.8/integrations/fetchStreamPerformance.d.ts +0 -16
  295. package/build/npm/types-ts3.8/integrations/globalhandlers.d.ts +0 -19
  296. package/build/npm/types-ts3.8/integrations/graphqlClient.d.ts +0 -60
  297. package/build/npm/types-ts3.8/integrations/httpclient.d.ts +0 -32
  298. package/build/npm/types-ts3.8/integrations/httpcontext.d.ts +0 -8
  299. package/build/npm/types-ts3.8/integrations/linkederrors.d.ts +0 -12
  300. package/build/npm/types-ts3.8/integrations/reportingobserver.d.ts +0 -12
  301. package/build/npm/types-ts3.8/integrations/spanstreaming.d.ts +0 -4
  302. package/build/npm/types-ts3.8/integrations/spotlight.d.ts +0 -21
  303. package/build/npm/types-ts3.8/integrations/view-hierarchy.d.ts +0 -51
  304. package/build/npm/types-ts3.8/integrations/webVitals.d.ts +0 -26
  305. package/build/npm/types-ts3.8/integrations/webWorker.d.ts +0 -129
  306. package/build/npm/types-ts3.8/integrations-bundle/index.captureconsole.d.ts +0 -2
  307. package/build/npm/types-ts3.8/integrations-bundle/index.createlangchaincallbackhandler.d.ts +0 -2
  308. package/build/npm/types-ts3.8/integrations-bundle/index.dedupe.d.ts +0 -2
  309. package/build/npm/types-ts3.8/integrations-bundle/index.extraerrordata.d.ts +0 -2
  310. package/build/npm/types-ts3.8/integrations-bundle/index.feedback.d.ts +0 -5
  311. package/build/npm/types-ts3.8/integrations-bundle/index.graphqlclient.d.ts +0 -2
  312. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentanthropicaiclient.d.ts +0 -2
  313. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +0 -2
  314. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlangchainembeddings.d.ts +0 -2
  315. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlanggraph.d.ts +0 -2
  316. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentopenaiclient.d.ts +0 -2
  317. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentstategraph.d.ts +0 -2
  318. package/build/npm/types-ts3.8/integrations-bundle/index.modulemetadata.d.ts +0 -2
  319. package/build/npm/types-ts3.8/integrations-bundle/index.rewriteframes.d.ts +0 -2
  320. package/build/npm/types-ts3.8/integrations-bundle/index.spotlight.d.ts +0 -2
  321. package/build/npm/types-ts3.8/normalizeStringifyValue.d.ts +0 -15
  322. package/build/npm/types-ts3.8/pluggable-exports-bundle/index.multiplexedtransport.d.ts +0 -2
  323. package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +0 -75
  324. package/build/npm/types-ts3.8/profiling/index.d.ts +0 -8
  325. package/build/npm/types-ts3.8/profiling/integration.d.ts +0 -4
  326. package/build/npm/types-ts3.8/profiling/jsSelfProfiling.d.ts +0 -41
  327. package/build/npm/types-ts3.8/profiling/startProfileForSpan.d.ts +0 -8
  328. package/build/npm/types-ts3.8/profiling/utils.d.ts +0 -112
  329. package/build/npm/types-ts3.8/report-dialog.d.ts +0 -8
  330. package/build/npm/types-ts3.8/sdk.d.ts +0 -62
  331. package/build/npm/types-ts3.8/stack-parsers.d.ts +0 -9
  332. package/build/npm/types-ts3.8/tracing/backgroundtab.d.ts +0 -6
  333. package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +0 -271
  334. package/build/npm/types-ts3.8/tracing/linkedTraces.d.ts +0 -52
  335. package/build/npm/types-ts3.8/tracing/reportPageLoaded.d.ts +0 -11
  336. package/build/npm/types-ts3.8/tracing/request.d.ts +0 -87
  337. package/build/npm/types-ts3.8/tracing/setActiveSpan.d.ts +0 -39
  338. package/build/npm/types-ts3.8/tracing/utils.d.ts +0 -17
  339. package/build/npm/types-ts3.8/transports/fetch.d.ts +0 -8
  340. package/build/npm/types-ts3.8/transports/offline.d.ts +0 -33
  341. package/build/npm/types-ts3.8/transports/types.d.ts +0 -6
  342. package/build/npm/types-ts3.8/userfeedback.d.ts +0 -10
  343. package/build/npm/types-ts3.8/utils/detectBrowserExtension.d.ts +0 -6
  344. package/build/npm/types-ts3.8/utils/lazyLoadIntegration.d.ts +0 -35
@@ -1,9 +1,7 @@
1
- import { defineIntegration, debug, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core/browser';
1
+ import { defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled, debug } from '@sentry/core/browser';
2
2
  import { DEBUG_BUILD } from '../debug-build.js';
3
3
  import { WINDOW } from '../helpers.js';
4
- import { startProfileForSpan } from './startProfileForSpan.js';
5
4
  import { UIProfiler } from './UIProfiler.js';
6
- import { hasLegacyProfiling, isAutomatedPageLoadSpan, shouldProfileSpanLegacy, PROFILED_ROOT_SPANS, setThreadAttributes, getActiveProfilesCount, findProfiledTransactionsFromEnvelope, takeProfileFromGlobalCache, createProfilingEvent, addProfilesToEnvelope } from './utils.js';
7
5
 
8
6
  const INTEGRATION_NAME = "BrowserProfiling";
9
7
  const _browserProfilingIntegration = (() => {
@@ -12,102 +10,34 @@ const _browserProfilingIntegration = (() => {
12
10
  setup(client) {
13
11
  const options = client.getOptions();
14
12
  const profiler = new UIProfiler();
15
- if (!hasLegacyProfiling(options) && !options.profileLifecycle) {
13
+ if (!options.profileLifecycle) {
16
14
  options.profileLifecycle = "manual";
17
15
  }
18
- if (hasLegacyProfiling(options) && !options.profilesSampleRate) {
19
- DEBUG_BUILD && debug.log("[Profiling] Profiling disabled, no profiling options found.");
20
- return;
21
- }
22
16
  const activeSpan = getActiveSpan();
23
17
  const rootSpan = activeSpan && getRootSpan(activeSpan);
24
- if (hasLegacyProfiling(options) && options.profileSessionSampleRate !== void 0) {
25
- DEBUG_BUILD && debug.warn(
26
- "[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled."
27
- );
28
- }
29
- if (!hasLegacyProfiling(options)) {
30
- const lifecycleMode = options.profileLifecycle;
31
- client.on("startUIProfiler", () => profiler.start());
32
- client.on("stopUIProfiler", () => profiler.stop());
33
- if (lifecycleMode === "manual") {
34
- profiler.initialize(client);
35
- } else if (lifecycleMode === "trace") {
36
- if (!hasSpansEnabled(options)) {
37
- DEBUG_BUILD && debug.warn(
38
- "[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing."
39
- );
40
- return;
41
- }
42
- profiler.initialize(client);
43
- if (rootSpan) {
44
- profiler.notifyRootSpanActive(rootSpan);
45
- }
46
- WINDOW.setTimeout(() => {
47
- const laterActiveSpan = getActiveSpan();
48
- const laterRootSpan = laterActiveSpan && getRootSpan(laterActiveSpan);
49
- if (laterRootSpan) {
50
- profiler.notifyRootSpanActive(laterRootSpan);
51
- }
52
- }, 0);
18
+ const lifecycleMode = options.profileLifecycle;
19
+ client.on("startUIProfiler", () => profiler.start());
20
+ client.on("stopUIProfiler", () => profiler.stop());
21
+ if (lifecycleMode === "manual") {
22
+ profiler.initialize(client);
23
+ } else if (lifecycleMode === "trace") {
24
+ if (!hasSpansEnabled(options)) {
25
+ DEBUG_BUILD && debug.warn(
26
+ "[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing."
27
+ );
28
+ return;
53
29
  }
54
- } else {
55
- if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) {
56
- if (shouldProfileSpanLegacy(rootSpan)) {
57
- startProfileForSpan(rootSpan);
58
- }
30
+ profiler.initialize(client);
31
+ if (rootSpan) {
32
+ profiler.notifyRootSpanActive(rootSpan);
59
33
  }
60
- client.on("spanStart", (span) => {
61
- const rootSpan2 = getRootSpan(span);
62
- if (span === rootSpan2) {
63
- if (shouldProfileSpanLegacy(span)) {
64
- startProfileForSpan(span);
65
- }
66
- } else if (PROFILED_ROOT_SPANS.has(rootSpan2)) {
67
- setThreadAttributes(span);
68
- }
69
- });
70
- client.on("beforeEnvelope", (envelope) => {
71
- if (!getActiveProfilesCount()) {
72
- return;
73
- }
74
- const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope);
75
- if (!profiledTransactionEvents.length) {
76
- return;
77
- }
78
- const profilesToAddToEnvelope = [];
79
- for (const profiledTransaction of profiledTransactionEvents) {
80
- const context = profiledTransaction?.contexts;
81
- const profile_id = context?.profile?.["profile_id"];
82
- const start_timestamp = context?.profile?.["start_timestamp"];
83
- if (typeof profile_id !== "string") {
84
- DEBUG_BUILD && debug.log("[Profiling] cannot find profile for a span without a profile context");
85
- continue;
86
- }
87
- if (!profile_id) {
88
- DEBUG_BUILD && debug.log("[Profiling] cannot find profile for a span without a profile context");
89
- continue;
90
- }
91
- if (context?.profile) {
92
- delete context.profile;
93
- }
94
- const profile = takeProfileFromGlobalCache(profile_id);
95
- if (!profile) {
96
- DEBUG_BUILD && debug.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`);
97
- continue;
98
- }
99
- const profileEvent = createProfilingEvent(
100
- profile_id,
101
- start_timestamp,
102
- profile,
103
- profiledTransaction
104
- );
105
- if (profileEvent) {
106
- profilesToAddToEnvelope.push(profileEvent);
107
- }
34
+ WINDOW.setTimeout(() => {
35
+ const laterActiveSpan = getActiveSpan();
36
+ const laterRootSpan = laterActiveSpan && getRootSpan(laterActiveSpan);
37
+ if (laterRootSpan) {
38
+ profiler.notifyRootSpanActive(laterRootSpan);
108
39
  }
109
- addProfilesToEnvelope(envelope, profilesToAddToEnvelope);
110
- });
40
+ }, 0);
111
41
  }
112
42
  }
113
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../src/profiling/integration.ts"],"sourcesContent":["import type { EventEnvelope, IntegrationFn, Profile, Span } from '@sentry/core/browser';\nimport { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core/browser';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport { startProfileForSpan } from './startProfileForSpan';\nimport { UIProfiler } from './UIProfiler';\nimport type { ProfiledEvent } from './utils';\nimport {\n addProfilesToEnvelope,\n createProfilingEvent,\n findProfiledTransactionsFromEnvelope,\n getActiveProfilesCount,\n hasLegacyProfiling,\n isAutomatedPageLoadSpan,\n PROFILED_ROOT_SPANS,\n setThreadAttributes,\n shouldProfileSpanLegacy,\n takeProfileFromGlobalCache,\n} from './utils';\n\nconst INTEGRATION_NAME = 'BrowserProfiling' as const;\n\nconst _browserProfilingIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const options = client.getOptions() as BrowserOptions;\n const profiler = new UIProfiler();\n\n if (!hasLegacyProfiling(options) && !options.profileLifecycle) {\n // Set default lifecycle mode\n options.profileLifecycle = 'manual';\n }\n\n // eslint-disable-next-line typescript/no-deprecated\n if (hasLegacyProfiling(options) && !options.profilesSampleRate) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling disabled, no profiling options found.');\n return;\n }\n\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n\n if (hasLegacyProfiling(options) && options.profileSessionSampleRate !== undefined) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled.',\n );\n }\n\n // UI PROFILING (Profiling V2)\n if (!hasLegacyProfiling(options)) {\n const lifecycleMode = options.profileLifecycle;\n\n // Registering hooks in all lifecycle modes to be able to notify users in case they want to start/stop the profiler manually in `trace` mode\n client.on('startUIProfiler', () => profiler.start());\n client.on('stopUIProfiler', () => profiler.stop());\n\n if (lifecycleMode === 'manual') {\n profiler.initialize(client);\n } else if (lifecycleMode === 'trace') {\n if (!hasSpansEnabled(options)) {\n DEBUG_BUILD &&\n debug.warn(\n \"[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.\",\n );\n return;\n }\n\n profiler.initialize(client);\n\n // If there is an active, sampled root span already, notify the profiler\n if (rootSpan) {\n profiler.notifyRootSpanActive(rootSpan);\n }\n\n // In case rootSpan is created slightly after setup -> schedule microtask to re-check and notify.\n WINDOW.setTimeout(() => {\n const laterActiveSpan = getActiveSpan();\n const laterRootSpan = laterActiveSpan && getRootSpan(laterActiveSpan);\n if (laterRootSpan) {\n profiler.notifyRootSpanActive(laterRootSpan);\n }\n }, 0);\n }\n } else {\n // LEGACY PROFILING (v1)\n if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) {\n if (shouldProfileSpanLegacy(rootSpan)) {\n startProfileForSpan(rootSpan);\n }\n }\n\n client.on('spanStart', (span: Span) => {\n const rootSpan = getRootSpan(span);\n if (span === rootSpan) {\n if (shouldProfileSpanLegacy(span)) {\n startProfileForSpan(span);\n }\n } else if (PROFILED_ROOT_SPANS.has(rootSpan)) {\n setThreadAttributes(span);\n }\n });\n\n client.on('beforeEnvelope', (envelope): void => {\n // if not profiles are in queue, there is nothing to add to the envelope.\n if (!getActiveProfilesCount()) {\n return;\n }\n\n const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope);\n if (!profiledTransactionEvents.length) {\n return;\n }\n\n const profilesToAddToEnvelope: Profile[] = [];\n\n for (const profiledTransaction of profiledTransactionEvents) {\n const context = profiledTransaction?.contexts;\n const profile_id = context?.profile?.['profile_id'];\n const start_timestamp = context?.profile?.['start_timestamp'];\n\n if (typeof profile_id !== 'string') {\n DEBUG_BUILD && debug.log('[Profiling] cannot find profile for a span without a profile context');\n continue;\n }\n\n if (!profile_id) {\n DEBUG_BUILD && debug.log('[Profiling] cannot find profile for a span without a profile context');\n continue;\n }\n\n // Remove the profile from the span context before sending, relay will take care of the rest.\n if (context?.profile) {\n delete context.profile;\n }\n\n const profile = takeProfileFromGlobalCache(profile_id);\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`);\n continue;\n }\n\n const profileEvent = createProfilingEvent(\n profile_id,\n start_timestamp as number | undefined,\n profile,\n profiledTransaction as ProfiledEvent,\n );\n if (profileEvent) {\n profilesToAddToEnvelope.push(profileEvent);\n }\n }\n\n addProfilesToEnvelope(envelope as EventEnvelope, profilesToAddToEnvelope);\n });\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration);\n"],"names":["rootSpan"],"mappings":";;;;;;;AAqBA,MAAM,gBAAA,GAAmB,kBAAA;AAEzB,MAAM,gCAAgC,MAAM;AAC1C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAQ;AACZ,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAClC,MAAA,MAAM,QAAA,GAAW,IAAI,UAAA,EAAW;AAEhC,MAAA,IAAI,CAAC,kBAAA,CAAmB,OAAO,CAAA,IAAK,CAAC,QAAQ,gBAAA,EAAkB;AAE7D,QAAA,OAAA,CAAQ,gBAAA,GAAmB,QAAA;AAAA,MAC7B;AAGA,MAAA,IAAI,kBAAA,CAAmB,OAAO,CAAA,IAAK,CAAC,QAAQ,kBAAA,EAAoB;AAC9D,QAAA,WAAA,IAAe,KAAA,CAAM,IAAI,6DAA6D,CAAA;AACtF,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,aAAa,aAAA,EAAc;AACjC,MAAA,MAAM,QAAA,GAAW,UAAA,IAAc,WAAA,CAAY,UAAU,CAAA;AAErD,MAAA,IAAI,kBAAA,CAAmB,OAAO,CAAA,IAAK,OAAA,CAAQ,6BAA6B,MAAA,EAAW;AACjF,QAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,UACJ;AAAA,SACF;AAAA,MACJ;AAGA,MAAA,IAAI,CAAC,kBAAA,CAAm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A,IAAe,KAAA,CAAM,GAAA,CAAI,CAAA,iDAAA,EAAoD,UAAU,CAAA,CAAE,CAAA;AACzF,cAAA;AAAA,YACF;AAEA,YAAA,MAAM,YAAA,GAAe,oBAAA;AAAA,cACnB,UAAA;AAAA,cACA,eAAA;AAAA,cACA,OAAA;AAAA,cACA;AAAA,aACF;AACA,YAAA,IAAI,YAAA,EAAc;AAChB,cAAA,uBAAA,CAAwB,KAAK,YAAY,CAAA;AAAA,YAC3C;AAAA,UACF;AAEA,UAAA,qBAAA,CAAsB,UAA2B,uBAAuB,CAAA;AAAA,QAC1E,CAAC,CAAA;AAAA,MACH;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,2BAAA,GAA8B,kBAAkB,4BAA4B;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../src/profiling/integration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core/browser';\nimport { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core/browser';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport { UIProfiler } from './UIProfiler';\n\nconst INTEGRATION_NAME = 'BrowserProfiling' as const;\n\nconst _browserProfilingIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const options = client.getOptions() as BrowserOptions;\n const profiler = new UIProfiler();\n\n if (!options.profileLifecycle) {\n // Set default lifecycle mode\n options.profileLifecycle = 'manual';\n }\n\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n const lifecycleMode = options.profileLifecycle;\n\n // Registering hooks in all lifecycle modes to be able to notify users in case they want to start/stop the profiler manually in `trace` mode\n client.on('startUIProfiler', () => profiler.start());\n client.on('stopUIProfiler', () => profiler.stop());\n\n if (lifecycleMode === 'manual') {\n profiler.initialize(client);\n } else if (lifecycleMode === 'trace') {\n if (!hasSpansEnabled(options)) {\n DEBUG_BUILD &&\n debug.warn(\n \"[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.\",\n );\n return;\n }\n\n profiler.initialize(client);\n\n // If there is an active, sampled root span already, notify the profiler\n if (rootSpan) {\n profiler.notifyRootSpanActive(rootSpan);\n }\n\n // In case rootSpan is created slightly after setup -> schedule microtask to re-check and notify.\n WINDOW.setTimeout(() => {\n const laterActiveSpan = getActiveSpan();\n const laterRootSpan = laterActiveSpan && getRootSpan(laterActiveSpan);\n if (laterRootSpan) {\n profiler.notifyRootSpanActive(laterRootSpan);\n }\n }, 0);\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,gBAAA,GAAmB,kBAAA;AAEzB,MAAM,gCAAgC,MAAM;AAC1C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAQ;AACZ,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAClC,MAAA,MAAM,QAAA,GAAW,IAAI,UAAA,EAAW;AAEhC,MAAA,IAAI,CAAC,QAAQ,gBAAA,EAAkB;AAE7B,QAAA,OAAA,CAAQ,gBAAA,GAAmB,QAAA;AAAA,MAC7B;AAEA,MAAA,MAAM,aAAa,aAAA,EAAc;AACjC,MAAA,MAAM,QAAA,GAAW,UAAA,IAAc,WAAA,CAAY,UAAU,CAAA;AACrD,MAAA,MAAM,gBAAgB,OAAA,CAAQ,gBAAA;AAG9B,MAAA,MAAA,CAAO,EAAA,CAAG,iBAAA,EAAmB,MAAM,QAAA,CAAS,OAAO,CAAA;AACnD,MAAA,MAAA,CAAO,EAAA,CAAG,gBAAA,EAAkB,MAAM,QAAA,CAAS,MAAM,CAAA;AAEjD,MAAA,IAAI,kBAAkB,QAAA,EAAU;AAC9B,QAAA,QAAA,CAAS,WAAW,MAAM,CAAA;AAAA,MAC5B,CAAA,MAAA,IAAW,kBAAkB,OAAA,EAAS;AACpC,QAAA,IAAI,CAAC,eAAA,CAAgB,OAAO,CAAA,EAAG;AAC7B,UAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,YACJ;AAAA,WACF;AACF,UAAA;AAAA,QACF;AAEA,QAAA,QAAA,CAAS,WAAW,MAAM,CAAA;AAG1B,QAAA,IAAI,QAAA,EAAU;AACZ,UAAA,QAAA,CAAS,qBAAqB,QAAQ,CAAA;AAAA,QACxC;AAGA,QAAA,MAAA,CAAO,WAAW,MAAM;AACtB,UAAA,MAAM,kBAAkB,aAAA,EAAc;AACtC,UAAA,MAAM,aAAA,GAAgB,eAAA,IAAmB,WAAA,CAAY,eAAe,CAAA;AACpE,UAAA,IAAI,aAAA,EAAe;AACjB,YAAA,QAAA,CAAS,qBAAqB,aAAa,CAAA;AAAA,UAC7C;AAAA,QACF,GAAG,CAAC,CAAA;AAAA,MACN;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,2BAAA,GAA8B,kBAAkB,4BAA4B;;;;"}
@@ -1,108 +1,10 @@
1
- import { GLOBAL_OBJ, spanToJSON, debug, getClient, forEachEnvelopeItem, uuid4, timestampInSeconds, DEFAULT_ENVIRONMENT, browserPerformanceTimeOrigin, getDebugImagesForResources } from '@sentry/core/browser';
1
+ import { GLOBAL_OBJ, debug, uuid4, browserPerformanceTimeOrigin, getClient, getDebugImagesForResources } from '@sentry/core/browser';
2
2
  import { DEBUG_BUILD } from '../debug-build.js';
3
3
  import { WINDOW } from '../helpers.js';
4
4
 
5
- const MS_TO_NS = 1e6;
6
5
  const isMainThread = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === "undefined";
7
6
  const PROFILER_THREAD_ID_STRING = String(0);
8
7
  const PROFILER_THREAD_NAME = isMainThread ? "main" : "worker";
9
- const navigator = WINDOW.navigator;
10
- let OS_PLATFORM = "";
11
- let OS_PLATFORM_VERSION = "";
12
- let OS_ARCH = "";
13
- let OS_BROWSER = navigator?.userAgent || "";
14
- let OS_MODEL = "";
15
- const OS_LOCALE = navigator?.language || navigator?.languages?.[0] || "";
16
- function isUserAgentData(data) {
17
- return typeof data === "object" && data !== null && "getHighEntropyValues" in data;
18
- }
19
- const userAgentData = navigator?.userAgentData;
20
- if (isUserAgentData(userAgentData)) {
21
- userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => {
22
- OS_PLATFORM = ua.platform || "";
23
- OS_ARCH = ua.architecture || "";
24
- OS_MODEL = ua.model || "";
25
- OS_PLATFORM_VERSION = ua.platformVersion || "";
26
- if (ua.fullVersionList?.length) {
27
- const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1];
28
- OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;
29
- }
30
- }).catch((e) => void 0);
31
- }
32
- function isProcessedJSSelfProfile(profile) {
33
- return !("thread_metadata" in profile);
34
- }
35
- function enrichWithThreadInformation(profile) {
36
- if (!isProcessedJSSelfProfile(profile)) {
37
- return profile;
38
- }
39
- return convertJSSelfProfileToSampledFormat(profile);
40
- }
41
- function getTraceId(event) {
42
- const traceId = event.contexts?.trace?.trace_id;
43
- if (typeof traceId === "string" && traceId.length !== 32) {
44
- if (DEBUG_BUILD) {
45
- debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
46
- }
47
- }
48
- if (typeof traceId !== "string") {
49
- return "";
50
- }
51
- return traceId;
52
- }
53
- function createProfilePayload(profile_id, start_timestamp, processed_profile, event) {
54
- if (event.type !== "transaction") {
55
- throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");
56
- }
57
- if (processed_profile === void 0 || processed_profile === null) {
58
- throw new TypeError(
59
- `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`
60
- );
61
- }
62
- const traceId = getTraceId(event);
63
- const enrichedThreadProfile = enrichWithThreadInformation(processed_profile);
64
- const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : timestampInSeconds() * 1e3;
65
- const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : timestampInSeconds() * 1e3;
66
- const profile = {
67
- event_id: profile_id,
68
- timestamp: new Date(transactionStartMs).toISOString(),
69
- platform: "javascript",
70
- version: "1",
71
- release: event.release || "",
72
- environment: event.environment || DEFAULT_ENVIRONMENT,
73
- runtime: {
74
- name: "javascript",
75
- version: WINDOW.navigator.userAgent
76
- },
77
- os: {
78
- name: OS_PLATFORM,
79
- version: OS_PLATFORM_VERSION,
80
- build_number: OS_BROWSER
81
- },
82
- device: {
83
- locale: OS_LOCALE,
84
- model: OS_MODEL,
85
- manufacturer: OS_BROWSER,
86
- architecture: OS_ARCH,
87
- is_emulator: false
88
- },
89
- debug_meta: {
90
- images: applyDebugMetadata(processed_profile.resources)
91
- },
92
- profile: enrichedThreadProfile,
93
- transactions: [
94
- {
95
- name: event.transaction || "",
96
- id: event.event_id || uuid4(),
97
- trace_id: traceId,
98
- active_thread_id: PROFILER_THREAD_ID_STRING,
99
- relative_start_ns: "0",
100
- relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0)
101
- }
102
- ]
103
- };
104
- return profile;
105
- }
106
8
  function createProfileChunkPayload(jsSelfProfile, client, profilerId) {
107
9
  if (jsSelfProfile == null) {
108
10
  throw new TypeError(
@@ -214,94 +116,6 @@ function convertToContinuousProfile(input) {
214
116
  thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } }
215
117
  };
216
118
  }
217
- function isAutomatedPageLoadSpan(span) {
218
- return spanToJSON(span).op === "pageload";
219
- }
220
- function convertJSSelfProfileToSampledFormat(input) {
221
- let EMPTY_STACK_ID = void 0;
222
- let STACK_ID = 0;
223
- const profile = {
224
- samples: [],
225
- stacks: [],
226
- frames: [],
227
- thread_metadata: {
228
- [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME }
229
- }
230
- };
231
- const firstSample = input.samples[0];
232
- if (!firstSample) {
233
- return profile;
234
- }
235
- const start = firstSample.timestamp;
236
- const perfOrigin = browserPerformanceTimeOrigin();
237
- const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
238
- const adjustForOriginChange = origin - (perfOrigin || origin);
239
- input.samples.forEach((jsSample, i) => {
240
- if (jsSample.stackId === void 0) {
241
- if (EMPTY_STACK_ID === void 0) {
242
- EMPTY_STACK_ID = STACK_ID;
243
- profile.stacks[EMPTY_STACK_ID] = [];
244
- STACK_ID++;
245
- }
246
- profile["samples"][i] = {
247
- // convert ms timestamp to ns
248
- elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
249
- stack_id: EMPTY_STACK_ID,
250
- thread_id: PROFILER_THREAD_ID_STRING
251
- };
252
- return;
253
- }
254
- let stackTop = input.stacks[jsSample.stackId];
255
- const stack = [];
256
- while (stackTop) {
257
- stack.push(stackTop.frameId);
258
- const frame = input.frames[stackTop.frameId];
259
- if (frame && profile.frames[stackTop.frameId] === void 0) {
260
- profile.frames[stackTop.frameId] = {
261
- function: frame.name,
262
- abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0,
263
- lineno: frame.line,
264
- colno: frame.column
265
- };
266
- }
267
- stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId];
268
- }
269
- const sample = {
270
- // convert ms timestamp to ns
271
- elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
272
- stack_id: STACK_ID,
273
- thread_id: PROFILER_THREAD_ID_STRING
274
- };
275
- profile["stacks"][STACK_ID] = stack;
276
- profile["samples"][i] = sample;
277
- STACK_ID++;
278
- });
279
- return profile;
280
- }
281
- function addProfilesToEnvelope(envelope, profiles) {
282
- if (!profiles.length) {
283
- return envelope;
284
- }
285
- for (const profile of profiles) {
286
- envelope[1].push([{ type: "profile" }, profile]);
287
- }
288
- return envelope;
289
- }
290
- function findProfiledTransactionsFromEnvelope(envelope) {
291
- const events = [];
292
- forEachEnvelopeItem(envelope, (item, type) => {
293
- if (type !== "transaction") {
294
- return;
295
- }
296
- for (let j = 1; j < item.length; j++) {
297
- const event = item[j];
298
- if (event?.contexts?.profile?.profile_id) {
299
- events.push(item[j]);
300
- }
301
- }
302
- });
303
- return events;
304
- }
305
119
  function applyDebugMetadata(resource_paths) {
306
120
  const client = getClient();
307
121
  const options = client?.getOptions();
@@ -329,21 +143,6 @@ function isValidSampleRate(rate) {
329
143
  }
330
144
  return true;
331
145
  }
332
- function isValidProfile(profile) {
333
- if (profile.samples.length < 2) {
334
- if (DEBUG_BUILD) {
335
- debug.log("[Profiling] Discarding profile because it contains less than 2 samples");
336
- }
337
- return false;
338
- }
339
- if (!profile.frames.length) {
340
- if (DEBUG_BUILD) {
341
- debug.log("[Profiling] Discarding profile because it contains no frames");
342
- }
343
- return false;
344
- }
345
- return true;
346
- }
347
146
  let PROFILING_CONSTRUCTOR_FAILED = false;
348
147
  const MAX_PROFILE_DURATION_MS = 3e4;
349
148
  function isJSProfilerSupported(maybeProfiler) {
@@ -361,7 +160,7 @@ function startJSSelfProfile() {
361
160
  const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);
362
161
  try {
363
162
  return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
364
- } catch (_e) {
163
+ } catch {
365
164
  if (DEBUG_BUILD) {
366
165
  debug.log(
367
166
  "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."
@@ -372,45 +171,6 @@ function startJSSelfProfile() {
372
171
  }
373
172
  return;
374
173
  }
375
- function shouldProfileSpanLegacy(span) {
376
- if (PROFILING_CONSTRUCTOR_FAILED) {
377
- if (DEBUG_BUILD) {
378
- debug.log("[Profiling] Profiling has been disabled for the duration of the current user session.");
379
- }
380
- return false;
381
- }
382
- if (!span.isRecording()) {
383
- DEBUG_BUILD && debug.log("[Profiling] Discarding profile because root span was not sampled.");
384
- return false;
385
- }
386
- const client = getClient();
387
- const options = client?.getOptions();
388
- if (!options) {
389
- DEBUG_BUILD && debug.log("[Profiling] Profiling disabled, no options found.");
390
- return false;
391
- }
392
- const profilesSampleRate = options.profilesSampleRate;
393
- if (!isValidSampleRate(profilesSampleRate)) {
394
- DEBUG_BUILD && debug.warn("[Profiling] Discarding profile because of invalid sample rate.");
395
- return false;
396
- }
397
- if (!profilesSampleRate) {
398
- DEBUG_BUILD && debug.log(
399
- "[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"
400
- );
401
- return false;
402
- }
403
- const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate;
404
- if (!sampled) {
405
- DEBUG_BUILD && debug.log(
406
- `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
407
- profilesSampleRate
408
- )})`
409
- );
410
- return false;
411
- }
412
- return true;
413
- }
414
174
  function shouldProfileSession(options) {
415
175
  if (PROFILING_CONSTRUCTOR_FAILED) {
416
176
  if (DEBUG_BUILD) {
@@ -435,40 +195,10 @@ function shouldProfileSession(options) {
435
195
  }
436
196
  return Math.random() <= profileSessionSampleRate;
437
197
  }
438
- function hasLegacyProfiling(options) {
439
- return typeof options.profilesSampleRate !== "undefined";
440
- }
441
- function createProfilingEvent(profile_id, start_timestamp, profile, event) {
442
- if (!isValidProfile(profile)) {
443
- return null;
444
- }
445
- return createProfilePayload(profile_id, start_timestamp, profile, event);
446
- }
447
- const PROFILE_MAP = /* @__PURE__ */ new Map();
448
- function getActiveProfilesCount() {
449
- return PROFILE_MAP.size;
450
- }
451
- function takeProfileFromGlobalCache(profile_id) {
452
- const profile = PROFILE_MAP.get(profile_id);
453
- if (profile) {
454
- PROFILE_MAP.delete(profile_id);
455
- }
456
- return profile;
457
- }
458
- function addProfileToGlobalCache(profile_id, profile) {
459
- PROFILE_MAP.set(profile_id, profile);
460
- if (PROFILE_MAP.size > 30) {
461
- const last = PROFILE_MAP.keys().next().value;
462
- if (last !== void 0) {
463
- PROFILE_MAP.delete(last);
464
- }
465
- }
466
- }
467
- const PROFILED_ROOT_SPANS = /* @__PURE__ */ new WeakSet();
468
198
  function setThreadAttributes(span) {
469
199
  span.setAttribute("thread.id", PROFILER_THREAD_ID_STRING);
470
200
  span.setAttribute("thread.name", PROFILER_THREAD_NAME);
471
201
  }
472
202
 
473
- export { MAX_PROFILE_DURATION_MS, PROFILED_ROOT_SPANS, PROFILER_THREAD_ID_STRING, PROFILER_THREAD_NAME, addProfileToGlobalCache, addProfilesToEnvelope, applyDebugMetadata, convertJSSelfProfileToSampledFormat, createProfileChunkPayload, createProfilePayload, createProfilingEvent, enrichWithThreadInformation, findProfiledTransactionsFromEnvelope, getActiveProfilesCount, hasLegacyProfiling, isAutomatedPageLoadSpan, isValidSampleRate, setThreadAttributes, shouldProfileSession, shouldProfileSpanLegacy, startJSSelfProfile, takeProfileFromGlobalCache, validateProfileChunk };
203
+ export { MAX_PROFILE_DURATION_MS, PROFILER_THREAD_ID_STRING, PROFILER_THREAD_NAME, applyDebugMetadata, createProfileChunkPayload, isValidSampleRate, setThreadAttributes, shouldProfileSession, startJSSelfProfile, validateProfileChunk };
474
204
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/profiling/utils.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n Envelope,\n Event,\n EventEnvelope,\n Profile,\n ProfileChunk,\n Span,\n ThreadCpuProfile,\n} from '@sentry/core/browser';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n DEFAULT_ENVIRONMENT,\n forEachEnvelopeItem,\n getClient,\n getDebugImagesForResources,\n GLOBAL_OBJ,\n spanToJSON,\n timestampInSeconds,\n uuid4,\n} from '@sentry/core/browser';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor, JSSelfProfileStack } from './jsSelfProfiling';\n\nconst MS_TO_NS = 1e6;\n\n// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers\nconst isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';\n\n// Setting ID to 0 as we cannot get an ID from Web Workers\nexport const PROFILER_THREAD_ID_STRING = String(0);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\n\n// We force make this optional to be on the safe side...\nconst navigator = WINDOW.navigator as typeof WINDOW.navigator | undefined;\n\n// Machine properties (eval only once)\nlet OS_PLATFORM = '';\nlet OS_PLATFORM_VERSION = '';\nlet OS_ARCH = '';\nlet OS_BROWSER = navigator?.userAgent || '';\nlet OS_MODEL = '';\nconst OS_LOCALE = navigator?.language || navigator?.languages?.[0] || '';\n\ntype UAData = {\n platform?: string;\n architecture?: string;\n model?: string;\n platformVersion?: string;\n fullVersionList?: {\n brand: string;\n version: string;\n }[];\n};\n\ninterface UserAgentData {\n getHighEntropyValues: (keys: string[]) => Promise<UAData>;\n}\n\nfunction isUserAgentData(data: unknown): data is UserAgentData {\n return typeof data === 'object' && data !== null && 'getHighEntropyValues' in data;\n}\n\n// @ts-expect-error userAgentData is not part of the navigator interface yet\nconst userAgentData = navigator?.userAgentData;\n\nif (isUserAgentData(userAgentData)) {\n userAgentData\n .getHighEntropyValues(['architecture', 'model', 'platform', 'platformVersion', 'fullVersionList'])\n .then((ua: UAData) => {\n OS_PLATFORM = ua.platform || '';\n OS_ARCH = ua.architecture || '';\n OS_MODEL = ua.model || '';\n OS_PLATFORM_VERSION = ua.platformVersion || '';\n\n if (ua.fullVersionList?.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1]!;\n OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;\n }\n })\n .catch(e => void e);\n}\n\nfunction isProcessedJSSelfProfile(profile: ThreadCpuProfile | JSSelfProfile): profile is JSSelfProfile {\n return !('thread_metadata' in profile);\n}\n\n// Enriches the profile with threadId of the current thread.\n// This is done in node as we seem to not be able to get the info from C native code.\n/**\n *\n */\nexport function enrichWithThreadInformation(profile: ThreadCpuProfile | JSSelfProfile): ThreadCpuProfile {\n if (!isProcessedJSSelfProfile(profile)) {\n return profile;\n }\n\n return convertJSSelfProfileToSampledFormat(profile);\n}\n\n// Profile is marked as optional because it is deleted from the metadata\n// by the integration before the event is processed by other integrations.\nexport interface ProfiledEvent extends Event {\n sdkProcessingMetadata: {\n profile?: JSSelfProfile;\n };\n}\n\nfunction getTraceId(event: Event): string {\n const traceId: unknown = event.contexts?.trace?.trace_id;\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (typeof traceId === 'string' && traceId.length !== 32) {\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);\n }\n }\n if (typeof traceId !== 'string') {\n return '';\n }\n\n return traceId;\n}\n/**\n * Creates a profiling event envelope from a Sentry event. If profile does not pass\n * validation, returns null.\n * @param event\n * @param dsn\n * @param metadata\n * @param tunnel\n * @returns {EventEnvelope | null}\n */\n\n/**\n * Creates a profiling event envelope from a Sentry event.\n */\nexport function createProfilePayload(\n profile_id: string,\n start_timestamp: number | undefined,\n processed_profile: JSSelfProfile,\n event: ProfiledEvent,\n): Profile {\n if (event.type !== 'transaction') {\n // createProfilingEventEnvelope should only be called for transactions,\n // we type guard this behavior with isProfiledTransactionEvent.\n throw new TypeError('Profiling events may only be attached to transactions, this should never occur.');\n }\n\n if (processed_profile === undefined || processed_profile === null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`,\n );\n }\n\n const traceId = getTraceId(event);\n const enrichedThreadProfile = enrichWithThreadInformation(processed_profile);\n const transactionStartMs = start_timestamp\n ? start_timestamp\n : typeof event.start_timestamp === 'number'\n ? event.start_timestamp * 1000\n : timestampInSeconds() * 1000;\n const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : timestampInSeconds() * 1000;\n\n const profile: Profile = {\n event_id: profile_id,\n timestamp: new Date(transactionStartMs).toISOString(),\n platform: 'javascript',\n version: '1',\n release: event.release || '',\n environment: event.environment || DEFAULT_ENVIRONMENT,\n runtime: {\n name: 'javascript',\n version: WINDOW.navigator.userAgent,\n },\n os: {\n name: OS_PLATFORM,\n version: OS_PLATFORM_VERSION,\n build_number: OS_BROWSER,\n },\n device: {\n locale: OS_LOCALE,\n model: OS_MODEL,\n manufacturer: OS_BROWSER,\n architecture: OS_ARCH,\n is_emulator: false,\n },\n debug_meta: {\n images: applyDebugMetadata(processed_profile.resources),\n },\n profile: enrichedThreadProfile,\n transactions: [\n {\n name: event.transaction || '',\n id: event.event_id || uuid4(),\n trace_id: traceId,\n active_thread_id: PROFILER_THREAD_ID_STRING,\n relative_start_ns: '0',\n relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0),\n },\n ],\n };\n\n return profile;\n}\n\n/**\n * Create a profile chunk envelope item\n */\nexport function createProfileChunkPayload(\n jsSelfProfile: JSSelfProfile,\n client: Client,\n profilerId?: string,\n): ProfileChunk {\n // only == to catch null and undefined\n if (jsSelfProfile == null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,\n );\n }\n\n const continuousProfile = convertToContinuousProfile(jsSelfProfile);\n\n const options = client.getOptions();\n const sdk = client.getSdkMetadata?.()?.sdk;\n\n return {\n chunk_id: uuid4(),\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.browser',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profilerId || uuid4(),\n platform: 'javascript',\n version: '2',\n release: options.release ?? '',\n environment: options.environment ?? 'production',\n debug_meta: {\n // function name obfuscation\n images: applyDebugMetadata(jsSelfProfile.resources),\n },\n profile: continuousProfile,\n };\n}\n\n/**\n * Validate a profile chunk against the Sample Format V2 requirements.\n * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/\n * - Presence of samples, stacks, frames\n * - Required metadata fields\n */\nexport function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { reason: string } {\n try {\n // Required metadata\n if (!chunk || typeof chunk !== 'object') {\n return { reason: 'chunk is not an object' };\n }\n\n // profiler_id and chunk_id must be 32 lowercase hex chars\n const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);\n if (!isHex32(chunk.profiler_id)) {\n return { reason: 'missing or invalid profiler_id' };\n }\n if (!isHex32(chunk.chunk_id)) {\n return { reason: 'missing or invalid chunk_id' };\n }\n\n if (!chunk.client_sdk) {\n return { reason: 'missing client_sdk metadata' };\n }\n\n // Profile data must have frames, stacks, samples\n const profile = chunk.profile as { frames?: unknown[]; stacks?: unknown[]; samples?: unknown[] } | undefined;\n if (!profile) {\n return { reason: 'missing profile data' };\n }\n\n if (!Array.isArray(profile.frames) || !profile.frames.length) {\n return { reason: 'profile has no frames' };\n }\n if (!Array.isArray(profile.stacks) || !profile.stacks.length) {\n return { reason: 'profile has no stacks' };\n }\n if (!Array.isArray(profile.samples) || !profile.samples.length) {\n return { reason: 'profile has no samples' };\n }\n\n return { valid: true };\n } catch (e) {\n return { reason: `unknown validation error: ${e}` };\n }\n}\n\n/**\n * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.\n */\nfunction convertToContinuousProfile(input: {\n frames: { name: string; resourceId?: number; line?: number; column?: number }[];\n stacks: { frameId: number; parentId?: number }[];\n samples: { timestamp: number; stackId?: number }[];\n resources: string[];\n}): ContinuousThreadCpuProfile {\n // Frames map 1:1 by index; fill only when present to avoid sparse writes\n const frames: ContinuousThreadCpuProfile['frames'] = [];\n for (let i = 0; i < input.frames.length; i++) {\n const frame = input.frames[i];\n if (!frame) {\n continue;\n }\n frames[i] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n // Build stacks by following parent links, top->down order (root last)\n const stacks: ContinuousThreadCpuProfile['stacks'] = [];\n for (let i = 0; i < input.stacks.length; i++) {\n const stackHead = input.stacks[i];\n if (!stackHead) {\n continue;\n }\n const list: number[] = [];\n let current: { frameId: number; parentId?: number } | undefined = stackHead;\n while (current) {\n list.push(current.frameId);\n current = current.parentId === undefined ? undefined : input.stacks[current.parentId];\n }\n stacks[i] = list;\n }\n\n // Align timestamps to SDK time origin to match span/event timelines\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n const samples: ContinuousThreadCpuProfile['samples'] = [];\n for (let i = 0; i < input.samples.length; i++) {\n const sample = input.samples[i];\n if (!sample) {\n continue;\n }\n // Convert ms to seconds epoch-based timestamp\n const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;\n samples[i] = {\n stack_id: sample.stackId ?? 0,\n thread_id: PROFILER_THREAD_ID_STRING,\n timestamp: timestampSeconds,\n };\n }\n\n return {\n frames,\n stacks,\n samples,\n thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },\n };\n}\n\n/**\n *\n */\nexport function isProfiledTransactionEvent(event: Event): event is ProfiledEvent {\n return !!event.sdkProcessingMetadata?.profile;\n}\n\n/*\n See packages/browser-utils/src/browser/router.ts\n*/\n/**\n *\n */\nexport function isAutomatedPageLoadSpan(span: Span): boolean {\n return spanToJSON(span).op === 'pageload';\n}\n\n/**\n * Converts a JSSelfProfile to a our sampled format.\n * Does not currently perform stack indexing.\n */\nexport function convertJSSelfProfileToSampledFormat(input: JSSelfProfile): Profile['profile'] {\n let EMPTY_STACK_ID: undefined | number = undefined;\n let STACK_ID = 0;\n\n // Initialize the profile that we will fill with data\n const profile: Profile['profile'] = {\n samples: [],\n stacks: [],\n frames: [],\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME },\n },\n };\n\n const firstSample = input.samples[0];\n if (!firstSample) {\n return profile;\n }\n\n // We assert samples.length > 0 above and timestamp should always be present\n const start = firstSample.timestamp;\n // The JS SDK might change it's time origin based on some heuristic (see See packages/utils/src/time.ts)\n // when that happens, we need to ensure we are correcting the profile timings so the two timelines stay in sync.\n // Since JS self profiling time origin is always initialized to performance.timeOrigin, we need to adjust for\n // the drift between the SDK selected value and our profile time origin.\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n input.samples.forEach((jsSample, i) => {\n // If sample has no stack, add an empty sample\n if (jsSample.stackId === undefined) {\n if (EMPTY_STACK_ID === undefined) {\n EMPTY_STACK_ID = STACK_ID;\n profile.stacks[EMPTY_STACK_ID] = [];\n STACK_ID++;\n }\n\n profile['samples'][i] = {\n // convert ms timestamp to ns\n elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),\n stack_id: EMPTY_STACK_ID,\n thread_id: PROFILER_THREAD_ID_STRING,\n };\n return;\n }\n\n let stackTop: JSSelfProfileStack | undefined = input.stacks[jsSample.stackId];\n\n // Functions in top->down order (root is last)\n // We follow the stackTop.parentId trail and collect each visited frameId\n const stack: number[] = [];\n\n while (stackTop) {\n stack.push(stackTop.frameId);\n\n const frame = input.frames[stackTop.frameId];\n\n // If our frame has not been indexed yet, index it\n if (frame && profile.frames[stackTop.frameId] === undefined) {\n profile.frames[stackTop.frameId] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n stackTop = stackTop.parentId === undefined ? undefined : input.stacks[stackTop.parentId];\n }\n\n const sample: Profile['profile']['samples'][0] = {\n // convert ms timestamp to ns\n elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),\n stack_id: STACK_ID,\n thread_id: PROFILER_THREAD_ID_STRING,\n };\n\n profile['stacks'][STACK_ID] = stack;\n profile['samples'][i] = sample;\n STACK_ID++;\n });\n\n return profile;\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: EventEnvelope, profiles: Profile[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n for (let j = 1; j < item.length; j++) {\n const event = item[j] as Event;\n\n if (event?.contexts?.profile?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Applies debug meta data to an event from a list of paths to resources (sourcemaps)\n */\nexport function applyDebugMetadata(resource_paths: ReadonlyArray<string>): DebugImage[] {\n const client = getClient();\n const options = client?.getOptions();\n const stackParser = options?.stackParser;\n\n if (!stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(stackParser, resource_paths);\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nexport function isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {\n DEBUG_BUILD &&\n debug.warn(\n `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // Boolean sample rates are always valid\n if (rate === true || rate === false) {\n return true;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\nfunction isValidProfile(profile: JSSelfProfile): profile is JSSelfProfile & { profile_id: string } {\n if (profile.samples.length < 2) {\n if (DEBUG_BUILD) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n\n if (!profile.frames.length) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Discarding profile because it contains no frames');\n }\n return false;\n }\n\n return true;\n}\n\n// Keep a flag value to avoid re-initializing the profiler constructor. If it fails\n// once, it will always fail and this allows us to early return.\nlet PROFILING_CONSTRUCTOR_FAILED: boolean = false;\nexport const MAX_PROFILE_DURATION_MS = 30_000;\n\n/**\n * Check if profiler constructor is available.\n * @param maybeProfiler\n */\nfunction isJSProfilerSupported(maybeProfiler: unknown): maybeProfiler is typeof JSSelfProfilerConstructor {\n return typeof maybeProfiler === 'function';\n}\n\n/**\n * Starts the profiler and returns the profiler instance.\n */\nexport function startJSSelfProfile(): JSSelfProfiler | undefined {\n // Feature support check first\n const JSProfilerConstructor = WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');\n }\n return;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch (_e) {\n if (DEBUG_BUILD) {\n debug.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n debug.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n return;\n}\n\n/**\n * Determine if a profile should be profiled.\n */\nexport function shouldProfileSpanLegacy(span: Span): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');\n }\n return false;\n }\n\n if (!span.isRecording()) {\n DEBUG_BUILD && debug.log('[Profiling] Discarding profile because root span was not sampled.');\n return false;\n }\n\n const client = getClient();\n const options = client?.getOptions();\n if (!options) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling disabled, no options found.');\n return false;\n }\n\n // eslint-disable-next-line typescript/no-deprecated\n const profilesSampleRate = (options as BrowserOptions).profilesSampleRate as\n | BrowserOptions['profilesSampleRate']\n | boolean;\n\n // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The\n // only valid values are booleans or numbers between 0 and 1.)\n if (!isValidSampleRate(profilesSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid sample rate.');\n return false;\n }\n\n // if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped\n if (!profilesSampleRate) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0',\n );\n return false;\n }\n\n // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is\n // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.\n const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate;\n // Check if we should sample this profile\n if (!sampled) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(\n profilesSampleRate,\n )})`,\n );\n return false;\n }\n\n return true;\n}\n\n/**\n * Determine if a profile should be created for the current session.\n */\nexport function shouldProfileSession(options: BrowserOptions): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log(\n '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',\n );\n }\n return false;\n }\n\n if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {\n DEBUG_BUILD && debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');\n return false;\n }\n\n // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session\n const profileSessionSampleRate = options.profileSessionSampleRate;\n\n if (!isValidSampleRate(profileSessionSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');\n return false;\n }\n\n if (!profileSessionSampleRate) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');\n return false;\n }\n\n return Math.random() <= profileSessionSampleRate;\n}\n\n/**\n * Checks if legacy profiling is configured.\n */\nexport function hasLegacyProfiling(options: BrowserOptions): boolean {\n // eslint-disable-next-line typescript/no-deprecated\n return typeof options.profilesSampleRate !== 'undefined';\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {Profile | null}\n */\nexport function createProfilingEvent(\n profile_id: string,\n start_timestamp: number | undefined,\n profile: JSSelfProfile,\n event: ProfiledEvent,\n): Profile | null {\n if (!isValidProfile(profile)) {\n return null;\n }\n\n return createProfilePayload(profile_id, start_timestamp, profile, event);\n}\n\n// TODO (v8): We need to obtain profile ids in @sentry-internal/tracing,\n// but we don't have access to this map because importing this map would\n// cause a circular dependency. We need to resolve this in v8.\nconst PROFILE_MAP: Map<string, JSSelfProfile> = new Map();\n/**\n *\n */\nexport function getActiveProfilesCount(): number {\n return PROFILE_MAP.size;\n}\n\n/**\n * Retrieves profile from global cache and removes it.\n */\nexport function takeProfileFromGlobalCache(profile_id: string): JSSelfProfile | undefined {\n const profile = PROFILE_MAP.get(profile_id);\n if (profile) {\n PROFILE_MAP.delete(profile_id);\n }\n return profile;\n}\n/**\n * Adds profile to global cache and evicts the oldest profile if the cache is full.\n */\nexport function addProfileToGlobalCache(profile_id: string, profile: JSSelfProfile): void {\n PROFILE_MAP.set(profile_id, profile);\n\n if (PROFILE_MAP.size > 30) {\n const last = PROFILE_MAP.keys().next().value;\n if (last !== undefined) {\n PROFILE_MAP.delete(last);\n }\n }\n}\n\nexport const PROFILED_ROOT_SPANS = new WeakSet<Span>();\n\nexport function setThreadAttributes(span: Span): void {\n span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);\n span.setAttribute('thread.name', PROFILER_THREAD_NAME);\n}\n"],"names":[],"mappings":";;;;AA8BA,MAAM,QAAA,GAAW,GAAA;AAGjB,MAAM,eAAe,QAAA,IAAY,UAAA,IAAc,WAAW,MAAA,KAAW,UAAA,IAAc,OAAO,aAAA,KAAkB,WAAA;AAGrG,MAAM,yBAAA,GAA4B,OAAO,CAAC;AAC1C,MAAM,oBAAA,GAAuB,eAAe,MAAA,GAAS;AAG5D,MAAM,YAAY,MAAA,CAAO,SAAA;AAGzB,IAAI,WAAA,GAAc,EAAA;AAClB,IAAI,mBAAA,GAAsB,EAAA;AAC1B,IAAI,OAAA,GAAU,EAAA;AACd,IAAI,UAAA,GAAa,WAAW,SAAA,IAAa,EAAA;AACzC,IAAI,QAAA,GAAW,EAAA;AACf,MAAM,YAAY,SAAA,EAAW,QAAA,IAAY,SAAA,EAAW,SAAA,GAAY,CAAC,CAAA,IAAK,EAAA;AAiBtE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AA,CAAY,IAAA;AACrB;AAKO,SAAS,2BAA2B,UAAA,EAA+C;AACxF,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,GAAA,CAAI,UAAU,CAAA;AAC1C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,WAAA,CAAY,OAAO,UAAU,CAAA;AAAA,EAC/B;AACA,EAAA,OAAO,OAAA;AACT;AAIO,SAAS,uBAAA,CAAwB,YAAoB,OAAA,EAA8B;AACxF,EAAA,WAAA,CAAY,GAAA,CAAI,YAAY,OAAO,CAAA;AAEnC,EAAA,IAAI,WAAA,CAAY,OAAO,EAAA,EAAI;AACzB,IAAA,MAAM,IAAA,GAAO,WAAA,CAAY,IAAA,EAAK,CAAE,MAAK,CAAE,KAAA;AACvC,IAAA,IAAI,SAAS,MAAA,EAAW;AACtB,MAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AAAA,IACzB;AAAA,EACF;AACF;AAEO,MAAM,mBAAA,uBAA0B,OAAA;AAEhC,SAAS,oBAAoB,IAAA,EAAkB;AACpD,EAAA,IAAA,CAAK,YAAA,CAAa,aAAa,yBAAyB,CAAA;AACxD,EAAA,IAAA,CAAK,YAAA,CAAa,eAAe,oBAAoB,CAAA;AACvD;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/profiling/utils.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, ContinuousThreadCpuProfile, DebugImage, ProfileChunk, Span } from '@sentry/core/browser';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getClient,\n getDebugImagesForResources,\n GLOBAL_OBJ,\n uuid4,\n} from '@sentry/core/browser';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor } from './jsSelfProfiling';\n\n// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers\nconst isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';\n\n// Setting ID to 0 as we cannot get an ID from Web Workers\nexport const PROFILER_THREAD_ID_STRING = String(0);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\n\n/**\n * Create a profile chunk envelope item\n */\nexport function createProfileChunkPayload(\n jsSelfProfile: JSSelfProfile,\n client: Client,\n profilerId?: string,\n): ProfileChunk {\n // only == to catch null and undefined\n if (jsSelfProfile == null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,\n );\n }\n\n const continuousProfile = convertToContinuousProfile(jsSelfProfile);\n\n const options = client.getOptions();\n const sdk = client.getSdkMetadata?.()?.sdk;\n\n return {\n chunk_id: uuid4(),\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.browser',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profilerId || uuid4(),\n platform: 'javascript',\n version: '2',\n release: options.release ?? '',\n environment: options.environment ?? 'production',\n debug_meta: {\n // function name obfuscation\n images: applyDebugMetadata(jsSelfProfile.resources),\n },\n profile: continuousProfile,\n };\n}\n\n/**\n * Validate a profile chunk against the Sample Format V2 requirements.\n * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/\n * - Presence of samples, stacks, frames\n * - Required metadata fields\n */\nexport function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { reason: string } {\n try {\n // Required metadata\n if (!chunk || typeof chunk !== 'object') {\n return { reason: 'chunk is not an object' };\n }\n\n // profiler_id and chunk_id must be 32 lowercase hex chars\n const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);\n if (!isHex32(chunk.profiler_id)) {\n return { reason: 'missing or invalid profiler_id' };\n }\n if (!isHex32(chunk.chunk_id)) {\n return { reason: 'missing or invalid chunk_id' };\n }\n\n if (!chunk.client_sdk) {\n return { reason: 'missing client_sdk metadata' };\n }\n\n // Profile data must have frames, stacks, samples\n const profile = chunk.profile as { frames?: unknown[]; stacks?: unknown[]; samples?: unknown[] } | undefined;\n if (!profile) {\n return { reason: 'missing profile data' };\n }\n\n if (!Array.isArray(profile.frames) || !profile.frames.length) {\n return { reason: 'profile has no frames' };\n }\n if (!Array.isArray(profile.stacks) || !profile.stacks.length) {\n return { reason: 'profile has no stacks' };\n }\n if (!Array.isArray(profile.samples) || !profile.samples.length) {\n return { reason: 'profile has no samples' };\n }\n\n return { valid: true };\n } catch (e) {\n return { reason: `unknown validation error: ${e}` };\n }\n}\n\n/**\n * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.\n */\nfunction convertToContinuousProfile(input: {\n frames: { name: string; resourceId?: number; line?: number; column?: number }[];\n stacks: { frameId: number; parentId?: number }[];\n samples: { timestamp: number; stackId?: number }[];\n resources: string[];\n}): ContinuousThreadCpuProfile {\n // Frames map 1:1 by index; fill only when present to avoid sparse writes\n const frames: ContinuousThreadCpuProfile['frames'] = [];\n for (let i = 0; i < input.frames.length; i++) {\n const frame = input.frames[i];\n if (!frame) {\n continue;\n }\n frames[i] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n // Build stacks by following parent links, top->down order (root last)\n const stacks: ContinuousThreadCpuProfile['stacks'] = [];\n for (let i = 0; i < input.stacks.length; i++) {\n const stackHead = input.stacks[i];\n if (!stackHead) {\n continue;\n }\n const list: number[] = [];\n let current: { frameId: number; parentId?: number } | undefined = stackHead;\n while (current) {\n list.push(current.frameId);\n current = current.parentId === undefined ? undefined : input.stacks[current.parentId];\n }\n stacks[i] = list;\n }\n\n // Align timestamps to SDK time origin to match span/event timelines\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n const samples: ContinuousThreadCpuProfile['samples'] = [];\n for (let i = 0; i < input.samples.length; i++) {\n const sample = input.samples[i];\n if (!sample) {\n continue;\n }\n // Convert ms to seconds epoch-based timestamp\n const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;\n samples[i] = {\n stack_id: sample.stackId ?? 0,\n thread_id: PROFILER_THREAD_ID_STRING,\n timestamp: timestampSeconds,\n };\n }\n\n return {\n frames,\n stacks,\n samples,\n thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },\n };\n}\n\n/**\n * Applies debug meta data to an event from a list of paths to resources (sourcemaps)\n */\nexport function applyDebugMetadata(resource_paths: ReadonlyArray<string>): DebugImage[] {\n const client = getClient();\n const options = client?.getOptions();\n const stackParser = options?.stackParser;\n\n if (!stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(stackParser, resource_paths);\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nexport function isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {\n DEBUG_BUILD &&\n debug.warn(\n `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // Boolean sample rates are always valid\n if (rate === true || rate === false) {\n return true;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\n// Keep a flag value to avoid re-initializing the profiler constructor. If it fails\n// once, it will always fail and this allows us to early return.\nlet PROFILING_CONSTRUCTOR_FAILED: boolean = false;\nexport const MAX_PROFILE_DURATION_MS = 30_000;\n\n/**\n * Check if profiler constructor is available.\n * @param maybeProfiler\n */\nfunction isJSProfilerSupported(maybeProfiler: unknown): maybeProfiler is typeof JSSelfProfilerConstructor {\n return typeof maybeProfiler === 'function';\n}\n\n/**\n * Starts the profiler and returns the profiler instance.\n */\nexport function startJSSelfProfile(): JSSelfProfiler | undefined {\n // Feature support check first\n const JSProfilerConstructor = WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');\n }\n return;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch {\n if (DEBUG_BUILD) {\n debug.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n debug.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n return;\n}\n\n/**\n * Determine if a profile should be created for the current session.\n */\nexport function shouldProfileSession(options: BrowserOptions): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log(\n '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',\n );\n }\n return false;\n }\n\n if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {\n DEBUG_BUILD && debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');\n return false;\n }\n\n // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session\n const profileSessionSampleRate = options.profileSessionSampleRate;\n\n if (!isValidSampleRate(profileSessionSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');\n return false;\n }\n\n if (!profileSessionSampleRate) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');\n return false;\n }\n\n return Math.random() <= profileSessionSampleRate;\n}\n\nexport function setThreadAttributes(span: Span): void {\n span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);\n span.setAttribute('thread.name', PROFILER_THREAD_NAME);\n}\n"],"names":[],"mappings":";;;;AAgBA,MAAM,eAAe,QAAA,IAAY,UAAA,IAAc,WAAW,MAAA,KAAW,UAAA,IAAc,OAAO,aAAA,KAAkB,WAAA;AAGrG,MAAM,yBAAA,GAA4B,OAAO,CAAC;AAC1C,MAAM,oBAAA,GAAuB,eAAe,MAAA,GAAS;AAKrD,SAAS,yBAAA,CACd,aAAA,EACA,MAAA,EACA,UAAA,EACc;AAEd,EAAA,IAAI,iBAAiB,IAAA,EAAM;AACzB,IAAA,MAAM,IAAI,SAAA;AAAA,MACR,0EAA0E,aAAa,CAAA,SAAA;AAAA,KACzF;AAAA,EACF;AAEA,EAAA,MAAM,iBAAA,GAAoB,2BAA2B,aAAa,CAAA;AAElE,EAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAClC,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,cAAA,IAAiB,EAAG,GAAA;AAEvC,EAAA,OAAO;AAAA,IACL,UAAU,KAAA,EAAM;AAAA,IAChB,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,KAAK,IAAA,IAAQ,2BAAA;AAAA,MACnB,OAAA,EAAS,KAAK,OAAA,IAAW;AAAA,KAC3B;AAAA,IACA,WAAA,EAAa,cAAc,KAAA,EAAM;AAAA,IACjC,QAAA,EAAU,YAAA;AAAA,IACV,OAAA,EAAS,GAAA;AAAA,IACT,OAAA,EAAS,QAAQ,OAAA,IAAW,EAAA;AAAA,I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