@sentry/browser 10.52.0 → 10.53.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 (507) hide show
  1. package/build/npm/cjs/dev/client.js +7 -7
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/diagnose-sdk.js +3 -3
  4. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
  5. package/build/npm/cjs/dev/eventbuilder.js +23 -23
  6. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  7. package/build/npm/cjs/dev/feedbackAsync.js.map +1 -1
  8. package/build/npm/cjs/dev/feedbackSync.js.map +1 -1
  9. package/build/npm/cjs/dev/helpers.js +10 -10
  10. package/build/npm/cjs/dev/helpers.js.map +1 -1
  11. package/build/npm/cjs/dev/index.js +84 -84
  12. package/build/npm/cjs/dev/integrations/breadcrumbs.js +29 -29
  13. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
  14. package/build/npm/cjs/dev/integrations/browserapierrors.js +16 -16
  15. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
  16. package/build/npm/cjs/dev/integrations/browsersession.js +9 -9
  17. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  18. package/build/npm/cjs/dev/integrations/contextlines.js +5 -5
  19. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
  20. package/build/npm/cjs/dev/integrations/culturecontext.js +3 -3
  21. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  22. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +2 -2
  23. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  24. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +5 -5
  25. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  26. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +7 -7
  27. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  28. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -5
  29. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  30. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +7 -7
  31. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  32. package/build/npm/cjs/dev/integrations/globalhandlers.js +16 -16
  33. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
  34. package/build/npm/cjs/dev/integrations/graphqlClient.js +9 -9
  35. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  36. package/build/npm/cjs/dev/integrations/httpclient.js +14 -14
  37. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  38. package/build/npm/cjs/dev/integrations/httpcontext.js +3 -3
  39. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  40. package/build/npm/cjs/dev/integrations/linkederrors.js +3 -3
  41. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
  42. package/build/npm/cjs/dev/integrations/reportingobserver.js +7 -7
  43. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
  44. package/build/npm/cjs/dev/integrations/spanstreaming.js +10 -10
  45. package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
  46. package/build/npm/cjs/dev/integrations/spotlight.js +6 -6
  47. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  48. package/build/npm/cjs/dev/integrations/view-hierarchy.js +3 -3
  49. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  50. package/build/npm/cjs/dev/integrations/webWorker.js +18 -18
  51. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
  52. package/build/npm/cjs/dev/profiling/UIProfiler.js +43 -33
  53. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  54. package/build/npm/cjs/dev/profiling/index.js +7 -7
  55. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  56. package/build/npm/cjs/dev/profiling/integration.js +20 -18
  57. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  58. package/build/npm/cjs/dev/profiling/startProfileForSpan.js +14 -11
  59. package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -1
  60. package/build/npm/cjs/dev/profiling/utils.js +39 -68
  61. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  62. package/build/npm/cjs/dev/report-dialog.js +7 -7
  63. package/build/npm/cjs/dev/report-dialog.js.map +1 -1
  64. package/build/npm/cjs/dev/sdk.js +8 -8
  65. package/build/npm/cjs/dev/sdk.js.map +1 -1
  66. package/build/npm/cjs/dev/stack-parsers.js +10 -10
  67. package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
  68. package/build/npm/cjs/dev/tracing/backgroundtab.js +7 -7
  69. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  70. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +52 -52
  71. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  72. package/build/npm/cjs/dev/tracing/linkedTraces.js +11 -11
  73. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  74. package/build/npm/cjs/dev/tracing/reportPageLoaded.js +2 -2
  75. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
  76. package/build/npm/cjs/dev/tracing/request.js +28 -28
  77. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  78. package/build/npm/cjs/dev/tracing/setActiveSpan.js +5 -5
  79. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
  80. package/build/npm/cjs/dev/transports/fetch.js +3 -3
  81. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  82. package/build/npm/cjs/dev/transports/offline.js +5 -5
  83. package/build/npm/cjs/dev/transports/offline.js.map +1 -1
  84. package/build/npm/cjs/dev/userfeedback.js +3 -3
  85. package/build/npm/cjs/dev/userfeedback.js.map +1 -1
  86. package/build/npm/cjs/dev/utils/detectBrowserExtension.js +3 -3
  87. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
  88. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +3 -3
  89. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  90. package/build/npm/cjs/prod/client.js +7 -7
  91. package/build/npm/cjs/prod/client.js.map +1 -1
  92. package/build/npm/cjs/prod/diagnose-sdk.js +3 -3
  93. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
  94. package/build/npm/cjs/prod/eventbuilder.js +23 -23
  95. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  96. package/build/npm/cjs/prod/feedbackAsync.js.map +1 -1
  97. package/build/npm/cjs/prod/feedbackSync.js.map +1 -1
  98. package/build/npm/cjs/prod/helpers.js +10 -10
  99. package/build/npm/cjs/prod/helpers.js.map +1 -1
  100. package/build/npm/cjs/prod/index.js +84 -84
  101. package/build/npm/cjs/prod/integrations/breadcrumbs.js +29 -29
  102. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
  103. package/build/npm/cjs/prod/integrations/browserapierrors.js +16 -16
  104. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
  105. package/build/npm/cjs/prod/integrations/browsersession.js +9 -9
  106. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  107. package/build/npm/cjs/prod/integrations/contextlines.js +5 -5
  108. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
  109. package/build/npm/cjs/prod/integrations/culturecontext.js +3 -3
  110. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  111. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +2 -2
  112. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  113. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +5 -5
  114. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  115. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +7 -7
  116. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  117. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -5
  118. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  119. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +7 -7
  120. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  121. package/build/npm/cjs/prod/integrations/globalhandlers.js +16 -16
  122. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
  123. package/build/npm/cjs/prod/integrations/graphqlClient.js +9 -9
  124. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  125. package/build/npm/cjs/prod/integrations/httpclient.js +14 -14
  126. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  127. package/build/npm/cjs/prod/integrations/httpcontext.js +3 -3
  128. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  129. package/build/npm/cjs/prod/integrations/linkederrors.js +3 -3
  130. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
  131. package/build/npm/cjs/prod/integrations/reportingobserver.js +7 -7
  132. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
  133. package/build/npm/cjs/prod/integrations/spanstreaming.js +10 -10
  134. package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
  135. package/build/npm/cjs/prod/integrations/spotlight.js +6 -6
  136. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  137. package/build/npm/cjs/prod/integrations/view-hierarchy.js +3 -3
  138. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  139. package/build/npm/cjs/prod/integrations/webWorker.js +18 -18
  140. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
  141. package/build/npm/cjs/prod/profiling/UIProfiler.js +43 -33
  142. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  143. package/build/npm/cjs/prod/profiling/index.js +7 -7
  144. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  145. package/build/npm/cjs/prod/profiling/integration.js +20 -18
  146. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  147. package/build/npm/cjs/prod/profiling/startProfileForSpan.js +14 -11
  148. package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -1
  149. package/build/npm/cjs/prod/profiling/utils.js +39 -68
  150. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  151. package/build/npm/cjs/prod/report-dialog.js +7 -7
  152. package/build/npm/cjs/prod/report-dialog.js.map +1 -1
  153. package/build/npm/cjs/prod/sdk.js +8 -8
  154. package/build/npm/cjs/prod/sdk.js.map +1 -1
  155. package/build/npm/cjs/prod/stack-parsers.js +10 -10
  156. package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
  157. package/build/npm/cjs/prod/tracing/backgroundtab.js +7 -7
  158. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  159. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +52 -52
  160. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  161. package/build/npm/cjs/prod/tracing/linkedTraces.js +11 -11
  162. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  163. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +2 -2
  164. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
  165. package/build/npm/cjs/prod/tracing/request.js +28 -28
  166. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  167. package/build/npm/cjs/prod/tracing/setActiveSpan.js +5 -5
  168. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
  169. package/build/npm/cjs/prod/transports/fetch.js +3 -3
  170. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  171. package/build/npm/cjs/prod/transports/offline.js +5 -5
  172. package/build/npm/cjs/prod/transports/offline.js.map +1 -1
  173. package/build/npm/cjs/prod/userfeedback.js +3 -3
  174. package/build/npm/cjs/prod/userfeedback.js.map +1 -1
  175. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +3 -3
  176. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
  177. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +3 -3
  178. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  179. package/build/npm/esm/dev/client.js +1 -1
  180. package/build/npm/esm/dev/client.js.map +1 -1
  181. package/build/npm/esm/dev/diagnose-sdk.js +1 -1
  182. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
  183. package/build/npm/esm/dev/eventbuilder.js +1 -1
  184. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  185. package/build/npm/esm/dev/feedbackAsync.js.map +1 -1
  186. package/build/npm/esm/dev/feedbackSync.js.map +1 -1
  187. package/build/npm/esm/dev/helpers.js +1 -1
  188. package/build/npm/esm/dev/helpers.js.map +1 -1
  189. package/build/npm/esm/dev/index.js +1 -1
  190. package/build/npm/esm/dev/integrations/breadcrumbs.js +1 -1
  191. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
  192. package/build/npm/esm/dev/integrations/browserapierrors.js +1 -1
  193. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
  194. package/build/npm/esm/dev/integrations/browsersession.js +1 -1
  195. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  196. package/build/npm/esm/dev/integrations/contextlines.js +1 -1
  197. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
  198. package/build/npm/esm/dev/integrations/culturecontext.js +1 -1
  199. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  200. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -1
  201. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  202. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +1 -1
  203. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  204. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +1 -1
  205. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  206. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +1 -1
  207. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  208. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +1 -1
  209. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  210. package/build/npm/esm/dev/integrations/globalhandlers.js +1 -1
  211. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
  212. package/build/npm/esm/dev/integrations/graphqlClient.js +1 -1
  213. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  214. package/build/npm/esm/dev/integrations/httpclient.js +1 -1
  215. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  216. package/build/npm/esm/dev/integrations/httpcontext.js +1 -1
  217. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  218. package/build/npm/esm/dev/integrations/linkederrors.js +1 -1
  219. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
  220. package/build/npm/esm/dev/integrations/reportingobserver.js +1 -1
  221. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
  222. package/build/npm/esm/dev/integrations/spanstreaming.js +1 -1
  223. package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
  224. package/build/npm/esm/dev/integrations/spotlight.js +1 -1
  225. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  226. package/build/npm/esm/dev/integrations/view-hierarchy.js +1 -1
  227. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  228. package/build/npm/esm/dev/integrations/webWorker.js +1 -1
  229. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
  230. package/build/npm/esm/dev/package.json +1 -1
  231. package/build/npm/esm/dev/profiling/UIProfiler.js +12 -2
  232. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  233. package/build/npm/esm/dev/profiling/index.js +1 -1
  234. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  235. package/build/npm/esm/dev/profiling/integration.js +9 -7
  236. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  237. package/build/npm/esm/dev/profiling/startProfileForSpan.js +5 -2
  238. package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -1
  239. package/build/npm/esm/dev/profiling/utils.js +6 -36
  240. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  241. package/build/npm/esm/dev/report-dialog.js +1 -1
  242. package/build/npm/esm/dev/report-dialog.js.map +1 -1
  243. package/build/npm/esm/dev/sdk.js +1 -1
  244. package/build/npm/esm/dev/sdk.js.map +1 -1
  245. package/build/npm/esm/dev/stack-parsers.js +1 -1
  246. package/build/npm/esm/dev/stack-parsers.js.map +1 -1
  247. package/build/npm/esm/dev/tracing/backgroundtab.js +1 -1
  248. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  249. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +1 -1
  250. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  251. package/build/npm/esm/dev/tracing/linkedTraces.js +2 -2
  252. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  253. package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -1
  254. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
  255. package/build/npm/esm/dev/tracing/request.js +1 -1
  256. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  257. package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -1
  258. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
  259. package/build/npm/esm/dev/transports/fetch.js +1 -1
  260. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  261. package/build/npm/esm/dev/transports/offline.js +1 -1
  262. package/build/npm/esm/dev/transports/offline.js.map +1 -1
  263. package/build/npm/esm/dev/userfeedback.js +1 -1
  264. package/build/npm/esm/dev/userfeedback.js.map +1 -1
  265. package/build/npm/esm/dev/utils/detectBrowserExtension.js +1 -1
  266. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
  267. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +1 -1
  268. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  269. package/build/npm/esm/prod/client.js +1 -1
  270. package/build/npm/esm/prod/client.js.map +1 -1
  271. package/build/npm/esm/prod/diagnose-sdk.js +1 -1
  272. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
  273. package/build/npm/esm/prod/eventbuilder.js +1 -1
  274. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  275. package/build/npm/esm/prod/feedbackAsync.js.map +1 -1
  276. package/build/npm/esm/prod/feedbackSync.js.map +1 -1
  277. package/build/npm/esm/prod/helpers.js +1 -1
  278. package/build/npm/esm/prod/helpers.js.map +1 -1
  279. package/build/npm/esm/prod/index.js +1 -1
  280. package/build/npm/esm/prod/integrations/breadcrumbs.js +1 -1
  281. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
  282. package/build/npm/esm/prod/integrations/browserapierrors.js +1 -1
  283. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
  284. package/build/npm/esm/prod/integrations/browsersession.js +1 -1
  285. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  286. package/build/npm/esm/prod/integrations/contextlines.js +1 -1
  287. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
  288. package/build/npm/esm/prod/integrations/culturecontext.js +1 -1
  289. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  290. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -1
  291. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  292. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +1 -1
  293. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  294. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +1 -1
  295. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  296. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +1 -1
  297. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  298. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +1 -1
  299. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  300. package/build/npm/esm/prod/integrations/globalhandlers.js +1 -1
  301. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
  302. package/build/npm/esm/prod/integrations/graphqlClient.js +1 -1
  303. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  304. package/build/npm/esm/prod/integrations/httpclient.js +1 -1
  305. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  306. package/build/npm/esm/prod/integrations/httpcontext.js +1 -1
  307. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  308. package/build/npm/esm/prod/integrations/linkederrors.js +1 -1
  309. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
  310. package/build/npm/esm/prod/integrations/reportingobserver.js +1 -1
  311. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
  312. package/build/npm/esm/prod/integrations/spanstreaming.js +1 -1
  313. package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
  314. package/build/npm/esm/prod/integrations/spotlight.js +1 -1
  315. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  316. package/build/npm/esm/prod/integrations/view-hierarchy.js +1 -1
  317. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  318. package/build/npm/esm/prod/integrations/webWorker.js +1 -1
  319. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
  320. package/build/npm/esm/prod/package.json +1 -1
  321. package/build/npm/esm/prod/profiling/UIProfiler.js +12 -2
  322. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  323. package/build/npm/esm/prod/profiling/index.js +1 -1
  324. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  325. package/build/npm/esm/prod/profiling/integration.js +9 -7
  326. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  327. package/build/npm/esm/prod/profiling/startProfileForSpan.js +5 -2
  328. package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -1
  329. package/build/npm/esm/prod/profiling/utils.js +6 -36
  330. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  331. package/build/npm/esm/prod/report-dialog.js +1 -1
  332. package/build/npm/esm/prod/report-dialog.js.map +1 -1
  333. package/build/npm/esm/prod/sdk.js +1 -1
  334. package/build/npm/esm/prod/sdk.js.map +1 -1
  335. package/build/npm/esm/prod/stack-parsers.js +1 -1
  336. package/build/npm/esm/prod/stack-parsers.js.map +1 -1
  337. package/build/npm/esm/prod/tracing/backgroundtab.js +1 -1
  338. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  339. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +1 -1
  340. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  341. package/build/npm/esm/prod/tracing/linkedTraces.js +2 -2
  342. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  343. package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -1
  344. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
  345. package/build/npm/esm/prod/tracing/request.js +1 -1
  346. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  347. package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -1
  348. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
  349. package/build/npm/esm/prod/transports/fetch.js +1 -1
  350. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  351. package/build/npm/esm/prod/transports/offline.js +1 -1
  352. package/build/npm/esm/prod/transports/offline.js.map +1 -1
  353. package/build/npm/esm/prod/userfeedback.js +1 -1
  354. package/build/npm/esm/prod/userfeedback.js.map +1 -1
  355. package/build/npm/esm/prod/utils/detectBrowserExtension.js +1 -1
  356. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
  357. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +1 -1
  358. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  359. package/build/npm/types/client.d.ts +2 -2
  360. package/build/npm/types/client.d.ts.map +1 -1
  361. package/build/npm/types/eventbuilder.d.ts +1 -1
  362. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  363. package/build/npm/types/exports.d.ts +3 -3
  364. package/build/npm/types/exports.d.ts.map +1 -1
  365. package/build/npm/types/feedbackAsync.d.ts +2 -7
  366. package/build/npm/types/feedbackAsync.d.ts.map +1 -1
  367. package/build/npm/types/feedbackSync.d.ts +2 -7
  368. package/build/npm/types/feedbackSync.d.ts.map +1 -1
  369. package/build/npm/types/helpers.d.ts +2 -2
  370. package/build/npm/types/helpers.d.ts.map +1 -1
  371. package/build/npm/types/index.bundle.logs.metrics.d.ts +1 -1
  372. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  373. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +1 -1
  374. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  375. package/build/npm/types/index.bundle.tracing.d.ts +1 -1
  376. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  377. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +2 -2
  378. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  379. package/build/npm/types/index.bundle.tracing.replay.d.ts +1 -1
  380. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  381. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +1 -1
  382. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  383. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -1
  384. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  385. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +2 -2
  386. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  387. package/build/npm/types/index.d.ts +3 -3
  388. package/build/npm/types/index.d.ts.map +1 -1
  389. package/build/npm/types/integrations/contextlines.d.ts +1 -1
  390. package/build/npm/types/integrations/contextlines.d.ts.map +1 -1
  391. package/build/npm/types/integrations/globalhandlers.d.ts +1 -1
  392. package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
  393. package/build/npm/types/integrations/view-hierarchy.d.ts +1 -1
  394. package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -1
  395. package/build/npm/types/integrations/webWorker.d.ts +1 -1
  396. package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
  397. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts +1 -1
  398. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts.map +1 -1
  399. package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts +1 -1
  400. package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts.map +1 -1
  401. package/build/npm/types/integrations-bundle/index.dedupe.d.ts +1 -1
  402. package/build/npm/types/integrations-bundle/index.dedupe.d.ts.map +1 -1
  403. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts +1 -1
  404. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts.map +1 -1
  405. package/build/npm/types/integrations-bundle/index.feedback.d.ts +1 -1
  406. package/build/npm/types/integrations-bundle/index.feedback.d.ts.map +1 -1
  407. package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts +1 -1
  408. package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts.map +1 -1
  409. package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +1 -1
  410. package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts.map +1 -1
  411. package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts +1 -1
  412. package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts.map +1 -1
  413. package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts +1 -1
  414. package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts.map +1 -1
  415. package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts +1 -1
  416. package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts.map +1 -1
  417. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts +1 -1
  418. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts.map +1 -1
  419. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts +1 -1
  420. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts.map +1 -1
  421. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
  422. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts.map +1 -1
  423. package/build/npm/types/profiling/UIProfiler.d.ts +1 -1
  424. package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
  425. package/build/npm/types/profiling/index.d.ts +1 -1
  426. package/build/npm/types/profiling/index.d.ts.map +1 -1
  427. package/build/npm/types/profiling/integration.d.ts.map +1 -1
  428. package/build/npm/types/profiling/startProfileForSpan.d.ts +1 -1
  429. package/build/npm/types/profiling/startProfileForSpan.d.ts.map +1 -1
  430. package/build/npm/types/profiling/utils.d.ts +3 -5
  431. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  432. package/build/npm/types/report-dialog.d.ts +1 -1
  433. package/build/npm/types/report-dialog.d.ts.map +1 -1
  434. package/build/npm/types/sdk.d.ts +1 -1
  435. package/build/npm/types/sdk.d.ts.map +1 -1
  436. package/build/npm/types/stack-parsers.d.ts +1 -1
  437. package/build/npm/types/stack-parsers.d.ts.map +1 -1
  438. package/build/npm/types/tracing/browserTracingIntegration.d.ts +1 -1
  439. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  440. package/build/npm/types/tracing/linkedTraces.d.ts +2 -2
  441. package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -1
  442. package/build/npm/types/tracing/reportPageLoaded.d.ts +1 -1
  443. package/build/npm/types/tracing/reportPageLoaded.d.ts.map +1 -1
  444. package/build/npm/types/tracing/request.d.ts +1 -1
  445. package/build/npm/types/tracing/request.d.ts.map +1 -1
  446. package/build/npm/types/tracing/setActiveSpan.d.ts +1 -1
  447. package/build/npm/types/tracing/setActiveSpan.d.ts.map +1 -1
  448. package/build/npm/types/transports/fetch.d.ts +1 -1
  449. package/build/npm/types/transports/fetch.d.ts.map +1 -1
  450. package/build/npm/types/transports/offline.d.ts +1 -1
  451. package/build/npm/types/transports/offline.d.ts.map +1 -1
  452. package/build/npm/types/transports/types.d.ts +1 -1
  453. package/build/npm/types/transports/types.d.ts.map +1 -1
  454. package/build/npm/types/userfeedback.d.ts +1 -1
  455. package/build/npm/types/userfeedback.d.ts.map +1 -1
  456. package/build/npm/types/utils/lazyLoadIntegration.d.ts +1 -1
  457. package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -1
  458. package/build/npm/types-ts3.8/client.d.ts +2 -2
  459. package/build/npm/types-ts3.8/eventbuilder.d.ts +1 -1
  460. package/build/npm/types-ts3.8/exports.d.ts +3 -3
  461. package/build/npm/types-ts3.8/feedbackAsync.d.ts +2 -7
  462. package/build/npm/types-ts3.8/feedbackSync.d.ts +2 -7
  463. package/build/npm/types-ts3.8/helpers.d.ts +2 -2
  464. package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +1 -1
  465. package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +1 -1
  466. package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -1
  467. package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +2 -2
  468. package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -1
  469. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -1
  470. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -1
  471. package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +2 -2
  472. package/build/npm/types-ts3.8/index.d.ts +3 -3
  473. package/build/npm/types-ts3.8/integrations/contextlines.d.ts +1 -1
  474. package/build/npm/types-ts3.8/integrations/globalhandlers.d.ts +1 -1
  475. package/build/npm/types-ts3.8/integrations/view-hierarchy.d.ts +1 -1
  476. package/build/npm/types-ts3.8/integrations/webWorker.d.ts +1 -1
  477. package/build/npm/types-ts3.8/integrations-bundle/index.captureconsole.d.ts +1 -1
  478. package/build/npm/types-ts3.8/integrations-bundle/index.createlangchaincallbackhandler.d.ts +1 -1
  479. package/build/npm/types-ts3.8/integrations-bundle/index.dedupe.d.ts +1 -1
  480. package/build/npm/types-ts3.8/integrations-bundle/index.extraerrordata.d.ts +1 -1
  481. package/build/npm/types-ts3.8/integrations-bundle/index.feedback.d.ts +1 -1
  482. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentanthropicaiclient.d.ts +1 -1
  483. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +1 -1
  484. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlangchainembeddings.d.ts +1 -1
  485. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlanggraph.d.ts +1 -1
  486. package/build/npm/types-ts3.8/integrations-bundle/index.instrumentopenaiclient.d.ts +1 -1
  487. package/build/npm/types-ts3.8/integrations-bundle/index.modulemetadata.d.ts +1 -1
  488. package/build/npm/types-ts3.8/integrations-bundle/index.rewriteframes.d.ts +1 -1
  489. package/build/npm/types-ts3.8/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
  490. package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +1 -1
  491. package/build/npm/types-ts3.8/profiling/index.d.ts +1 -1
  492. package/build/npm/types-ts3.8/profiling/startProfileForSpan.d.ts +1 -1
  493. package/build/npm/types-ts3.8/profiling/utils.d.ts +3 -5
  494. package/build/npm/types-ts3.8/report-dialog.d.ts +1 -1
  495. package/build/npm/types-ts3.8/sdk.d.ts +1 -1
  496. package/build/npm/types-ts3.8/stack-parsers.d.ts +1 -1
  497. package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +1 -1
  498. package/build/npm/types-ts3.8/tracing/linkedTraces.d.ts +2 -2
  499. package/build/npm/types-ts3.8/tracing/reportPageLoaded.d.ts +1 -1
  500. package/build/npm/types-ts3.8/tracing/request.d.ts +1 -1
  501. package/build/npm/types-ts3.8/tracing/setActiveSpan.d.ts +1 -1
  502. package/build/npm/types-ts3.8/transports/fetch.d.ts +1 -1
  503. package/build/npm/types-ts3.8/transports/offline.d.ts +1 -1
  504. package/build/npm/types-ts3.8/transports/types.d.ts +1 -1
  505. package/build/npm/types-ts3.8/userfeedback.d.ts +1 -1
  506. package/build/npm/types-ts3.8/utils/lazyLoadIntegration.d.ts +1 -1
  507. package/package.json +7 -7
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const core = require('@sentry/core');
3
+ const browser = require('@sentry/core/browser');
4
4
  const debugBuild = require('../debug-build.js');
5
5
  const helpers = require('../helpers.js');
6
6
  const utils = require('./utils.js');
@@ -14,7 +14,7 @@ function startProfileForSpan(span) {
14
14
  // Start the profiler and get the profiler instance.
15
15
  let startTimestamp;
16
16
  if (utils.isAutomatedPageLoadSpan(span)) {
17
- startTimestamp = core.timestampInSeconds() * 1000;
17
+ startTimestamp = browser.timestampInSeconds() * 1000;
18
18
  }
19
19
 
20
20
  const profiler = utils.startJSSelfProfile();
@@ -26,13 +26,13 @@ function startProfileForSpan(span) {
26
26
  }
27
27
 
28
28
  if (debugBuild.DEBUG_BUILD) {
29
- core.debug.log(`[Profiling] started profiling span: ${core.spanToJSON(span).description}`);
29
+ browser.debug.log(`[Profiling] started profiling span: ${browser.spanToJSON(span).description}`);
30
30
  }
31
31
 
32
32
  // We create "unique" span names to avoid concurrent spans with same names
33
33
  // from being ignored by the profiler. From here on, only this span name should be used when
34
34
  // calling the profiler methods. Note: we log the original name to the user to avoid confusion.
35
- const profileId = core.uuid4();
35
+ const profileId = browser.uuid4();
36
36
 
37
37
  // A couple of important things to note here:
38
38
  // `CpuProfilerBindings.stopProfiling` will be scheduled to run in 30seconds in order to exceed max profile duration.
@@ -43,11 +43,14 @@ function startProfileForSpan(span) {
43
43
  // After the original finish method is called, the event will be reported through the integration and delegated to transport.
44
44
  let processedProfile = null;
45
45
 
46
- core.getCurrentScope().setContext('profile', {
46
+ browser.getCurrentScope().setContext('profile', {
47
47
  profile_id: profileId,
48
48
  start_timestamp: startTimestamp,
49
49
  });
50
50
 
51
+ utils.PROFILED_ROOT_SPANS.add(span);
52
+ utils.setThreadAttributes(span);
53
+
51
54
  /**
52
55
  * Idempotent handler for profile stop
53
56
  */
@@ -62,7 +65,7 @@ function startProfileForSpan(span) {
62
65
  }
63
66
  if (processedProfile) {
64
67
  if (debugBuild.DEBUG_BUILD) {
65
- core.debug.log('[Profiling] profile for:', core.spanToJSON(span).description, 'already exists, returning early');
68
+ browser.debug.log('[Profiling] profile for:', browser.spanToJSON(span).description, 'already exists, returning early');
66
69
  }
67
70
  return;
68
71
  }
@@ -76,14 +79,14 @@ function startProfileForSpan(span) {
76
79
  }
77
80
 
78
81
  if (debugBuild.DEBUG_BUILD) {
79
- core.debug.log(`[Profiling] stopped profiling of span: ${core.spanToJSON(span).description}`);
82
+ browser.debug.log(`[Profiling] stopped profiling of span: ${browser.spanToJSON(span).description}`);
80
83
  }
81
84
 
82
85
  // In case of an overlapping span, stopProfiling may return null and silently ignore the overlapping profile.
83
86
  if (!profile) {
84
87
  if (debugBuild.DEBUG_BUILD) {
85
- core.debug.log(
86
- `[Profiling] profiler returned null profile for: ${core.spanToJSON(span).description}`,
88
+ browser.debug.log(
89
+ `[Profiling] profiler returned null profile for: ${browser.spanToJSON(span).description}`,
87
90
  'this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started',
88
91
  );
89
92
  }
@@ -95,7 +98,7 @@ function startProfileForSpan(span) {
95
98
  })
96
99
  .catch(error => {
97
100
  if (debugBuild.DEBUG_BUILD) {
98
- core.debug.log('[Profiling] error while stopping profiler:', error);
101
+ browser.debug.log('[Profiling] error while stopping profiler:', error);
99
102
  }
100
103
  });
101
104
  }
@@ -103,7 +106,7 @@ function startProfileForSpan(span) {
103
106
  // Enqueue a timeout to prevent profiles from running over max duration.
104
107
  let maxDurationTimeoutID = helpers.WINDOW.setTimeout(() => {
105
108
  if (debugBuild.DEBUG_BUILD) {
106
- core.debug.log('[Profiling] max profile duration elapsed, stopping profiling for:', core.spanToJSON(span).description);
109
+ browser.debug.log('[Profiling] max profile duration elapsed, stopping profiling for:', browser.spanToJSON(span).description);
107
110
  }
108
111
  // If the timeout exceeds, we want to stop profiling, but not finish the span
109
112
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -1 +1 @@
1
- {"version":3,"file":"startProfileForSpan.js","sources":["../../../../../src/profiling/startProfileForSpan.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { debug, getCurrentScope, spanToJSON, timestampInSeconds, uuid4 } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile } from './jsSelfProfiling';\nimport { addProfileToGlobalCache, isAutomatedPageLoadSpan, MAX_PROFILE_DURATION_MS, startJSSelfProfile } from './utils';\n\n/**\n * Wraps startTransaction and stopTransaction with profiling related logic.\n * startProfileForTransaction is called after the call to startTransaction in order to avoid our own code from\n * being profiled. Because of that same reason, stopProfiling is called before the call to stopTransaction.\n */\nexport function startProfileForSpan(span: Span): void {\n // Start the profiler and get the profiler instance.\n let startTimestamp: number | undefined;\n if (isAutomatedPageLoadSpan(span)) {\n startTimestamp = timestampInSeconds() * 1000;\n }\n\n const profiler = startJSSelfProfile();\n\n // We failed to construct the profiler, so we skip.\n // No need to log anything as this has already been logged in startProfile.\n if (!profiler) {\n return;\n }\n\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] started profiling span: ${spanToJSON(span).description}`);\n }\n\n // We create \"unique\" span names to avoid concurrent spans with same names\n // from being ignored by the profiler. From here on, only this span name should be used when\n // calling the profiler methods. Note: we log the original name to the user to avoid confusion.\n const profileId = uuid4();\n\n // A couple of important things to note here:\n // `CpuProfilerBindings.stopProfiling` will be scheduled to run in 30seconds in order to exceed max profile duration.\n // Whichever of the two (span.finish/timeout) is first to run, the profiling will be stopped and the gathered profile\n // will be processed when the original span is finished. Since onProfileHandler can be invoked multiple times in the\n // event of an error or user mistake (calling span.finish multiple times), it is important that the behavior of onProfileHandler\n // is idempotent as we do not want any timings or profiles to be overridden by the last call to onProfileHandler.\n // After the original finish method is called, the event will be reported through the integration and delegated to transport.\n let processedProfile: JSSelfProfile | null = null;\n\n getCurrentScope().setContext('profile', {\n profile_id: profileId,\n start_timestamp: startTimestamp,\n });\n\n /**\n * Idempotent handler for profile stop\n */\n async function onProfileHandler(): Promise<void> {\n // Check if the profile exists and return it the behavior has to be idempotent as users may call span.finish multiple times.\n if (!span) {\n return;\n }\n // Satisfy the type checker, but profiler will always be defined here.\n if (!profiler) {\n return;\n }\n if (processedProfile) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] profile for:', spanToJSON(span).description, 'already exists, returning early');\n }\n return;\n }\n\n return profiler\n .stop()\n .then((profile: JSSelfProfile): void => {\n if (maxDurationTimeoutID) {\n WINDOW.clearTimeout(maxDurationTimeoutID);\n maxDurationTimeoutID = undefined;\n }\n\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] stopped profiling of span: ${spanToJSON(span).description}`);\n }\n\n // In case of an overlapping span, stopProfiling may return null and silently ignore the overlapping profile.\n if (!profile) {\n if (DEBUG_BUILD) {\n debug.log(\n `[Profiling] profiler returned null profile for: ${spanToJSON(span).description}`,\n 'this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started',\n );\n }\n return;\n }\n\n processedProfile = profile;\n addProfileToGlobalCache(profileId, profile);\n })\n .catch(error => {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] error while stopping profiler:', error);\n }\n });\n }\n\n // Enqueue a timeout to prevent profiles from running over max duration.\n let maxDurationTimeoutID: number | undefined = WINDOW.setTimeout(() => {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] max profile duration elapsed, stopping profiling for:', spanToJSON(span).description);\n }\n // If the timeout exceeds, we want to stop profiling, but not finish the span\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n onProfileHandler();\n }, MAX_PROFILE_DURATION_MS);\n\n // We need to reference the original end call to avoid creating an infinite loop\n const originalEnd = span.end.bind(span);\n\n /**\n * Wraps span `end()` with profiling related logic.\n * startProfiling is called after the call to spanStart in order to avoid our own code from\n * being profiled. Because of that same reason, stopProfiling is called before the call to spanEnd.\n */\n function profilingWrappedSpanEnd(): Span {\n if (!span) {\n return originalEnd();\n }\n // onProfileHandler should always return the same profile even if this is called multiple times.\n // Always call onProfileHandler to ensure stopProfiling is called and the timeout is cleared.\n void onProfileHandler().then(\n () => {\n originalEnd();\n },\n () => {\n // If onProfileHandler fails, we still want to call the original finish method.\n originalEnd();\n },\n );\n\n return span;\n }\n\n span.end = profilingWrappedSpanEnd;\n}\n"],"names":["isAutomatedPageLoadSpan","timestampInSeconds","startJSSelfProfile","DEBUG_BUILD","debug","spanToJSON","uuid4","getCurrentScope","WINDOW","addProfileToGlobalCache","MAX_PROFILE_DURATION_MS"],"mappings":"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"}
1
+ {"version":3,"file":"startProfileForSpan.js","sources":["../../../../../src/profiling/startProfileForSpan.ts"],"sourcesContent":["import type { Span } from '@sentry/core/browser';\nimport { debug, getCurrentScope, spanToJSON, timestampInSeconds, uuid4 } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile } from './jsSelfProfiling';\nimport {\n addProfileToGlobalCache,\n isAutomatedPageLoadSpan,\n MAX_PROFILE_DURATION_MS,\n PROFILED_ROOT_SPANS,\n setThreadAttributes,\n startJSSelfProfile,\n} from './utils';\n\n/**\n * Wraps startTransaction and stopTransaction with profiling related logic.\n * startProfileForTransaction is called after the call to startTransaction in order to avoid our own code from\n * being profiled. Because of that same reason, stopProfiling is called before the call to stopTransaction.\n */\nexport function startProfileForSpan(span: Span): void {\n // Start the profiler and get the profiler instance.\n let startTimestamp: number | undefined;\n if (isAutomatedPageLoadSpan(span)) {\n startTimestamp = timestampInSeconds() * 1000;\n }\n\n const profiler = startJSSelfProfile();\n\n // We failed to construct the profiler, so we skip.\n // No need to log anything as this has already been logged in startProfile.\n if (!profiler) {\n return;\n }\n\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] started profiling span: ${spanToJSON(span).description}`);\n }\n\n // We create \"unique\" span names to avoid concurrent spans with same names\n // from being ignored by the profiler. From here on, only this span name should be used when\n // calling the profiler methods. Note: we log the original name to the user to avoid confusion.\n const profileId = uuid4();\n\n // A couple of important things to note here:\n // `CpuProfilerBindings.stopProfiling` will be scheduled to run in 30seconds in order to exceed max profile duration.\n // Whichever of the two (span.finish/timeout) is first to run, the profiling will be stopped and the gathered profile\n // will be processed when the original span is finished. Since onProfileHandler can be invoked multiple times in the\n // event of an error or user mistake (calling span.finish multiple times), it is important that the behavior of onProfileHandler\n // is idempotent as we do not want any timings or profiles to be overridden by the last call to onProfileHandler.\n // After the original finish method is called, the event will be reported through the integration and delegated to transport.\n let processedProfile: JSSelfProfile | null = null;\n\n getCurrentScope().setContext('profile', {\n profile_id: profileId,\n start_timestamp: startTimestamp,\n });\n\n PROFILED_ROOT_SPANS.add(span);\n setThreadAttributes(span);\n\n /**\n * Idempotent handler for profile stop\n */\n async function onProfileHandler(): Promise<void> {\n // Check if the profile exists and return it the behavior has to be idempotent as users may call span.finish multiple times.\n if (!span) {\n return;\n }\n // Satisfy the type checker, but profiler will always be defined here.\n if (!profiler) {\n return;\n }\n if (processedProfile) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] profile for:', spanToJSON(span).description, 'already exists, returning early');\n }\n return;\n }\n\n return profiler\n .stop()\n .then((profile: JSSelfProfile): void => {\n if (maxDurationTimeoutID) {\n WINDOW.clearTimeout(maxDurationTimeoutID);\n maxDurationTimeoutID = undefined;\n }\n\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] stopped profiling of span: ${spanToJSON(span).description}`);\n }\n\n // In case of an overlapping span, stopProfiling may return null and silently ignore the overlapping profile.\n if (!profile) {\n if (DEBUG_BUILD) {\n debug.log(\n `[Profiling] profiler returned null profile for: ${spanToJSON(span).description}`,\n 'this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started',\n );\n }\n return;\n }\n\n processedProfile = profile;\n addProfileToGlobalCache(profileId, profile);\n })\n .catch(error => {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] error while stopping profiler:', error);\n }\n });\n }\n\n // Enqueue a timeout to prevent profiles from running over max duration.\n let maxDurationTimeoutID: number | undefined = WINDOW.setTimeout(() => {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] max profile duration elapsed, stopping profiling for:', spanToJSON(span).description);\n }\n // If the timeout exceeds, we want to stop profiling, but not finish the span\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n onProfileHandler();\n }, MAX_PROFILE_DURATION_MS);\n\n // We need to reference the original end call to avoid creating an infinite loop\n const originalEnd = span.end.bind(span);\n\n /**\n * Wraps span `end()` with profiling related logic.\n * startProfiling is called after the call to spanStart in order to avoid our own code from\n * being profiled. Because of that same reason, stopProfiling is called before the call to spanEnd.\n */\n function profilingWrappedSpanEnd(): Span {\n if (!span) {\n return originalEnd();\n }\n // onProfileHandler should always return the same profile even if this is called multiple times.\n // Always call onProfileHandler to ensure stopProfiling is called and the timeout is cleared.\n void onProfileHandler().then(\n () => {\n originalEnd();\n },\n () => {\n // If onProfileHandler fails, we still want to call the original finish method.\n originalEnd();\n },\n );\n\n return span;\n }\n\n span.end = profilingWrappedSpanEnd;\n}\n"],"names":["isAutomatedPageLoadSpan","timestampInSeconds","startJSSelfProfile","DEBUG_BUILD","debug","spanToJSON","uuid4","getCurrentScope","PROFILED_ROOT_SPANS","setThreadAttributes","WINDOW","addProfileToGlobalCache","MAX_PROFILE_DURATION_MS"],"mappings":"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"}
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const core = require('@sentry/core');
3
+ const browser = require('@sentry/core/browser');
4
4
  const debugBuild = require('../debug-build.js');
5
5
  const helpers = require('../helpers.js');
6
6
 
7
7
  const MS_TO_NS = 1e6;
8
8
 
9
9
  // 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
10
- const isMainThread = 'window' in core.GLOBAL_OBJ && core.GLOBAL_OBJ.window === core.GLOBAL_OBJ && typeof importScripts === 'undefined';
10
+ const isMainThread = 'window' in browser.GLOBAL_OBJ && browser.GLOBAL_OBJ.window === browser.GLOBAL_OBJ && typeof importScripts === 'undefined';
11
11
 
12
12
  // Setting ID to 0 as we cannot get an ID from Web Workers
13
13
  const PROFILER_THREAD_ID_STRING = String(0);
@@ -76,7 +76,7 @@ function getTraceId(event) {
76
76
  // warn users that this is happening if they enable debug flag
77
77
  if (typeof traceId === 'string' && traceId.length !== 32) {
78
78
  if (debugBuild.DEBUG_BUILD) {
79
- core.debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
79
+ browser.debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
80
80
  }
81
81
  }
82
82
  if (typeof traceId !== 'string') {
@@ -122,8 +122,8 @@ function createProfilePayload(
122
122
  ? start_timestamp
123
123
  : typeof event.start_timestamp === 'number'
124
124
  ? event.start_timestamp * 1000
125
- : core.timestampInSeconds() * 1000;
126
- const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : core.timestampInSeconds() * 1000;
125
+ : browser.timestampInSeconds() * 1000;
126
+ const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : browser.timestampInSeconds() * 1000;
127
127
 
128
128
  const profile = {
129
129
  event_id: profile_id,
@@ -131,7 +131,7 @@ function createProfilePayload(
131
131
  platform: 'javascript',
132
132
  version: '1',
133
133
  release: event.release || '',
134
- environment: event.environment || core.DEFAULT_ENVIRONMENT,
134
+ environment: event.environment || browser.DEFAULT_ENVIRONMENT,
135
135
  runtime: {
136
136
  name: 'javascript',
137
137
  version: helpers.WINDOW.navigator.userAgent,
@@ -155,7 +155,7 @@ function createProfilePayload(
155
155
  transactions: [
156
156
  {
157
157
  name: event.transaction || '',
158
- id: event.event_id || core.uuid4(),
158
+ id: event.event_id || browser.uuid4(),
159
159
  trace_id: traceId,
160
160
  active_thread_id: PROFILER_THREAD_ID_STRING,
161
161
  relative_start_ns: '0',
@@ -188,12 +188,12 @@ function createProfileChunkPayload(
188
188
  const sdk = client.getSdkMetadata?.()?.sdk;
189
189
 
190
190
  return {
191
- chunk_id: core.uuid4(),
191
+ chunk_id: browser.uuid4(),
192
192
  client_sdk: {
193
193
  name: sdk?.name ?? 'sentry.javascript.browser',
194
194
  version: sdk?.version ?? '0.0.0',
195
195
  },
196
- profiler_id: profilerId || core.uuid4(),
196
+ profiler_id: profilerId || browser.uuid4(),
197
197
  platform: 'javascript',
198
198
  version: '2',
199
199
  release: options.release ?? '',
@@ -292,7 +292,7 @@ function convertToContinuousProfile(input
292
292
  }
293
293
 
294
294
  // Align timestamps to SDK time origin to match span/event timelines
295
- const perfOrigin = core.browserPerformanceTimeOrigin();
295
+ const perfOrigin = browser.browserPerformanceTimeOrigin();
296
296
  const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;
297
297
  const adjustForOriginChange = origin - (perfOrigin || origin);
298
298
 
@@ -326,7 +326,7 @@ function convertToContinuousProfile(input
326
326
  *
327
327
  */
328
328
  function isAutomatedPageLoadSpan(span) {
329
- return core.spanToJSON(span).op === 'pageload';
329
+ return browser.spanToJSON(span).op === 'pageload';
330
330
  }
331
331
 
332
332
  /**
@@ -358,7 +358,7 @@ function convertJSSelfProfileToSampledFormat(input) {
358
358
  // when that happens, we need to ensure we are correcting the profile timings so the two timelines stay in sync.
359
359
  // Since JS self profiling time origin is always initialized to performance.timeOrigin, we need to adjust for
360
360
  // the drift between the SDK selected value and our profile time origin.
361
- const perfOrigin = core.browserPerformanceTimeOrigin();
361
+ const perfOrigin = browser.browserPerformanceTimeOrigin();
362
362
  const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;
363
363
  const adjustForOriginChange = origin - (perfOrigin || origin);
364
364
 
@@ -442,7 +442,7 @@ function addProfilesToEnvelope(envelope, profiles) {
442
442
  function findProfiledTransactionsFromEnvelope(envelope) {
443
443
  const events = [];
444
444
 
445
- core.forEachEnvelopeItem(envelope, (item, type) => {
445
+ browser.forEachEnvelopeItem(envelope, (item, type) => {
446
446
  if (type !== 'transaction') {
447
447
  return;
448
448
  }
@@ -463,7 +463,7 @@ function findProfiledTransactionsFromEnvelope(envelope) {
463
463
  * Applies debug meta data to an event from a list of paths to resources (sourcemaps)
464
464
  */
465
465
  function applyDebugMetadata(resource_paths) {
466
- const client = core.getClient();
466
+ const client = browser.getClient();
467
467
  const options = client?.getOptions();
468
468
  const stackParser = options?.stackParser;
469
469
 
@@ -471,7 +471,7 @@ function applyDebugMetadata(resource_paths) {
471
471
  return [];
472
472
  }
473
473
 
474
- return core.getDebugImagesForResources(stackParser, resource_paths);
474
+ return browser.getDebugImagesForResources(stackParser, resource_paths);
475
475
  }
476
476
 
477
477
  /**
@@ -481,7 +481,7 @@ function isValidSampleRate(rate) {
481
481
  // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck
482
482
  if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {
483
483
  debugBuild.DEBUG_BUILD &&
484
- core.debug.warn(
484
+ browser.debug.warn(
485
485
  `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
486
486
  rate,
487
487
  )} of type ${JSON.stringify(typeof rate)}.`,
@@ -496,7 +496,7 @@ function isValidSampleRate(rate) {
496
496
 
497
497
  // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false
498
498
  if (rate < 0 || rate > 1) {
499
- debugBuild.DEBUG_BUILD && core.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
499
+ debugBuild.DEBUG_BUILD && browser.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
500
500
  return false;
501
501
  }
502
502
  return true;
@@ -508,14 +508,14 @@ function isValidProfile(profile) {
508
508
  // Log a warning if the profile has less than 2 samples so users can know why
509
509
  // they are not seeing any profiling data and we cant avoid the back and forth
510
510
  // of asking them to provide us with a dump of the profile data.
511
- core.debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
511
+ browser.debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
512
512
  }
513
513
  return false;
514
514
  }
515
515
 
516
516
  if (!profile.frames.length) {
517
517
  if (debugBuild.DEBUG_BUILD) {
518
- core.debug.log('[Profiling] Discarding profile because it contains no frames');
518
+ browser.debug.log('[Profiling] Discarding profile because it contains no frames');
519
519
  }
520
520
  return false;
521
521
  }
@@ -545,7 +545,7 @@ function startJSSelfProfile() {
545
545
 
546
546
  if (!isJSProfilerSupported(JSProfilerConstructor)) {
547
547
  if (debugBuild.DEBUG_BUILD) {
548
- core.debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');
548
+ browser.debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');
549
549
  }
550
550
  return;
551
551
  }
@@ -562,10 +562,10 @@ function startJSSelfProfile() {
562
562
  return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
563
563
  } catch (_e) {
564
564
  if (debugBuild.DEBUG_BUILD) {
565
- core.debug.log(
565
+ browser.debug.log(
566
566
  "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.",
567
567
  );
568
- core.debug.log('[Profiling] Disabling profiling for current user session.');
568
+ browser.debug.log('[Profiling] Disabling profiling for current user session.');
569
569
  }
570
570
  PROFILING_CONSTRUCTOR_FAILED = true;
571
571
  }
@@ -580,20 +580,20 @@ function shouldProfileSpanLegacy(span) {
580
580
  // If constructor failed once, it will always fail, so we can early return.
581
581
  if (PROFILING_CONSTRUCTOR_FAILED) {
582
582
  if (debugBuild.DEBUG_BUILD) {
583
- core.debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');
583
+ browser.debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');
584
584
  }
585
585
  return false;
586
586
  }
587
587
 
588
588
  if (!span.isRecording()) {
589
- debugBuild.DEBUG_BUILD && core.debug.log('[Profiling] Discarding profile because root span was not sampled.');
589
+ debugBuild.DEBUG_BUILD && browser.debug.log('[Profiling] Discarding profile because root span was not sampled.');
590
590
  return false;
591
591
  }
592
592
 
593
- const client = core.getClient();
593
+ const client = browser.getClient();
594
594
  const options = client?.getOptions();
595
595
  if (!options) {
596
- debugBuild.DEBUG_BUILD && core.debug.log('[Profiling] Profiling disabled, no options found.');
596
+ debugBuild.DEBUG_BUILD && browser.debug.log('[Profiling] Profiling disabled, no options found.');
597
597
  return false;
598
598
  }
599
599
 
@@ -605,14 +605,14 @@ function shouldProfileSpanLegacy(span) {
605
605
  // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
606
606
  // only valid values are booleans or numbers between 0 and 1.)
607
607
  if (!isValidSampleRate(profilesSampleRate)) {
608
- debugBuild.DEBUG_BUILD && core.debug.warn('[Profiling] Discarding profile because of invalid sample rate.');
608
+ debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Discarding profile because of invalid sample rate.');
609
609
  return false;
610
610
  }
611
611
 
612
612
  // if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped
613
613
  if (!profilesSampleRate) {
614
614
  debugBuild.DEBUG_BUILD &&
615
- core.debug.log(
615
+ browser.debug.log(
616
616
  '[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0',
617
617
  );
618
618
  return false;
@@ -624,7 +624,7 @@ function shouldProfileSpanLegacy(span) {
624
624
  // Check if we should sample this profile
625
625
  if (!sampled) {
626
626
  debugBuild.DEBUG_BUILD &&
627
- core.debug.log(
627
+ browser.debug.log(
628
628
  `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
629
629
  profilesSampleRate,
630
630
  )})`,
@@ -642,7 +642,7 @@ function shouldProfileSession(options) {
642
642
  // If constructor failed once, it will always fail, so we can early return.
643
643
  if (PROFILING_CONSTRUCTOR_FAILED) {
644
644
  if (debugBuild.DEBUG_BUILD) {
645
- core.debug.log(
645
+ browser.debug.log(
646
646
  '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',
647
647
  );
648
648
  }
@@ -650,7 +650,7 @@ function shouldProfileSession(options) {
650
650
  }
651
651
 
652
652
  if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {
653
- debugBuild.DEBUG_BUILD && core.debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');
653
+ debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');
654
654
  return false;
655
655
  }
656
656
 
@@ -658,13 +658,13 @@ function shouldProfileSession(options) {
658
658
  const profileSessionSampleRate = options.profileSessionSampleRate;
659
659
 
660
660
  if (!isValidSampleRate(profileSessionSampleRate)) {
661
- debugBuild.DEBUG_BUILD && core.debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');
661
+ debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');
662
662
  return false;
663
663
  }
664
664
 
665
665
  if (!profileSessionSampleRate) {
666
666
  debugBuild.DEBUG_BUILD &&
667
- core.debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');
667
+ browser.debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');
668
668
  return false;
669
669
  }
670
670
 
@@ -732,50 +732,20 @@ function addProfileToGlobalCache(profile_id, profile) {
732
732
  }
733
733
  }
734
734
 
735
- /**
736
- * Attaches the profiled thread information to the event's trace context.
737
- */
738
- function attachProfiledThreadToEvent(event) {
739
- if (!event?.contexts?.profile) {
740
- return event;
741
- }
742
-
743
- if (!event.contexts) {
744
- return event;
745
- }
746
-
747
- // Only mutate the trace context when it already has a trace_id — that
748
- // guarantees `applySpanToEvent` has already run, and we are not creating a partial trace context from scratch.
749
- if (event.contexts.trace?.trace_id) {
750
- event.contexts.trace = {
751
- ...event.contexts.trace,
752
- data: {
753
- ...(event.contexts.trace.data ?? {}),
754
- ['thread.id']: PROFILER_THREAD_ID_STRING,
755
- ['thread.name']: PROFILER_THREAD_NAME,
756
- },
757
- };
758
- }
759
-
760
- // Attach thread info to individual spans so that spans can be associated with the profiled thread on the UI even if contexts are missing.
761
- event.spans?.forEach(span => {
762
- span.data = {
763
- ...(span.data || {}),
764
- ['thread.id']: PROFILER_THREAD_ID_STRING,
765
- ['thread.name']: PROFILER_THREAD_NAME,
766
- };
767
- });
735
+ const PROFILED_ROOT_SPANS = new WeakSet();
768
736
 
769
- return event;
737
+ function setThreadAttributes(span) {
738
+ span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);
739
+ span.setAttribute('thread.name', PROFILER_THREAD_NAME);
770
740
  }
771
741
 
772
742
  exports.MAX_PROFILE_DURATION_MS = MAX_PROFILE_DURATION_MS;
743
+ exports.PROFILED_ROOT_SPANS = PROFILED_ROOT_SPANS;
773
744
  exports.PROFILER_THREAD_ID_STRING = PROFILER_THREAD_ID_STRING;
774
745
  exports.PROFILER_THREAD_NAME = PROFILER_THREAD_NAME;
775
746
  exports.addProfileToGlobalCache = addProfileToGlobalCache;
776
747
  exports.addProfilesToEnvelope = addProfilesToEnvelope;
777
748
  exports.applyDebugMetadata = applyDebugMetadata;
778
- exports.attachProfiledThreadToEvent = attachProfiledThreadToEvent;
779
749
  exports.convertJSSelfProfileToSampledFormat = convertJSSelfProfileToSampledFormat;
780
750
  exports.createProfileChunkPayload = createProfileChunkPayload;
781
751
  exports.createProfilePayload = createProfilePayload;
@@ -786,6 +756,7 @@ exports.getActiveProfilesCount = getActiveProfilesCount;
786
756
  exports.hasLegacyProfiling = hasLegacyProfiling;
787
757
  exports.isAutomatedPageLoadSpan = isAutomatedPageLoadSpan;
788
758
  exports.isValidSampleRate = isValidSampleRate;
759
+ exports.setThreadAttributes = setThreadAttributes;
789
760
  exports.shouldProfileSession = shouldProfileSession;
790
761
  exports.shouldProfileSpanLegacy = shouldProfileSpanLegacy;
791
762
  exports.startJSSelfProfile = startJSSelfProfile;