@sentry/browser 10.53.1 → 10.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/build/npm/cjs/dev/client.js +15 -54
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/debug-build.js +0 -5
  4. package/build/npm/cjs/dev/debug-build.js.map +1 -1
  5. package/build/npm/cjs/dev/diagnose-sdk.js +15 -37
  6. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
  7. package/build/npm/cjs/dev/eventbuilder.js +59 -217
  8. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  9. package/build/npm/cjs/dev/feedbackAsync.js +1 -5
  10. package/build/npm/cjs/dev/feedbackAsync.js.map +1 -1
  11. package/build/npm/cjs/dev/feedbackSync.js +1 -2
  12. package/build/npm/cjs/dev/feedbackSync.js.map +1 -1
  13. package/build/npm/cjs/dev/helpers.js +24 -102
  14. package/build/npm/cjs/dev/helpers.js.map +1 -1
  15. package/build/npm/cjs/dev/index.js +2 -0
  16. package/build/npm/cjs/dev/index.js.map +1 -1
  17. package/build/npm/cjs/dev/integrations/breadcrumbs.js +52 -134
  18. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
  19. package/build/npm/cjs/dev/integrations/browserapierrors.js +45 -111
  20. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
  21. package/build/npm/cjs/dev/integrations/browsersession.js +7 -35
  22. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  23. package/build/npm/cjs/dev/integrations/contextlines.js +9 -45
  24. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
  25. package/build/npm/cjs/dev/integrations/culturecontext.js +11 -36
  26. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  27. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +1 -22
  28. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  29. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
  30. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  31. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +6 -12
  32. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  33. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -30
  34. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  35. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +10 -47
  36. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  37. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +60 -0
  38. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -0
  39. package/build/npm/cjs/dev/integrations/globalhandlers.js +38 -99
  40. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
  41. package/build/npm/cjs/dev/integrations/graphqlClient.js +31 -119
  42. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  43. package/build/npm/cjs/dev/integrations/httpclient.js +43 -203
  44. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  45. package/build/npm/cjs/dev/integrations/httpcontext.js +7 -17
  46. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  47. package/build/npm/cjs/dev/integrations/linkederrors.js +7 -15
  48. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
  49. package/build/npm/cjs/dev/integrations/reportingobserver.js +19 -44
  50. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
  51. package/build/npm/cjs/dev/integrations/spanstreaming.js +11 -29
  52. package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
  53. package/build/npm/cjs/dev/integrations/spotlight.js +17 -30
  54. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  55. package/build/npm/cjs/dev/integrations/view-hierarchy.js +19 -46
  56. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  57. package/build/npm/cjs/dev/integrations/webWorker.js +40 -211
  58. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
  59. package/build/npm/cjs/dev/profiling/UIProfiler.js +87 -190
  60. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  61. package/build/npm/cjs/dev/profiling/index.js +9 -30
  62. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  63. package/build/npm/cjs/dev/profiling/integration.js +30 -64
  64. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  65. package/build/npm/cjs/dev/profiling/startProfileForSpan.js +28 -84
  66. package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -1
  67. package/build/npm/cjs/dev/profiling/utils.js +131 -398
  68. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  69. package/build/npm/cjs/dev/report-dialog.js +10 -25
  70. package/build/npm/cjs/dev/report-dialog.js.map +1 -1
  71. package/build/npm/cjs/dev/sdk.js +8 -76
  72. package/build/npm/cjs/dev/sdk.js.map +1 -1
  73. package/build/npm/cjs/dev/stack-parsers.js +42 -126
  74. package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
  75. package/build/npm/cjs/dev/tracing/backgroundtab.js +4 -16
  76. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  77. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +102 -291
  78. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  79. package/build/npm/cjs/dev/tracing/linkedTraces.js +25 -116
  80. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  81. package/build/npm/cjs/dev/tracing/reportPageLoaded.js +1 -9
  82. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
  83. package/build/npm/cjs/dev/tracing/request.js +58 -223
  84. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  85. package/build/npm/cjs/dev/tracing/setActiveSpan.js +1 -48
  86. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
  87. package/build/npm/cjs/dev/tracing/utils.js +4 -27
  88. package/build/npm/cjs/dev/tracing/utils.js.map +1 -1
  89. package/build/npm/cjs/dev/transports/fetch.js +10 -23
  90. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  91. package/build/npm/cjs/dev/transports/offline.js +27 -84
  92. package/build/npm/cjs/dev/transports/offline.js.map +1 -1
  93. package/build/npm/cjs/dev/userfeedback.js +12 -22
  94. package/build/npm/cjs/dev/userfeedback.js.map +1 -1
  95. package/build/npm/cjs/dev/utils/detectBrowserExtension.js +5 -26
  96. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
  97. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +40 -75
  98. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  99. package/build/npm/cjs/prod/client.js +15 -54
  100. package/build/npm/cjs/prod/client.js.map +1 -1
  101. package/build/npm/cjs/prod/debug-build.js +0 -5
  102. package/build/npm/cjs/prod/debug-build.js.map +1 -1
  103. package/build/npm/cjs/prod/diagnose-sdk.js +15 -37
  104. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
  105. package/build/npm/cjs/prod/eventbuilder.js +59 -217
  106. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  107. package/build/npm/cjs/prod/feedbackAsync.js +1 -5
  108. package/build/npm/cjs/prod/feedbackAsync.js.map +1 -1
  109. package/build/npm/cjs/prod/feedbackSync.js +1 -2
  110. package/build/npm/cjs/prod/feedbackSync.js.map +1 -1
  111. package/build/npm/cjs/prod/helpers.js +24 -102
  112. package/build/npm/cjs/prod/helpers.js.map +1 -1
  113. package/build/npm/cjs/prod/index.js +2 -0
  114. package/build/npm/cjs/prod/index.js.map +1 -1
  115. package/build/npm/cjs/prod/integrations/breadcrumbs.js +52 -134
  116. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
  117. package/build/npm/cjs/prod/integrations/browserapierrors.js +45 -111
  118. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
  119. package/build/npm/cjs/prod/integrations/browsersession.js +7 -35
  120. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  121. package/build/npm/cjs/prod/integrations/contextlines.js +9 -45
  122. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
  123. package/build/npm/cjs/prod/integrations/culturecontext.js +11 -36
  124. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  125. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +1 -22
  126. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  127. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
  128. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  129. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +6 -12
  130. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  131. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -30
  132. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  133. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +10 -47
  134. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  135. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +60 -0
  136. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -0
  137. package/build/npm/cjs/prod/integrations/globalhandlers.js +38 -99
  138. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
  139. package/build/npm/cjs/prod/integrations/graphqlClient.js +31 -119
  140. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  141. package/build/npm/cjs/prod/integrations/httpclient.js +43 -203
  142. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  143. package/build/npm/cjs/prod/integrations/httpcontext.js +7 -17
  144. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  145. package/build/npm/cjs/prod/integrations/linkederrors.js +7 -15
  146. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
  147. package/build/npm/cjs/prod/integrations/reportingobserver.js +19 -44
  148. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
  149. package/build/npm/cjs/prod/integrations/spanstreaming.js +11 -29
  150. package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
  151. package/build/npm/cjs/prod/integrations/spotlight.js +17 -30
  152. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  153. package/build/npm/cjs/prod/integrations/view-hierarchy.js +19 -46
  154. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  155. package/build/npm/cjs/prod/integrations/webWorker.js +40 -211
  156. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
  157. package/build/npm/cjs/prod/profiling/UIProfiler.js +87 -190
  158. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  159. package/build/npm/cjs/prod/profiling/index.js +9 -30
  160. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  161. package/build/npm/cjs/prod/profiling/integration.js +30 -64
  162. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  163. package/build/npm/cjs/prod/profiling/startProfileForSpan.js +28 -84
  164. package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -1
  165. package/build/npm/cjs/prod/profiling/utils.js +131 -398
  166. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  167. package/build/npm/cjs/prod/report-dialog.js +10 -25
  168. package/build/npm/cjs/prod/report-dialog.js.map +1 -1
  169. package/build/npm/cjs/prod/sdk.js +5 -73
  170. package/build/npm/cjs/prod/sdk.js.map +1 -1
  171. package/build/npm/cjs/prod/stack-parsers.js +42 -126
  172. package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
  173. package/build/npm/cjs/prod/tracing/backgroundtab.js +4 -16
  174. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  175. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +102 -291
  176. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  177. package/build/npm/cjs/prod/tracing/linkedTraces.js +25 -117
  178. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  179. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +1 -9
  180. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
  181. package/build/npm/cjs/prod/tracing/request.js +58 -223
  182. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  183. package/build/npm/cjs/prod/tracing/setActiveSpan.js +1 -48
  184. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
  185. package/build/npm/cjs/prod/tracing/utils.js +4 -27
  186. package/build/npm/cjs/prod/tracing/utils.js.map +1 -1
  187. package/build/npm/cjs/prod/transports/fetch.js +10 -23
  188. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  189. package/build/npm/cjs/prod/transports/offline.js +27 -84
  190. package/build/npm/cjs/prod/transports/offline.js.map +1 -1
  191. package/build/npm/cjs/prod/userfeedback.js +12 -22
  192. package/build/npm/cjs/prod/userfeedback.js.map +1 -1
  193. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +5 -26
  194. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
  195. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +40 -75
  196. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  197. package/build/npm/esm/dev/client.js +15 -54
  198. package/build/npm/esm/dev/client.js.map +1 -1
  199. package/build/npm/esm/dev/debug-build.js +0 -5
  200. package/build/npm/esm/dev/debug-build.js.map +1 -1
  201. package/build/npm/esm/dev/diagnose-sdk.js +15 -37
  202. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
  203. package/build/npm/esm/dev/eventbuilder.js +59 -217
  204. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  205. package/build/npm/esm/dev/feedbackAsync.js +1 -5
  206. package/build/npm/esm/dev/feedbackAsync.js.map +1 -1
  207. package/build/npm/esm/dev/feedbackSync.js +1 -2
  208. package/build/npm/esm/dev/feedbackSync.js.map +1 -1
  209. package/build/npm/esm/dev/helpers.js +24 -102
  210. package/build/npm/esm/dev/helpers.js.map +1 -1
  211. package/build/npm/esm/dev/index.js +1 -0
  212. package/build/npm/esm/dev/index.js.map +1 -1
  213. package/build/npm/esm/dev/integrations/breadcrumbs.js +52 -134
  214. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
  215. package/build/npm/esm/dev/integrations/browserapierrors.js +45 -111
  216. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
  217. package/build/npm/esm/dev/integrations/browsersession.js +7 -35
  218. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  219. package/build/npm/esm/dev/integrations/contextlines.js +9 -45
  220. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
  221. package/build/npm/esm/dev/integrations/culturecontext.js +11 -36
  222. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  223. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -22
  224. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  225. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
  226. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  227. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +6 -12
  228. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  229. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +5 -30
  230. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  231. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +10 -47
  232. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  233. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +58 -0
  234. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -0
  235. package/build/npm/esm/dev/integrations/globalhandlers.js +38 -99
  236. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
  237. package/build/npm/esm/dev/integrations/graphqlClient.js +31 -119
  238. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  239. package/build/npm/esm/dev/integrations/httpclient.js +43 -203
  240. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  241. package/build/npm/esm/dev/integrations/httpcontext.js +7 -17
  242. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  243. package/build/npm/esm/dev/integrations/linkederrors.js +7 -15
  244. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
  245. package/build/npm/esm/dev/integrations/reportingobserver.js +19 -44
  246. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
  247. package/build/npm/esm/dev/integrations/spanstreaming.js +11 -29
  248. package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
  249. package/build/npm/esm/dev/integrations/spotlight.js +17 -30
  250. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  251. package/build/npm/esm/dev/integrations/view-hierarchy.js +19 -46
  252. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  253. package/build/npm/esm/dev/integrations/webWorker.js +40 -211
  254. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
  255. package/build/npm/esm/dev/package.json +1 -1
  256. package/build/npm/esm/dev/profiling/UIProfiler.js +87 -190
  257. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  258. package/build/npm/esm/dev/profiling/index.js +9 -30
  259. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  260. package/build/npm/esm/dev/profiling/integration.js +30 -64
  261. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  262. package/build/npm/esm/dev/profiling/startProfileForSpan.js +28 -84
  263. package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -1
  264. package/build/npm/esm/dev/profiling/utils.js +131 -398
  265. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  266. package/build/npm/esm/dev/report-dialog.js +10 -25
  267. package/build/npm/esm/dev/report-dialog.js.map +1 -1
  268. package/build/npm/esm/dev/sdk.js +8 -76
  269. package/build/npm/esm/dev/sdk.js.map +1 -1
  270. package/build/npm/esm/dev/stack-parsers.js +42 -126
  271. package/build/npm/esm/dev/stack-parsers.js.map +1 -1
  272. package/build/npm/esm/dev/tracing/backgroundtab.js +4 -16
  273. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  274. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +102 -291
  275. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  276. package/build/npm/esm/dev/tracing/linkedTraces.js +25 -116
  277. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  278. package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -9
  279. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
  280. package/build/npm/esm/dev/tracing/request.js +59 -224
  281. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  282. package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -48
  283. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
  284. package/build/npm/esm/dev/tracing/utils.js +4 -27
  285. package/build/npm/esm/dev/tracing/utils.js.map +1 -1
  286. package/build/npm/esm/dev/transports/fetch.js +10 -23
  287. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  288. package/build/npm/esm/dev/transports/offline.js +27 -84
  289. package/build/npm/esm/dev/transports/offline.js.map +1 -1
  290. package/build/npm/esm/dev/userfeedback.js +12 -22
  291. package/build/npm/esm/dev/userfeedback.js.map +1 -1
  292. package/build/npm/esm/dev/utils/detectBrowserExtension.js +5 -26
  293. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
  294. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +40 -75
  295. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  296. package/build/npm/esm/prod/client.js +15 -54
  297. package/build/npm/esm/prod/client.js.map +1 -1
  298. package/build/npm/esm/prod/debug-build.js +0 -5
  299. package/build/npm/esm/prod/debug-build.js.map +1 -1
  300. package/build/npm/esm/prod/diagnose-sdk.js +15 -37
  301. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
  302. package/build/npm/esm/prod/eventbuilder.js +59 -217
  303. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  304. package/build/npm/esm/prod/feedbackAsync.js +1 -5
  305. package/build/npm/esm/prod/feedbackAsync.js.map +1 -1
  306. package/build/npm/esm/prod/feedbackSync.js +1 -2
  307. package/build/npm/esm/prod/feedbackSync.js.map +1 -1
  308. package/build/npm/esm/prod/helpers.js +24 -102
  309. package/build/npm/esm/prod/helpers.js.map +1 -1
  310. package/build/npm/esm/prod/index.js +1 -0
  311. package/build/npm/esm/prod/index.js.map +1 -1
  312. package/build/npm/esm/prod/integrations/breadcrumbs.js +52 -134
  313. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
  314. package/build/npm/esm/prod/integrations/browserapierrors.js +45 -111
  315. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
  316. package/build/npm/esm/prod/integrations/browsersession.js +7 -35
  317. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  318. package/build/npm/esm/prod/integrations/contextlines.js +9 -45
  319. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
  320. package/build/npm/esm/prod/integrations/culturecontext.js +11 -36
  321. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  322. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -22
  323. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  324. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
  325. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  326. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +6 -12
  327. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  328. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +5 -30
  329. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  330. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +10 -47
  331. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  332. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +58 -0
  333. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -0
  334. package/build/npm/esm/prod/integrations/globalhandlers.js +38 -99
  335. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
  336. package/build/npm/esm/prod/integrations/graphqlClient.js +31 -119
  337. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  338. package/build/npm/esm/prod/integrations/httpclient.js +43 -203
  339. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  340. package/build/npm/esm/prod/integrations/httpcontext.js +7 -17
  341. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  342. package/build/npm/esm/prod/integrations/linkederrors.js +7 -15
  343. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
  344. package/build/npm/esm/prod/integrations/reportingobserver.js +19 -44
  345. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
  346. package/build/npm/esm/prod/integrations/spanstreaming.js +11 -29
  347. package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
  348. package/build/npm/esm/prod/integrations/spotlight.js +17 -30
  349. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  350. package/build/npm/esm/prod/integrations/view-hierarchy.js +19 -46
  351. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  352. package/build/npm/esm/prod/integrations/webWorker.js +40 -211
  353. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
  354. package/build/npm/esm/prod/package.json +1 -1
  355. package/build/npm/esm/prod/profiling/UIProfiler.js +87 -190
  356. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  357. package/build/npm/esm/prod/profiling/index.js +9 -30
  358. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  359. package/build/npm/esm/prod/profiling/integration.js +30 -64
  360. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  361. package/build/npm/esm/prod/profiling/startProfileForSpan.js +28 -84
  362. package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -1
  363. package/build/npm/esm/prod/profiling/utils.js +131 -398
  364. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  365. package/build/npm/esm/prod/report-dialog.js +10 -25
  366. package/build/npm/esm/prod/report-dialog.js.map +1 -1
  367. package/build/npm/esm/prod/sdk.js +5 -73
  368. package/build/npm/esm/prod/sdk.js.map +1 -1
  369. package/build/npm/esm/prod/stack-parsers.js +42 -126
  370. package/build/npm/esm/prod/stack-parsers.js.map +1 -1
  371. package/build/npm/esm/prod/tracing/backgroundtab.js +4 -16
  372. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  373. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +102 -291
  374. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  375. package/build/npm/esm/prod/tracing/linkedTraces.js +25 -117
  376. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  377. package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -9
  378. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
  379. package/build/npm/esm/prod/tracing/request.js +59 -224
  380. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  381. package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -48
  382. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
  383. package/build/npm/esm/prod/tracing/utils.js +4 -27
  384. package/build/npm/esm/prod/tracing/utils.js.map +1 -1
  385. package/build/npm/esm/prod/transports/fetch.js +10 -23
  386. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  387. package/build/npm/esm/prod/transports/offline.js +27 -84
  388. package/build/npm/esm/prod/transports/offline.js.map +1 -1
  389. package/build/npm/esm/prod/userfeedback.js +12 -22
  390. package/build/npm/esm/prod/userfeedback.js.map +1 -1
  391. package/build/npm/esm/prod/utils/detectBrowserExtension.js +5 -26
  392. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
  393. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +40 -75
  394. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  395. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  396. package/build/npm/types/helpers.d.ts.map +1 -1
  397. package/build/npm/types/index.bundle.d.ts +2 -2
  398. package/build/npm/types/index.bundle.d.ts.map +1 -1
  399. package/build/npm/types/index.bundle.feedback.d.ts +2 -2
  400. package/build/npm/types/index.bundle.feedback.d.ts.map +1 -1
  401. package/build/npm/types/index.bundle.logs.metrics.d.ts +2 -2
  402. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  403. package/build/npm/types/index.bundle.replay.d.ts +2 -2
  404. package/build/npm/types/index.bundle.replay.d.ts.map +1 -1
  405. package/build/npm/types/index.bundle.replay.feedback.d.ts +2 -2
  406. package/build/npm/types/index.bundle.replay.feedback.d.ts.map +1 -1
  407. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +2 -2
  408. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  409. package/build/npm/types/index.bundle.tracing.d.ts +1 -0
  410. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  411. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +1 -0
  412. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  413. package/build/npm/types/index.bundle.tracing.replay.d.ts +1 -0
  414. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  415. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +1 -0
  416. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  417. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
  418. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  419. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
  420. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  421. package/build/npm/types/index.d.ts +1 -0
  422. package/build/npm/types/index.d.ts.map +1 -1
  423. package/build/npm/types/integrations/fetchStreamPerformance.d.ts +14 -0
  424. package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -0
  425. package/build/npm/types/tracing/browserTracingIntegration.d.ts +3 -0
  426. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  427. package/build/npm/types/tracing/request.d.ts +3 -0
  428. package/build/npm/types/tracing/request.d.ts.map +1 -1
  429. package/build/npm/types-ts3.8/index.bundle.d.ts +2 -2
  430. package/build/npm/types-ts3.8/index.bundle.feedback.d.ts +2 -2
  431. package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +2 -2
  432. package/build/npm/types-ts3.8/index.bundle.replay.d.ts +2 -2
  433. package/build/npm/types-ts3.8/index.bundle.replay.feedback.d.ts +2 -2
  434. package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +2 -2
  435. package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -0
  436. package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +1 -0
  437. package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -0
  438. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -0
  439. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
  440. package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
  441. package/build/npm/types-ts3.8/index.d.ts +1 -0
  442. package/build/npm/types-ts3.8/integrations/fetchStreamPerformance.d.ts +14 -0
  443. package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +3 -0
  444. package/build/npm/types-ts3.8/tracing/request.d.ts +3 -0
  445. package/package.json +7 -7
@@ -5,262 +5,167 @@ const debugBuild = require('../debug-build.js');
5
5
  const helpers = require('../helpers.js');
6
6
 
7
7
  const MS_TO_NS = 1e6;
8
-
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 browser.GLOBAL_OBJ && browser.GLOBAL_OBJ.window === browser.GLOBAL_OBJ && typeof importScripts === 'undefined';
11
-
12
- // Setting ID to 0 as we cannot get an ID from Web Workers
8
+ const isMainThread = "window" in browser.GLOBAL_OBJ && browser.GLOBAL_OBJ.window === browser.GLOBAL_OBJ && typeof importScripts === "undefined";
13
9
  const PROFILER_THREAD_ID_STRING = String(0);
14
- const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';
15
-
16
- // We force make this optional to be on the safe side...
17
- const navigator = helpers.WINDOW.navigator ;
18
-
19
- // Machine properties (eval only once)
20
- let OS_PLATFORM = '';
21
- let OS_PLATFORM_VERSION = '';
22
- let OS_ARCH = '';
23
- let OS_BROWSER = navigator?.userAgent || '';
24
- let OS_MODEL = '';
25
- const OS_LOCALE = navigator?.language || navigator?.languages?.[0] || '';
26
-
10
+ const PROFILER_THREAD_NAME = isMainThread ? "main" : "worker";
11
+ const navigator = helpers.WINDOW.navigator;
12
+ let OS_PLATFORM = "";
13
+ let OS_PLATFORM_VERSION = "";
14
+ let OS_ARCH = "";
15
+ let OS_BROWSER = navigator?.userAgent || "";
16
+ let OS_MODEL = "";
17
+ const OS_LOCALE = navigator?.language || navigator?.languages?.[0] || "";
27
18
  function isUserAgentData(data) {
28
- return typeof data === 'object' && data !== null && 'getHighEntropyValues' in data;
19
+ return typeof data === "object" && data !== null && "getHighEntropyValues" in data;
29
20
  }
30
-
31
- // @ts-expect-error userAgentData is not part of the navigator interface yet
32
21
  const userAgentData = navigator?.userAgentData;
33
-
34
22
  if (isUserAgentData(userAgentData)) {
35
- userAgentData
36
- .getHighEntropyValues(['architecture', 'model', 'platform', 'platformVersion', 'fullVersionList'])
37
- .then((ua) => {
38
- OS_PLATFORM = ua.platform || '';
39
- OS_ARCH = ua.architecture || '';
40
- OS_MODEL = ua.model || '';
41
- OS_PLATFORM_VERSION = ua.platformVersion || '';
42
-
43
- if (ua.fullVersionList?.length) {
44
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
45
- const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1];
46
- OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;
47
- }
48
- })
49
- .catch(e => void 0);
23
+ userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => {
24
+ OS_PLATFORM = ua.platform || "";
25
+ OS_ARCH = ua.architecture || "";
26
+ OS_MODEL = ua.model || "";
27
+ OS_PLATFORM_VERSION = ua.platformVersion || "";
28
+ if (ua.fullVersionList?.length) {
29
+ const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1];
30
+ OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;
31
+ }
32
+ }).catch((e) => void 0);
50
33
  }
51
-
52
34
  function isProcessedJSSelfProfile(profile) {
53
- return !('thread_metadata' in profile);
35
+ return !("thread_metadata" in profile);
54
36
  }
55
-
56
- // Enriches the profile with threadId of the current thread.
57
- // This is done in node as we seem to not be able to get the info from C native code.
58
- /**
59
- *
60
- */
61
37
  function enrichWithThreadInformation(profile) {
62
38
  if (!isProcessedJSSelfProfile(profile)) {
63
39
  return profile;
64
40
  }
65
-
66
41
  return convertJSSelfProfileToSampledFormat(profile);
67
42
  }
68
-
69
- // Profile is marked as optional because it is deleted from the metadata
70
- // by the integration before the event is processed by other integrations.
71
-
72
43
  function getTraceId(event) {
73
44
  const traceId = event.contexts?.trace?.trace_id;
74
- // Log a warning if the profile has an invalid traceId (should be uuidv4).
75
- // All profiles and transactions are rejected if this is the case and we want to
76
- // warn users that this is happening if they enable debug flag
77
- if (typeof traceId === 'string' && traceId.length !== 32) {
45
+ if (typeof traceId === "string" && traceId.length !== 32) {
78
46
  if (debugBuild.DEBUG_BUILD) {
79
47
  browser.debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
80
48
  }
81
49
  }
82
- if (typeof traceId !== 'string') {
83
- return '';
50
+ if (typeof traceId !== "string") {
51
+ return "";
84
52
  }
85
-
86
53
  return traceId;
87
54
  }
88
- /**
89
- * Creates a profiling event envelope from a Sentry event. If profile does not pass
90
- * validation, returns null.
91
- * @param event
92
- * @param dsn
93
- * @param metadata
94
- * @param tunnel
95
- * @returns {EventEnvelope | null}
96
- */
97
-
98
- /**
99
- * Creates a profiling event envelope from a Sentry event.
100
- */
101
- function createProfilePayload(
102
- profile_id,
103
- start_timestamp,
104
- processed_profile,
105
- event,
106
- ) {
107
- if (event.type !== 'transaction') {
108
- // createProfilingEventEnvelope should only be called for transactions,
109
- // we type guard this behavior with isProfiledTransactionEvent.
110
- throw new TypeError('Profiling events may only be attached to transactions, this should never occur.');
55
+ function createProfilePayload(profile_id, start_timestamp, processed_profile, event) {
56
+ if (event.type !== "transaction") {
57
+ throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");
111
58
  }
112
-
113
- if (processed_profile === undefined || processed_profile === null) {
59
+ if (processed_profile === void 0 || processed_profile === null) {
114
60
  throw new TypeError(
115
- `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`,
61
+ `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`
116
62
  );
117
63
  }
118
-
119
64
  const traceId = getTraceId(event);
120
65
  const enrichedThreadProfile = enrichWithThreadInformation(processed_profile);
121
- const transactionStartMs = start_timestamp
122
- ? start_timestamp
123
- : typeof event.start_timestamp === 'number'
124
- ? event.start_timestamp * 1000
125
- : browser.timestampInSeconds() * 1000;
126
- const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : browser.timestampInSeconds() * 1000;
127
-
66
+ const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : browser.timestampInSeconds() * 1e3;
67
+ const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : browser.timestampInSeconds() * 1e3;
128
68
  const profile = {
129
69
  event_id: profile_id,
130
70
  timestamp: new Date(transactionStartMs).toISOString(),
131
- platform: 'javascript',
132
- version: '1',
133
- release: event.release || '',
71
+ platform: "javascript",
72
+ version: "1",
73
+ release: event.release || "",
134
74
  environment: event.environment || browser.DEFAULT_ENVIRONMENT,
135
75
  runtime: {
136
- name: 'javascript',
137
- version: helpers.WINDOW.navigator.userAgent,
76
+ name: "javascript",
77
+ version: helpers.WINDOW.navigator.userAgent
138
78
  },
139
79
  os: {
140
80
  name: OS_PLATFORM,
141
81
  version: OS_PLATFORM_VERSION,
142
- build_number: OS_BROWSER,
82
+ build_number: OS_BROWSER
143
83
  },
144
84
  device: {
145
85
  locale: OS_LOCALE,
146
86
  model: OS_MODEL,
147
87
  manufacturer: OS_BROWSER,
148
88
  architecture: OS_ARCH,
149
- is_emulator: false,
89
+ is_emulator: false
150
90
  },
151
91
  debug_meta: {
152
- images: applyDebugMetadata(processed_profile.resources),
92
+ images: applyDebugMetadata(processed_profile.resources)
153
93
  },
154
94
  profile: enrichedThreadProfile,
155
95
  transactions: [
156
96
  {
157
- name: event.transaction || '',
97
+ name: event.transaction || "",
158
98
  id: event.event_id || browser.uuid4(),
159
99
  trace_id: traceId,
160
100
  active_thread_id: PROFILER_THREAD_ID_STRING,
161
- relative_start_ns: '0',
162
- relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0),
163
- },
164
- ],
101
+ relative_start_ns: "0",
102
+ relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0)
103
+ }
104
+ ]
165
105
  };
166
-
167
106
  return profile;
168
107
  }
169
-
170
- /**
171
- * Create a profile chunk envelope item
172
- */
173
- function createProfileChunkPayload(
174
- jsSelfProfile,
175
- client,
176
- profilerId,
177
- ) {
178
- // only == to catch null and undefined
108
+ function createProfileChunkPayload(jsSelfProfile, client, profilerId) {
179
109
  if (jsSelfProfile == null) {
180
110
  throw new TypeError(
181
- `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,
111
+ `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`
182
112
  );
183
113
  }
184
-
185
114
  const continuousProfile = convertToContinuousProfile(jsSelfProfile);
186
-
187
115
  const options = client.getOptions();
188
116
  const sdk = client.getSdkMetadata?.()?.sdk;
189
-
190
117
  return {
191
118
  chunk_id: browser.uuid4(),
192
119
  client_sdk: {
193
- name: sdk?.name ?? 'sentry.javascript.browser',
194
- version: sdk?.version ?? '0.0.0',
120
+ name: sdk?.name ?? "sentry.javascript.browser",
121
+ version: sdk?.version ?? "0.0.0"
195
122
  },
196
123
  profiler_id: profilerId || browser.uuid4(),
197
- platform: 'javascript',
198
- version: '2',
199
- release: options.release ?? '',
200
- environment: options.environment ?? 'production',
124
+ platform: "javascript",
125
+ version: "2",
126
+ release: options.release ?? "",
127
+ environment: options.environment ?? "production",
201
128
  debug_meta: {
202
129
  // function name obfuscation
203
- images: applyDebugMetadata(jsSelfProfile.resources),
130
+ images: applyDebugMetadata(jsSelfProfile.resources)
204
131
  },
205
- profile: continuousProfile,
132
+ profile: continuousProfile
206
133
  };
207
134
  }
208
-
209
- /**
210
- * Validate a profile chunk against the Sample Format V2 requirements.
211
- * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/
212
- * - Presence of samples, stacks, frames
213
- * - Required metadata fields
214
- */
215
135
  function validateProfileChunk(chunk) {
216
136
  try {
217
- // Required metadata
218
- if (!chunk || typeof chunk !== 'object') {
219
- return { reason: 'chunk is not an object' };
137
+ if (!chunk || typeof chunk !== "object") {
138
+ return { reason: "chunk is not an object" };
220
139
  }
221
-
222
- // profiler_id and chunk_id must be 32 lowercase hex chars
223
- const isHex32 = (val) => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);
140
+ const isHex32 = (val) => typeof val === "string" && /^[a-f0-9]{32}$/.test(val);
224
141
  if (!isHex32(chunk.profiler_id)) {
225
- return { reason: 'missing or invalid profiler_id' };
142
+ return { reason: "missing or invalid profiler_id" };
226
143
  }
227
144
  if (!isHex32(chunk.chunk_id)) {
228
- return { reason: 'missing or invalid chunk_id' };
145
+ return { reason: "missing or invalid chunk_id" };
229
146
  }
230
-
231
147
  if (!chunk.client_sdk) {
232
- return { reason: 'missing client_sdk metadata' };
148
+ return { reason: "missing client_sdk metadata" };
233
149
  }
234
-
235
- // Profile data must have frames, stacks, samples
236
- const profile = chunk.profile ;
150
+ const profile = chunk.profile;
237
151
  if (!profile) {
238
- return { reason: 'missing profile data' };
152
+ return { reason: "missing profile data" };
239
153
  }
240
-
241
154
  if (!Array.isArray(profile.frames) || !profile.frames.length) {
242
- return { reason: 'profile has no frames' };
155
+ return { reason: "profile has no frames" };
243
156
  }
244
157
  if (!Array.isArray(profile.stacks) || !profile.stacks.length) {
245
- return { reason: 'profile has no stacks' };
158
+ return { reason: "profile has no stacks" };
246
159
  }
247
160
  if (!Array.isArray(profile.samples) || !profile.samples.length) {
248
- return { reason: 'profile has no samples' };
161
+ return { reason: "profile has no samples" };
249
162
  }
250
-
251
163
  return { valid: true };
252
164
  } catch (e) {
253
165
  return { reason: `unknown validation error: ${e}` };
254
166
  }
255
167
  }
256
-
257
- /**
258
- * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.
259
- */
260
- function convertToContinuousProfile(input
261
-
262
- ) {
263
- // Frames map 1:1 by index; fill only when present to avoid sparse writes
168
+ function convertToContinuousProfile(input) {
264
169
  const frames = [];
265
170
  for (let i = 0; i < input.frames.length; i++) {
266
171
  const frame = input.frames[i];
@@ -269,13 +174,11 @@ function convertToContinuousProfile(input
269
174
  }
270
175
  frames[i] = {
271
176
  function: frame.name,
272
- abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,
177
+ abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0,
273
178
  lineno: frame.line,
274
- colno: frame.column,
179
+ colno: frame.column
275
180
  };
276
181
  }
277
-
278
- // Build stacks by following parent links, top->down order (root last)
279
182
  const stacks = [];
280
183
  for (let i = 0; i < input.stacks.length; i++) {
281
184
  const stackHead = input.stacks[i];
@@ -286,431 +189,267 @@ function convertToContinuousProfile(input
286
189
  let current = stackHead;
287
190
  while (current) {
288
191
  list.push(current.frameId);
289
- current = current.parentId === undefined ? undefined : input.stacks[current.parentId];
192
+ current = current.parentId === void 0 ? void 0 : input.stacks[current.parentId];
290
193
  }
291
194
  stacks[i] = list;
292
195
  }
293
-
294
- // Align timestamps to SDK time origin to match span/event timelines
295
196
  const perfOrigin = browser.browserPerformanceTimeOrigin();
296
- const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;
197
+ const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
297
198
  const adjustForOriginChange = origin - (perfOrigin || origin);
298
-
299
199
  const samples = [];
300
200
  for (let i = 0; i < input.samples.length; i++) {
301
201
  const sample = input.samples[i];
302
202
  if (!sample) {
303
203
  continue;
304
204
  }
305
- // Convert ms to seconds epoch-based timestamp
306
- const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;
205
+ const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1e3;
307
206
  samples[i] = {
308
207
  stack_id: sample.stackId ?? 0,
309
208
  thread_id: PROFILER_THREAD_ID_STRING,
310
- timestamp: timestampSeconds,
209
+ timestamp: timestampSeconds
311
210
  };
312
211
  }
313
-
314
212
  return {
315
213
  frames,
316
214
  stacks,
317
215
  samples,
318
- thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },
216
+ thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } }
319
217
  };
320
218
  }
321
-
322
- /*
323
- See packages/browser-utils/src/browser/router.ts
324
- */
325
- /**
326
- *
327
- */
328
219
  function isAutomatedPageLoadSpan(span) {
329
- return browser.spanToJSON(span).op === 'pageload';
220
+ return browser.spanToJSON(span).op === "pageload";
330
221
  }
331
-
332
- /**
333
- * Converts a JSSelfProfile to a our sampled format.
334
- * Does not currently perform stack indexing.
335
- */
336
222
  function convertJSSelfProfileToSampledFormat(input) {
337
- let EMPTY_STACK_ID = undefined;
223
+ let EMPTY_STACK_ID = void 0;
338
224
  let STACK_ID = 0;
339
-
340
- // Initialize the profile that we will fill with data
341
225
  const profile = {
342
226
  samples: [],
343
227
  stacks: [],
344
228
  frames: [],
345
229
  thread_metadata: {
346
- [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME },
347
- },
230
+ [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME }
231
+ }
348
232
  };
349
-
350
233
  const firstSample = input.samples[0];
351
234
  if (!firstSample) {
352
235
  return profile;
353
236
  }
354
-
355
- // We assert samples.length > 0 above and timestamp should always be present
356
237
  const start = firstSample.timestamp;
357
- // The JS SDK might change it's time origin based on some heuristic (see See packages/utils/src/time.ts)
358
- // when that happens, we need to ensure we are correcting the profile timings so the two timelines stay in sync.
359
- // Since JS self profiling time origin is always initialized to performance.timeOrigin, we need to adjust for
360
- // the drift between the SDK selected value and our profile time origin.
361
238
  const perfOrigin = browser.browserPerformanceTimeOrigin();
362
- const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;
239
+ const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
363
240
  const adjustForOriginChange = origin - (perfOrigin || origin);
364
-
365
241
  input.samples.forEach((jsSample, i) => {
366
- // If sample has no stack, add an empty sample
367
- if (jsSample.stackId === undefined) {
368
- if (EMPTY_STACK_ID === undefined) {
242
+ if (jsSample.stackId === void 0) {
243
+ if (EMPTY_STACK_ID === void 0) {
369
244
  EMPTY_STACK_ID = STACK_ID;
370
245
  profile.stacks[EMPTY_STACK_ID] = [];
371
246
  STACK_ID++;
372
247
  }
373
-
374
- profile['samples'][i] = {
248
+ profile["samples"][i] = {
375
249
  // convert ms timestamp to ns
376
250
  elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
377
251
  stack_id: EMPTY_STACK_ID,
378
- thread_id: PROFILER_THREAD_ID_STRING,
252
+ thread_id: PROFILER_THREAD_ID_STRING
379
253
  };
380
254
  return;
381
255
  }
382
-
383
256
  let stackTop = input.stacks[jsSample.stackId];
384
-
385
- // Functions in top->down order (root is last)
386
- // We follow the stackTop.parentId trail and collect each visited frameId
387
257
  const stack = [];
388
-
389
258
  while (stackTop) {
390
259
  stack.push(stackTop.frameId);
391
-
392
260
  const frame = input.frames[stackTop.frameId];
393
-
394
- // If our frame has not been indexed yet, index it
395
- if (frame && profile.frames[stackTop.frameId] === undefined) {
261
+ if (frame && profile.frames[stackTop.frameId] === void 0) {
396
262
  profile.frames[stackTop.frameId] = {
397
263
  function: frame.name,
398
- abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,
264
+ abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0,
399
265
  lineno: frame.line,
400
- colno: frame.column,
266
+ colno: frame.column
401
267
  };
402
268
  }
403
-
404
- stackTop = stackTop.parentId === undefined ? undefined : input.stacks[stackTop.parentId];
269
+ stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId];
405
270
  }
406
-
407
271
  const sample = {
408
272
  // convert ms timestamp to ns
409
273
  elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
410
274
  stack_id: STACK_ID,
411
- thread_id: PROFILER_THREAD_ID_STRING,
275
+ thread_id: PROFILER_THREAD_ID_STRING
412
276
  };
413
-
414
- profile['stacks'][STACK_ID] = stack;
415
- profile['samples'][i] = sample;
277
+ profile["stacks"][STACK_ID] = stack;
278
+ profile["samples"][i] = sample;
416
279
  STACK_ID++;
417
280
  });
418
-
419
281
  return profile;
420
282
  }
421
-
422
- /**
423
- * Adds items to envelope if they are not already present - mutates the envelope.
424
- * @param envelope
425
- */
426
283
  function addProfilesToEnvelope(envelope, profiles) {
427
284
  if (!profiles.length) {
428
285
  return envelope;
429
286
  }
430
-
431
287
  for (const profile of profiles) {
432
- envelope[1].push([{ type: 'profile' }, profile]);
288
+ envelope[1].push([{ type: "profile" }, profile]);
433
289
  }
434
290
  return envelope;
435
291
  }
436
-
437
- /**
438
- * Finds transactions with profile_id context in the envelope
439
- * @param envelope
440
- * @returns
441
- */
442
292
  function findProfiledTransactionsFromEnvelope(envelope) {
443
293
  const events = [];
444
-
445
294
  browser.forEachEnvelopeItem(envelope, (item, type) => {
446
- if (type !== 'transaction') {
295
+ if (type !== "transaction") {
447
296
  return;
448
297
  }
449
-
450
298
  for (let j = 1; j < item.length; j++) {
451
- const event = item[j] ;
452
-
299
+ const event = item[j];
453
300
  if (event?.contexts?.profile?.profile_id) {
454
- events.push(item[j] );
301
+ events.push(item[j]);
455
302
  }
456
303
  }
457
304
  });
458
-
459
305
  return events;
460
306
  }
461
-
462
- /**
463
- * Applies debug meta data to an event from a list of paths to resources (sourcemaps)
464
- */
465
307
  function applyDebugMetadata(resource_paths) {
466
308
  const client = browser.getClient();
467
309
  const options = client?.getOptions();
468
310
  const stackParser = options?.stackParser;
469
-
470
311
  if (!stackParser) {
471
312
  return [];
472
313
  }
473
-
474
314
  return browser.getDebugImagesForResources(stackParser, resource_paths);
475
315
  }
476
-
477
- /**
478
- * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).
479
- */
480
316
  function isValidSampleRate(rate) {
481
- // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck
482
- if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {
483
- debugBuild.DEBUG_BUILD &&
484
- browser.debug.warn(
485
- `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
486
- rate,
487
- )} of type ${JSON.stringify(typeof rate)}.`,
488
- );
317
+ if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) {
318
+ debugBuild.DEBUG_BUILD && browser.debug.warn(
319
+ `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
320
+ rate
321
+ )} of type ${JSON.stringify(typeof rate)}.`
322
+ );
489
323
  return false;
490
324
  }
491
-
492
- // Boolean sample rates are always valid
493
325
  if (rate === true || rate === false) {
494
326
  return true;
495
327
  }
496
-
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
328
  if (rate < 0 || rate > 1) {
499
329
  debugBuild.DEBUG_BUILD && browser.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
500
330
  return false;
501
331
  }
502
332
  return true;
503
333
  }
504
-
505
334
  function isValidProfile(profile) {
506
335
  if (profile.samples.length < 2) {
507
336
  if (debugBuild.DEBUG_BUILD) {
508
- // Log a warning if the profile has less than 2 samples so users can know why
509
- // they are not seeing any profiling data and we cant avoid the back and forth
510
- // of asking them to provide us with a dump of the profile data.
511
- browser.debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
337
+ browser.debug.log("[Profiling] Discarding profile because it contains less than 2 samples");
512
338
  }
513
339
  return false;
514
340
  }
515
-
516
341
  if (!profile.frames.length) {
517
342
  if (debugBuild.DEBUG_BUILD) {
518
- browser.debug.log('[Profiling] Discarding profile because it contains no frames');
343
+ browser.debug.log("[Profiling] Discarding profile because it contains no frames");
519
344
  }
520
345
  return false;
521
346
  }
522
-
523
347
  return true;
524
348
  }
525
-
526
- // Keep a flag value to avoid re-initializing the profiler constructor. If it fails
527
- // once, it will always fail and this allows us to early return.
528
349
  let PROFILING_CONSTRUCTOR_FAILED = false;
529
- const MAX_PROFILE_DURATION_MS = 30000;
530
-
531
- /**
532
- * Check if profiler constructor is available.
533
- * @param maybeProfiler
534
- */
350
+ const MAX_PROFILE_DURATION_MS = 3e4;
535
351
  function isJSProfilerSupported(maybeProfiler) {
536
- return typeof maybeProfiler === 'function';
352
+ return typeof maybeProfiler === "function";
537
353
  }
538
-
539
- /**
540
- * Starts the profiler and returns the profiler instance.
541
- */
542
354
  function startJSSelfProfile() {
543
- // Feature support check first
544
355
  const JSProfilerConstructor = helpers.WINDOW.Profiler;
545
-
546
356
  if (!isJSProfilerSupported(JSProfilerConstructor)) {
547
357
  if (debugBuild.DEBUG_BUILD) {
548
- browser.debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');
358
+ browser.debug.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");
549
359
  }
550
360
  return;
551
361
  }
552
-
553
- // From initial testing, it seems that the minimum value for sampleInterval is 10ms.
554
362
  const samplingIntervalMS = 10;
555
- // Start the profiler
556
363
  const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);
557
-
558
- // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.
559
- // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens
560
- // as we risk breaking the user's application, so just disable profiling and log an error.
561
364
  try {
562
365
  return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
563
366
  } catch (_e) {
564
367
  if (debugBuild.DEBUG_BUILD) {
565
368
  browser.debug.log(
566
- "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.",
369
+ "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."
567
370
  );
568
- browser.debug.log('[Profiling] Disabling profiling for current user session.');
371
+ browser.debug.log("[Profiling] Disabling profiling for current user session.");
569
372
  }
570
373
  PROFILING_CONSTRUCTOR_FAILED = true;
571
374
  }
572
-
573
375
  return;
574
376
  }
575
-
576
- /**
577
- * Determine if a profile should be profiled.
578
- */
579
377
  function shouldProfileSpanLegacy(span) {
580
- // If constructor failed once, it will always fail, so we can early return.
581
378
  if (PROFILING_CONSTRUCTOR_FAILED) {
582
379
  if (debugBuild.DEBUG_BUILD) {
583
- browser.debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');
380
+ browser.debug.log("[Profiling] Profiling has been disabled for the duration of the current user session.");
584
381
  }
585
382
  return false;
586
383
  }
587
-
588
384
  if (!span.isRecording()) {
589
- debugBuild.DEBUG_BUILD && browser.debug.log('[Profiling] Discarding profile because root span was not sampled.');
385
+ debugBuild.DEBUG_BUILD && browser.debug.log("[Profiling] Discarding profile because root span was not sampled.");
590
386
  return false;
591
387
  }
592
-
593
388
  const client = browser.getClient();
594
389
  const options = client?.getOptions();
595
390
  if (!options) {
596
- debugBuild.DEBUG_BUILD && browser.debug.log('[Profiling] Profiling disabled, no options found.');
391
+ debugBuild.DEBUG_BUILD && browser.debug.log("[Profiling] Profiling disabled, no options found.");
597
392
  return false;
598
393
  }
599
-
600
- // eslint-disable-next-line deprecation/deprecation
601
- const profilesSampleRate = (options ).profilesSampleRate
602
-
603
- ;
604
-
605
- // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
606
- // only valid values are booleans or numbers between 0 and 1.)
394
+ const profilesSampleRate = options.profilesSampleRate;
607
395
  if (!isValidSampleRate(profilesSampleRate)) {
608
- debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Discarding profile because of invalid sample rate.');
396
+ debugBuild.DEBUG_BUILD && browser.debug.warn("[Profiling] Discarding profile because of invalid sample rate.");
609
397
  return false;
610
398
  }
611
-
612
- // if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped
613
399
  if (!profilesSampleRate) {
614
- debugBuild.DEBUG_BUILD &&
615
- browser.debug.log(
616
- '[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0',
617
- );
400
+ debugBuild.DEBUG_BUILD && browser.debug.log(
401
+ "[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"
402
+ );
618
403
  return false;
619
404
  }
620
-
621
- // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is
622
- // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.
623
405
  const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate;
624
- // Check if we should sample this profile
625
406
  if (!sampled) {
626
- debugBuild.DEBUG_BUILD &&
627
- browser.debug.log(
628
- `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
629
- profilesSampleRate,
630
- )})`,
631
- );
407
+ debugBuild.DEBUG_BUILD && browser.debug.log(
408
+ `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
409
+ profilesSampleRate
410
+ )})`
411
+ );
632
412
  return false;
633
413
  }
634
-
635
414
  return true;
636
415
  }
637
-
638
- /**
639
- * Determine if a profile should be created for the current session.
640
- */
641
416
  function shouldProfileSession(options) {
642
- // If constructor failed once, it will always fail, so we can early return.
643
417
  if (PROFILING_CONSTRUCTOR_FAILED) {
644
418
  if (debugBuild.DEBUG_BUILD) {
645
419
  browser.debug.log(
646
- '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',
420
+ "[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started."
647
421
  );
648
422
  }
649
423
  return false;
650
424
  }
651
-
652
- if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {
653
- debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');
425
+ if (options.profileLifecycle !== "trace" && options.profileLifecycle !== "manual") {
426
+ debugBuild.DEBUG_BUILD && browser.debug.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option.");
654
427
  return false;
655
428
  }
656
-
657
- // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session
658
429
  const profileSessionSampleRate = options.profileSessionSampleRate;
659
-
660
430
  if (!isValidSampleRate(profileSessionSampleRate)) {
661
- debugBuild.DEBUG_BUILD && browser.debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');
431
+ debugBuild.DEBUG_BUILD && browser.debug.warn("[Profiling] Discarding profile because of invalid profileSessionSampleRate.");
662
432
  return false;
663
433
  }
664
-
665
434
  if (!profileSessionSampleRate) {
666
- debugBuild.DEBUG_BUILD &&
667
- browser.debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');
435
+ debugBuild.DEBUG_BUILD && browser.debug.log("[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0");
668
436
  return false;
669
437
  }
670
-
671
438
  return Math.random() <= profileSessionSampleRate;
672
439
  }
673
-
674
- /**
675
- * Checks if legacy profiling is configured.
676
- */
677
440
  function hasLegacyProfiling(options) {
678
- // eslint-disable-next-line deprecation/deprecation
679
- return typeof options.profilesSampleRate !== 'undefined';
441
+ return typeof options.profilesSampleRate !== "undefined";
680
442
  }
681
-
682
- /**
683
- * Creates a profiling envelope item, if the profile does not pass validation, returns null.
684
- * @param event
685
- * @returns {Profile | null}
686
- */
687
- function createProfilingEvent(
688
- profile_id,
689
- start_timestamp,
690
- profile,
691
- event,
692
- ) {
443
+ function createProfilingEvent(profile_id, start_timestamp, profile, event) {
693
444
  if (!isValidProfile(profile)) {
694
445
  return null;
695
446
  }
696
-
697
447
  return createProfilePayload(profile_id, start_timestamp, profile, event);
698
448
  }
699
-
700
- // TODO (v8): We need to obtain profile ids in @sentry-internal/tracing,
701
- // but we don't have access to this map because importing this map would
702
- // cause a circular dependency. We need to resolve this in v8.
703
- const PROFILE_MAP = new Map();
704
- /**
705
- *
706
- */
449
+ const PROFILE_MAP = /* @__PURE__ */ new Map();
707
450
  function getActiveProfilesCount() {
708
451
  return PROFILE_MAP.size;
709
452
  }
710
-
711
- /**
712
- * Retrieves profile from global cache and removes it.
713
- */
714
453
  function takeProfileFromGlobalCache(profile_id) {
715
454
  const profile = PROFILE_MAP.get(profile_id);
716
455
  if (profile) {
@@ -718,25 +457,19 @@ function takeProfileFromGlobalCache(profile_id) {
718
457
  }
719
458
  return profile;
720
459
  }
721
- /**
722
- * Adds profile to global cache and evicts the oldest profile if the cache is full.
723
- */
724
460
  function addProfileToGlobalCache(profile_id, profile) {
725
461
  PROFILE_MAP.set(profile_id, profile);
726
-
727
462
  if (PROFILE_MAP.size > 30) {
728
463
  const last = PROFILE_MAP.keys().next().value;
729
- if (last !== undefined) {
464
+ if (last !== void 0) {
730
465
  PROFILE_MAP.delete(last);
731
466
  }
732
467
  }
733
468
  }
734
-
735
- const PROFILED_ROOT_SPANS = new WeakSet();
736
-
469
+ const PROFILED_ROOT_SPANS = /* @__PURE__ */ new WeakSet();
737
470
  function setThreadAttributes(span) {
738
- span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);
739
- span.setAttribute('thread.name', PROFILER_THREAD_NAME);
471
+ span.setAttribute("thread.id", PROFILER_THREAD_ID_STRING);
472
+ span.setAttribute("thread.name", PROFILER_THREAD_NAME);
740
473
  }
741
474
 
742
475
  exports.MAX_PROFILE_DURATION_MS = MAX_PROFILE_DURATION_MS;