@sentry/browser 10.22.0 → 10.25.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 (457) hide show
  1. package/build/npm/cjs/{client.js → dev/client.js} +16 -3
  2. package/build/npm/cjs/dev/client.js.map +1 -0
  3. package/build/npm/cjs/dev/debug-build.js.map +1 -0
  4. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -0
  5. package/build/npm/cjs/dev/eventbuilder.js.map +1 -0
  6. package/build/npm/cjs/dev/feedbackAsync.js.map +1 -0
  7. package/build/npm/cjs/dev/feedbackSync.js.map +1 -0
  8. package/build/npm/cjs/dev/helpers.js.map +1 -0
  9. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -0
  10. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -0
  11. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -0
  12. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -0
  13. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -0
  14. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
  15. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -0
  16. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -0
  17. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -0
  18. package/build/npm/cjs/{integrations → dev/integrations}/globalhandlers.js +6 -1
  19. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -0
  20. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -0
  21. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -0
  22. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -0
  23. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -0
  24. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -0
  25. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -0
  26. package/build/npm/cjs/{integrations → dev/integrations}/webWorker.js +119 -17
  27. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -0
  28. package/build/npm/cjs/dev/profiling/integration.js.map +1 -0
  29. package/build/npm/cjs/dev/profiling/lifecycleMode/traceLifecycleProfiler.js.map +1 -0
  30. package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -0
  31. package/build/npm/cjs/dev/profiling/utils.js.map +1 -0
  32. package/build/npm/cjs/dev/report-dialog.js.map +1 -0
  33. package/build/npm/cjs/dev/sdk.js +133 -0
  34. package/build/npm/cjs/dev/sdk.js.map +1 -0
  35. package/build/npm/cjs/dev/stack-parsers.js.map +1 -0
  36. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -0
  37. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -0
  38. package/build/npm/cjs/{tracing → dev/tracing}/linkedTraces.js +1 -0
  39. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -0
  40. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -0
  41. package/build/npm/cjs/dev/tracing/request.js.map +1 -0
  42. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -0
  43. package/build/npm/cjs/dev/tracing/utils.js.map +1 -0
  44. package/build/npm/cjs/{transports → dev/transports}/fetch.js +7 -1
  45. package/build/npm/cjs/dev/transports/fetch.js.map +1 -0
  46. package/build/npm/cjs/dev/transports/offline.js.map +1 -0
  47. package/build/npm/cjs/dev/userfeedback.js.map +1 -0
  48. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -0
  49. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -0
  50. package/build/npm/cjs/prod/client.js +125 -0
  51. package/build/npm/cjs/prod/client.js.map +1 -0
  52. package/build/npm/cjs/prod/debug-build.js +11 -0
  53. package/build/npm/cjs/prod/debug-build.js.map +1 -0
  54. package/build/npm/cjs/prod/diagnose-sdk.js +51 -0
  55. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -0
  56. package/build/npm/cjs/prod/eventbuilder.js +397 -0
  57. package/build/npm/cjs/prod/eventbuilder.js.map +1 -0
  58. package/build/npm/cjs/prod/feedbackAsync.js +15 -0
  59. package/build/npm/cjs/prod/feedbackAsync.js.map +1 -0
  60. package/build/npm/cjs/prod/feedbackSync.js +12 -0
  61. package/build/npm/cjs/prod/feedbackSync.js.map +1 -0
  62. package/build/npm/cjs/prod/helpers.js +185 -0
  63. package/build/npm/cjs/prod/helpers.js.map +1 -0
  64. package/build/npm/cjs/prod/index.js +179 -0
  65. package/build/npm/cjs/prod/index.js.map +1 -0
  66. package/build/npm/cjs/prod/integrations/breadcrumbs.js +341 -0
  67. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -0
  68. package/build/npm/cjs/prod/integrations/browserapierrors.js +259 -0
  69. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -0
  70. package/build/npm/cjs/prod/integrations/browsersession.js +44 -0
  71. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -0
  72. package/build/npm/cjs/prod/integrations/contextlines.js +89 -0
  73. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -0
  74. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +29 -0
  75. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -0
  76. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +55 -0
  77. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
  78. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +38 -0
  79. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -0
  80. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +48 -0
  81. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -0
  82. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +74 -0
  83. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -0
  84. package/build/npm/cjs/prod/integrations/globalhandlers.js +210 -0
  85. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -0
  86. package/build/npm/cjs/prod/integrations/graphqlClient.js +180 -0
  87. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -0
  88. package/build/npm/cjs/prod/integrations/httpclient.js +395 -0
  89. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -0
  90. package/build/npm/cjs/prod/integrations/httpcontext.js +35 -0
  91. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -0
  92. package/build/npm/cjs/prod/integrations/linkederrors.js +39 -0
  93. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -0
  94. package/build/npm/cjs/prod/integrations/reportingobserver.js +85 -0
  95. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -0
  96. package/build/npm/cjs/prod/integrations/spotlight.js +85 -0
  97. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -0
  98. package/build/npm/cjs/prod/integrations/webWorker.js +251 -0
  99. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -0
  100. package/build/npm/cjs/prod/profiling/integration.js +150 -0
  101. package/build/npm/cjs/prod/profiling/integration.js.map +1 -0
  102. package/build/npm/cjs/prod/profiling/lifecycleMode/traceLifecycleProfiler.js +343 -0
  103. package/build/npm/cjs/prod/profiling/lifecycleMode/traceLifecycleProfiler.js.map +1 -0
  104. package/build/npm/cjs/prod/profiling/startProfileForSpan.js +144 -0
  105. package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -0
  106. package/build/npm/cjs/prod/profiling/utils.js +786 -0
  107. package/build/npm/cjs/prod/profiling/utils.js.map +1 -0
  108. package/build/npm/cjs/prod/report-dialog.js +68 -0
  109. package/build/npm/cjs/prod/report-dialog.js.map +1 -0
  110. package/build/npm/cjs/{sdk.js → prod/sdk.js} +5 -2
  111. package/build/npm/cjs/prod/sdk.js.map +1 -0
  112. package/build/npm/cjs/prod/stack-parsers.js +202 -0
  113. package/build/npm/cjs/prod/stack-parsers.js.map +1 -0
  114. package/build/npm/cjs/prod/tracing/backgroundtab.js +46 -0
  115. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -0
  116. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +577 -0
  117. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -0
  118. package/build/npm/cjs/prod/tracing/linkedTraces.js +227 -0
  119. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -0
  120. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +18 -0
  121. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -0
  122. package/build/npm/cjs/prod/tracing/request.js +342 -0
  123. package/build/npm/cjs/prod/tracing/request.js.map +1 -0
  124. package/build/npm/cjs/prod/tracing/setActiveSpan.js +68 -0
  125. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -0
  126. package/build/npm/cjs/prod/tracing/utils.js +54 -0
  127. package/build/npm/cjs/prod/tracing/utils.js.map +1 -0
  128. package/build/npm/cjs/prod/transports/fetch.js +71 -0
  129. package/build/npm/cjs/prod/transports/fetch.js.map +1 -0
  130. package/build/npm/cjs/prod/transports/offline.js +168 -0
  131. package/build/npm/cjs/prod/transports/offline.js.map +1 -0
  132. package/build/npm/cjs/prod/userfeedback.js +42 -0
  133. package/build/npm/cjs/prod/userfeedback.js.map +1 -0
  134. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +59 -0
  135. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -0
  136. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +106 -0
  137. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -0
  138. package/build/npm/esm/{client.js → dev/client.js} +16 -3
  139. package/build/npm/esm/dev/client.js.map +1 -0
  140. package/build/npm/esm/dev/debug-build.js.map +1 -0
  141. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -0
  142. package/build/npm/esm/dev/eventbuilder.js.map +1 -0
  143. package/build/npm/esm/dev/feedbackAsync.js.map +1 -0
  144. package/build/npm/esm/dev/feedbackSync.js.map +1 -0
  145. package/build/npm/esm/dev/helpers.js.map +1 -0
  146. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -0
  147. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -0
  148. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -0
  149. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -0
  150. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -0
  151. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
  152. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -0
  153. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -0
  154. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -0
  155. package/build/npm/esm/{integrations → dev/integrations}/globalhandlers.js +5 -2
  156. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -0
  157. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -0
  158. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -0
  159. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -0
  160. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -0
  161. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -0
  162. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -0
  163. package/build/npm/esm/dev/integrations/webWorker.js +247 -0
  164. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -0
  165. package/build/npm/esm/dev/package.json +1 -0
  166. package/build/npm/esm/dev/profiling/integration.js.map +1 -0
  167. package/build/npm/esm/dev/profiling/lifecycleMode/traceLifecycleProfiler.js.map +1 -0
  168. package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -0
  169. package/build/npm/esm/dev/profiling/utils.js.map +1 -0
  170. package/build/npm/esm/dev/report-dialog.js.map +1 -0
  171. package/build/npm/esm/dev/sdk.js +128 -0
  172. package/build/npm/esm/dev/sdk.js.map +1 -0
  173. package/build/npm/esm/dev/stack-parsers.js.map +1 -0
  174. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -0
  175. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -0
  176. package/build/npm/esm/{tracing → dev/tracing}/linkedTraces.js +1 -0
  177. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -0
  178. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -0
  179. package/build/npm/esm/dev/tracing/request.js.map +1 -0
  180. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -0
  181. package/build/npm/esm/dev/tracing/utils.js.map +1 -0
  182. package/build/npm/esm/{transports → dev/transports}/fetch.js +8 -2
  183. package/build/npm/esm/dev/transports/fetch.js.map +1 -0
  184. package/build/npm/esm/dev/transports/offline.js.map +1 -0
  185. package/build/npm/esm/dev/userfeedback.js.map +1 -0
  186. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -0
  187. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -0
  188. package/build/npm/esm/prod/client.js +122 -0
  189. package/build/npm/esm/prod/client.js.map +1 -0
  190. package/build/npm/esm/prod/debug-build.js +9 -0
  191. package/build/npm/esm/prod/debug-build.js.map +1 -0
  192. package/build/npm/esm/prod/diagnose-sdk.js +49 -0
  193. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -0
  194. package/build/npm/esm/prod/eventbuilder.js +390 -0
  195. package/build/npm/esm/prod/eventbuilder.js.map +1 -0
  196. package/build/npm/esm/prod/feedbackAsync.js +13 -0
  197. package/build/npm/esm/prod/feedbackAsync.js.map +1 -0
  198. package/build/npm/esm/prod/feedbackSync.js +10 -0
  199. package/build/npm/esm/prod/feedbackSync.js.map +1 -0
  200. package/build/npm/esm/prod/helpers.js +179 -0
  201. package/build/npm/esm/prod/helpers.js.map +1 -0
  202. package/build/npm/esm/prod/index.js +40 -0
  203. package/build/npm/esm/prod/index.js.map +1 -0
  204. package/build/npm/esm/prod/integrations/breadcrumbs.js +339 -0
  205. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -0
  206. package/build/npm/esm/prod/integrations/browserapierrors.js +257 -0
  207. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -0
  208. package/build/npm/esm/prod/integrations/browsersession.js +42 -0
  209. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -0
  210. package/build/npm/esm/prod/integrations/contextlines.js +86 -0
  211. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -0
  212. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +27 -0
  213. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -0
  214. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +52 -0
  215. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
  216. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +35 -0
  217. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -0
  218. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +46 -0
  219. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -0
  220. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +72 -0
  221. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -0
  222. package/build/npm/esm/prod/integrations/globalhandlers.js +206 -0
  223. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -0
  224. package/build/npm/esm/prod/integrations/graphqlClient.js +175 -0
  225. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -0
  226. package/build/npm/esm/prod/integrations/httpclient.js +393 -0
  227. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -0
  228. package/build/npm/esm/prod/integrations/httpcontext.js +33 -0
  229. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -0
  230. package/build/npm/esm/prod/integrations/linkederrors.js +37 -0
  231. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -0
  232. package/build/npm/esm/prod/integrations/reportingobserver.js +83 -0
  233. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -0
  234. package/build/npm/esm/prod/integrations/spotlight.js +81 -0
  235. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -0
  236. package/build/npm/esm/prod/integrations/webWorker.js +247 -0
  237. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -0
  238. package/build/npm/esm/prod/package.json +1 -0
  239. package/build/npm/esm/prod/profiling/integration.js +148 -0
  240. package/build/npm/esm/prod/profiling/integration.js.map +1 -0
  241. package/build/npm/esm/prod/profiling/lifecycleMode/traceLifecycleProfiler.js +341 -0
  242. package/build/npm/esm/prod/profiling/lifecycleMode/traceLifecycleProfiler.js.map +1 -0
  243. package/build/npm/esm/prod/profiling/startProfileForSpan.js +142 -0
  244. package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -0
  245. package/build/npm/esm/prod/profiling/utils.js +763 -0
  246. package/build/npm/esm/prod/profiling/utils.js.map +1 -0
  247. package/build/npm/esm/prod/report-dialog.js +66 -0
  248. package/build/npm/esm/prod/report-dialog.js.map +1 -0
  249. package/build/npm/esm/{sdk.js → prod/sdk.js} +5 -2
  250. package/build/npm/esm/prod/sdk.js.map +1 -0
  251. package/build/npm/esm/prod/stack-parsers.js +194 -0
  252. package/build/npm/esm/prod/stack-parsers.js.map +1 -0
  253. package/build/npm/esm/prod/tracing/backgroundtab.js +44 -0
  254. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -0
  255. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +571 -0
  256. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -0
  257. package/build/npm/esm/prod/tracing/linkedTraces.js +218 -0
  258. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -0
  259. package/build/npm/esm/prod/tracing/reportPageLoaded.js +16 -0
  260. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -0
  261. package/build/npm/esm/prod/tracing/request.js +338 -0
  262. package/build/npm/esm/prod/tracing/request.js.map +1 -0
  263. package/build/npm/esm/prod/tracing/setActiveSpan.js +66 -0
  264. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -0
  265. package/build/npm/esm/prod/tracing/utils.js +49 -0
  266. package/build/npm/esm/prod/tracing/utils.js.map +1 -0
  267. package/build/npm/esm/prod/transports/fetch.js +69 -0
  268. package/build/npm/esm/prod/transports/fetch.js.map +1 -0
  269. package/build/npm/esm/prod/transports/offline.js +162 -0
  270. package/build/npm/esm/prod/transports/offline.js.map +1 -0
  271. package/build/npm/esm/prod/userfeedback.js +40 -0
  272. package/build/npm/esm/prod/userfeedback.js.map +1 -0
  273. package/build/npm/esm/prod/utils/detectBrowserExtension.js +57 -0
  274. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -0
  275. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +104 -0
  276. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -0
  277. package/build/npm/types/client.d.ts +11 -0
  278. package/build/npm/types/client.d.ts.map +1 -1
  279. package/build/npm/types/integrations/globalhandlers.d.ts +12 -0
  280. package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
  281. package/build/npm/types/integrations/webWorker.d.ts +12 -0
  282. package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
  283. package/build/npm/types/sdk.d.ts.map +1 -1
  284. package/build/npm/types/transports/fetch.d.ts.map +1 -1
  285. package/build/npm/types/transports/types.d.ts +0 -4
  286. package/build/npm/types/transports/types.d.ts.map +1 -1
  287. package/build/npm/types-ts3.8/client.d.ts +11 -0
  288. package/build/npm/types-ts3.8/integrations/globalhandlers.d.ts +12 -0
  289. package/build/npm/types-ts3.8/integrations/webWorker.d.ts +12 -0
  290. package/build/npm/types-ts3.8/transports/types.d.ts +0 -4
  291. package/package.json +22 -17
  292. package/build/npm/cjs/client.js.map +0 -1
  293. package/build/npm/cjs/debug-build.js.map +0 -1
  294. package/build/npm/cjs/diagnose-sdk.js.map +0 -1
  295. package/build/npm/cjs/eventbuilder.js.map +0 -1
  296. package/build/npm/cjs/feedbackAsync.js.map +0 -1
  297. package/build/npm/cjs/feedbackSync.js.map +0 -1
  298. package/build/npm/cjs/helpers.js.map +0 -1
  299. package/build/npm/cjs/integrations/breadcrumbs.js.map +0 -1
  300. package/build/npm/cjs/integrations/browserapierrors.js.map +0 -1
  301. package/build/npm/cjs/integrations/browsersession.js.map +0 -1
  302. package/build/npm/cjs/integrations/contextlines.js.map +0 -1
  303. package/build/npm/cjs/integrations/featureFlags/growthbook/integration.js.map +0 -1
  304. package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js.map +0 -1
  305. package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js.map +0 -1
  306. package/build/npm/cjs/integrations/featureFlags/statsig/integration.js.map +0 -1
  307. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js.map +0 -1
  308. package/build/npm/cjs/integrations/globalhandlers.js.map +0 -1
  309. package/build/npm/cjs/integrations/graphqlClient.js.map +0 -1
  310. package/build/npm/cjs/integrations/httpclient.js.map +0 -1
  311. package/build/npm/cjs/integrations/httpcontext.js.map +0 -1
  312. package/build/npm/cjs/integrations/linkederrors.js.map +0 -1
  313. package/build/npm/cjs/integrations/reportingobserver.js.map +0 -1
  314. package/build/npm/cjs/integrations/spotlight.js.map +0 -1
  315. package/build/npm/cjs/integrations/webWorker.js.map +0 -1
  316. package/build/npm/cjs/profiling/integration.js.map +0 -1
  317. package/build/npm/cjs/profiling/lifecycleMode/traceLifecycleProfiler.js.map +0 -1
  318. package/build/npm/cjs/profiling/startProfileForSpan.js.map +0 -1
  319. package/build/npm/cjs/profiling/utils.js.map +0 -1
  320. package/build/npm/cjs/report-dialog.js.map +0 -1
  321. package/build/npm/cjs/sdk.js.map +0 -1
  322. package/build/npm/cjs/stack-parsers.js.map +0 -1
  323. package/build/npm/cjs/tracing/backgroundtab.js.map +0 -1
  324. package/build/npm/cjs/tracing/browserTracingIntegration.js.map +0 -1
  325. package/build/npm/cjs/tracing/linkedTraces.js.map +0 -1
  326. package/build/npm/cjs/tracing/reportPageLoaded.js.map +0 -1
  327. package/build/npm/cjs/tracing/request.js.map +0 -1
  328. package/build/npm/cjs/tracing/setActiveSpan.js.map +0 -1
  329. package/build/npm/cjs/tracing/utils.js.map +0 -1
  330. package/build/npm/cjs/transports/fetch.js.map +0 -1
  331. package/build/npm/cjs/transports/offline.js.map +0 -1
  332. package/build/npm/cjs/userfeedback.js.map +0 -1
  333. package/build/npm/cjs/utils/detectBrowserExtension.js.map +0 -1
  334. package/build/npm/cjs/utils/lazyLoadIntegration.js.map +0 -1
  335. package/build/npm/esm/client.js.map +0 -1
  336. package/build/npm/esm/debug-build.js.map +0 -1
  337. package/build/npm/esm/diagnose-sdk.js.map +0 -1
  338. package/build/npm/esm/eventbuilder.js.map +0 -1
  339. package/build/npm/esm/feedbackAsync.js.map +0 -1
  340. package/build/npm/esm/feedbackSync.js.map +0 -1
  341. package/build/npm/esm/helpers.js.map +0 -1
  342. package/build/npm/esm/integrations/breadcrumbs.js.map +0 -1
  343. package/build/npm/esm/integrations/browserapierrors.js.map +0 -1
  344. package/build/npm/esm/integrations/browsersession.js.map +0 -1
  345. package/build/npm/esm/integrations/contextlines.js.map +0 -1
  346. package/build/npm/esm/integrations/featureFlags/growthbook/integration.js.map +0 -1
  347. package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js.map +0 -1
  348. package/build/npm/esm/integrations/featureFlags/openfeature/integration.js.map +0 -1
  349. package/build/npm/esm/integrations/featureFlags/statsig/integration.js.map +0 -1
  350. package/build/npm/esm/integrations/featureFlags/unleash/integration.js.map +0 -1
  351. package/build/npm/esm/integrations/globalhandlers.js.map +0 -1
  352. package/build/npm/esm/integrations/graphqlClient.js.map +0 -1
  353. package/build/npm/esm/integrations/httpclient.js.map +0 -1
  354. package/build/npm/esm/integrations/httpcontext.js.map +0 -1
  355. package/build/npm/esm/integrations/linkederrors.js.map +0 -1
  356. package/build/npm/esm/integrations/reportingobserver.js.map +0 -1
  357. package/build/npm/esm/integrations/spotlight.js.map +0 -1
  358. package/build/npm/esm/integrations/webWorker.js +0 -145
  359. package/build/npm/esm/integrations/webWorker.js.map +0 -1
  360. package/build/npm/esm/package.json +0 -1
  361. package/build/npm/esm/profiling/integration.js.map +0 -1
  362. package/build/npm/esm/profiling/lifecycleMode/traceLifecycleProfiler.js.map +0 -1
  363. package/build/npm/esm/profiling/startProfileForSpan.js.map +0 -1
  364. package/build/npm/esm/profiling/utils.js.map +0 -1
  365. package/build/npm/esm/report-dialog.js.map +0 -1
  366. package/build/npm/esm/sdk.js.map +0 -1
  367. package/build/npm/esm/stack-parsers.js.map +0 -1
  368. package/build/npm/esm/tracing/backgroundtab.js.map +0 -1
  369. package/build/npm/esm/tracing/browserTracingIntegration.js.map +0 -1
  370. package/build/npm/esm/tracing/linkedTraces.js.map +0 -1
  371. package/build/npm/esm/tracing/reportPageLoaded.js.map +0 -1
  372. package/build/npm/esm/tracing/request.js.map +0 -1
  373. package/build/npm/esm/tracing/setActiveSpan.js.map +0 -1
  374. package/build/npm/esm/tracing/utils.js.map +0 -1
  375. package/build/npm/esm/transports/fetch.js.map +0 -1
  376. package/build/npm/esm/transports/offline.js.map +0 -1
  377. package/build/npm/esm/userfeedback.js.map +0 -1
  378. package/build/npm/esm/utils/detectBrowserExtension.js.map +0 -1
  379. package/build/npm/esm/utils/lazyLoadIntegration.js.map +0 -1
  380. /package/build/npm/cjs/{debug-build.js → dev/debug-build.js} +0 -0
  381. /package/build/npm/cjs/{diagnose-sdk.js → dev/diagnose-sdk.js} +0 -0
  382. /package/build/npm/cjs/{eventbuilder.js → dev/eventbuilder.js} +0 -0
  383. /package/build/npm/cjs/{feedbackAsync.js → dev/feedbackAsync.js} +0 -0
  384. /package/build/npm/cjs/{feedbackSync.js → dev/feedbackSync.js} +0 -0
  385. /package/build/npm/cjs/{helpers.js → dev/helpers.js} +0 -0
  386. /package/build/npm/cjs/{index.js → dev/index.js} +0 -0
  387. /package/build/npm/cjs/{index.js.map → dev/index.js.map} +0 -0
  388. /package/build/npm/cjs/{integrations → dev/integrations}/breadcrumbs.js +0 -0
  389. /package/build/npm/cjs/{integrations → dev/integrations}/browserapierrors.js +0 -0
  390. /package/build/npm/cjs/{integrations → dev/integrations}/browsersession.js +0 -0
  391. /package/build/npm/cjs/{integrations → dev/integrations}/contextlines.js +0 -0
  392. /package/build/npm/cjs/{integrations → dev/integrations}/featureFlags/growthbook/integration.js +0 -0
  393. /package/build/npm/cjs/{integrations → dev/integrations}/featureFlags/launchdarkly/integration.js +0 -0
  394. /package/build/npm/cjs/{integrations → dev/integrations}/featureFlags/openfeature/integration.js +0 -0
  395. /package/build/npm/cjs/{integrations → dev/integrations}/featureFlags/statsig/integration.js +0 -0
  396. /package/build/npm/cjs/{integrations → dev/integrations}/featureFlags/unleash/integration.js +0 -0
  397. /package/build/npm/cjs/{integrations → dev/integrations}/graphqlClient.js +0 -0
  398. /package/build/npm/cjs/{integrations → dev/integrations}/httpclient.js +0 -0
  399. /package/build/npm/cjs/{integrations → dev/integrations}/httpcontext.js +0 -0
  400. /package/build/npm/cjs/{integrations → dev/integrations}/linkederrors.js +0 -0
  401. /package/build/npm/cjs/{integrations → dev/integrations}/reportingobserver.js +0 -0
  402. /package/build/npm/cjs/{integrations → dev/integrations}/spotlight.js +0 -0
  403. /package/build/npm/cjs/{profiling → dev/profiling}/integration.js +0 -0
  404. /package/build/npm/cjs/{profiling → dev/profiling}/lifecycleMode/traceLifecycleProfiler.js +0 -0
  405. /package/build/npm/cjs/{profiling → dev/profiling}/startProfileForSpan.js +0 -0
  406. /package/build/npm/cjs/{profiling → dev/profiling}/utils.js +0 -0
  407. /package/build/npm/cjs/{report-dialog.js → dev/report-dialog.js} +0 -0
  408. /package/build/npm/cjs/{stack-parsers.js → dev/stack-parsers.js} +0 -0
  409. /package/build/npm/cjs/{tracing → dev/tracing}/backgroundtab.js +0 -0
  410. /package/build/npm/cjs/{tracing → dev/tracing}/browserTracingIntegration.js +0 -0
  411. /package/build/npm/cjs/{tracing → dev/tracing}/reportPageLoaded.js +0 -0
  412. /package/build/npm/cjs/{tracing → dev/tracing}/request.js +0 -0
  413. /package/build/npm/cjs/{tracing → dev/tracing}/setActiveSpan.js +0 -0
  414. /package/build/npm/cjs/{tracing → dev/tracing}/utils.js +0 -0
  415. /package/build/npm/cjs/{transports → dev/transports}/offline.js +0 -0
  416. /package/build/npm/cjs/{userfeedback.js → dev/userfeedback.js} +0 -0
  417. /package/build/npm/cjs/{utils → dev/utils}/detectBrowserExtension.js +0 -0
  418. /package/build/npm/cjs/{utils → dev/utils}/lazyLoadIntegration.js +0 -0
  419. /package/build/npm/esm/{debug-build.js → dev/debug-build.js} +0 -0
  420. /package/build/npm/esm/{diagnose-sdk.js → dev/diagnose-sdk.js} +0 -0
  421. /package/build/npm/esm/{eventbuilder.js → dev/eventbuilder.js} +0 -0
  422. /package/build/npm/esm/{feedbackAsync.js → dev/feedbackAsync.js} +0 -0
  423. /package/build/npm/esm/{feedbackSync.js → dev/feedbackSync.js} +0 -0
  424. /package/build/npm/esm/{helpers.js → dev/helpers.js} +0 -0
  425. /package/build/npm/esm/{index.js → dev/index.js} +0 -0
  426. /package/build/npm/esm/{index.js.map → dev/index.js.map} +0 -0
  427. /package/build/npm/esm/{integrations → dev/integrations}/breadcrumbs.js +0 -0
  428. /package/build/npm/esm/{integrations → dev/integrations}/browserapierrors.js +0 -0
  429. /package/build/npm/esm/{integrations → dev/integrations}/browsersession.js +0 -0
  430. /package/build/npm/esm/{integrations → dev/integrations}/contextlines.js +0 -0
  431. /package/build/npm/esm/{integrations → dev/integrations}/featureFlags/growthbook/integration.js +0 -0
  432. /package/build/npm/esm/{integrations → dev/integrations}/featureFlags/launchdarkly/integration.js +0 -0
  433. /package/build/npm/esm/{integrations → dev/integrations}/featureFlags/openfeature/integration.js +0 -0
  434. /package/build/npm/esm/{integrations → dev/integrations}/featureFlags/statsig/integration.js +0 -0
  435. /package/build/npm/esm/{integrations → dev/integrations}/featureFlags/unleash/integration.js +0 -0
  436. /package/build/npm/esm/{integrations → dev/integrations}/graphqlClient.js +0 -0
  437. /package/build/npm/esm/{integrations → dev/integrations}/httpclient.js +0 -0
  438. /package/build/npm/esm/{integrations → dev/integrations}/httpcontext.js +0 -0
  439. /package/build/npm/esm/{integrations → dev/integrations}/linkederrors.js +0 -0
  440. /package/build/npm/esm/{integrations → dev/integrations}/reportingobserver.js +0 -0
  441. /package/build/npm/esm/{integrations → dev/integrations}/spotlight.js +0 -0
  442. /package/build/npm/esm/{profiling → dev/profiling}/integration.js +0 -0
  443. /package/build/npm/esm/{profiling → dev/profiling}/lifecycleMode/traceLifecycleProfiler.js +0 -0
  444. /package/build/npm/esm/{profiling → dev/profiling}/startProfileForSpan.js +0 -0
  445. /package/build/npm/esm/{profiling → dev/profiling}/utils.js +0 -0
  446. /package/build/npm/esm/{report-dialog.js → dev/report-dialog.js} +0 -0
  447. /package/build/npm/esm/{stack-parsers.js → dev/stack-parsers.js} +0 -0
  448. /package/build/npm/esm/{tracing → dev/tracing}/backgroundtab.js +0 -0
  449. /package/build/npm/esm/{tracing → dev/tracing}/browserTracingIntegration.js +0 -0
  450. /package/build/npm/esm/{tracing → dev/tracing}/reportPageLoaded.js +0 -0
  451. /package/build/npm/esm/{tracing → dev/tracing}/request.js +0 -0
  452. /package/build/npm/esm/{tracing → dev/tracing}/setActiveSpan.js +0 -0
  453. /package/build/npm/esm/{tracing → dev/tracing}/utils.js +0 -0
  454. /package/build/npm/esm/{transports → dev/transports}/offline.js +0 -0
  455. /package/build/npm/esm/{userfeedback.js → dev/userfeedback.js} +0 -0
  456. /package/build/npm/esm/{utils → dev/utils}/detectBrowserExtension.js +0 -0
  457. /package/build/npm/esm/{utils → dev/utils}/lazyLoadIntegration.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportingobserver.js","sources":["../../../../../src/integrations/reportingobserver.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport {\n captureMessage,\n defineIntegration,\n getClient,\n GLOBAL_OBJ,\n supportsReportingObserver,\n withScope,\n} from '@sentry/core';\n\nconst WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n\nconst INTEGRATION_NAME = 'ReportingObserver';\n\ninterface Report {\n [key: string]: unknown;\n type: ReportTypes;\n url: string;\n body?: ReportBody;\n}\n\ntype ReportTypes = 'crash' | 'deprecation' | 'intervention';\n\ntype ReportBody = CrashReportBody | DeprecationReportBody | InterventionReportBody;\n\ninterface CrashReportBody {\n [key: string]: unknown;\n crashId: string;\n reason?: string;\n}\n\ninterface DeprecationReportBody {\n [key: string]: unknown;\n id: string;\n anticipatedRemoval?: Date;\n message: string;\n sourceFile?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\ninterface InterventionReportBody {\n [key: string]: unknown;\n id: string;\n message: string;\n sourceFile?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\ninterface ReportingObserverOptions {\n types?: ReportTypes[];\n}\n\n/** This is experimental and the types are not included with TypeScript, sadly. */\ninterface ReportingObserverClass {\n new (\n handler: (reports: Report[]) => void,\n options: { buffered?: boolean; types?: ReportTypes[] },\n ): {\n observe: () => void;\n };\n}\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _reportingObserverIntegration = ((options: ReportingObserverOptions = {}) => {\n const types = options.types || ['crash', 'deprecation', 'intervention'];\n\n /** Handler for the reporting observer. */\n function handler(reports: Report[]): void {\n if (!SETUP_CLIENTS.has(getClient() as Client)) {\n return;\n }\n\n for (const report of reports) {\n withScope(scope => {\n scope.setExtra('url', report.url);\n\n const label = `ReportingObserver [${report.type}]`;\n let details = 'No details available';\n\n if (report.body) {\n // Object.keys doesn't work on ReportBody, as all properties are inherited\n const plainBody: {\n [key: string]: unknown;\n } = {};\n\n // eslint-disable-next-line guard-for-in\n for (const prop in report.body) {\n plainBody[prop] = report.body[prop];\n }\n\n scope.setExtra('body', plainBody);\n\n if (report.type === 'crash') {\n const body = report.body as CrashReportBody;\n // A fancy way to create a message out of crashId OR reason OR both OR fallback\n details = [body.crashId || '', body.reason || ''].join(' ').trim() || details;\n } else {\n const body = report.body as DeprecationReportBody | InterventionReportBody;\n details = body.message || details;\n }\n }\n\n captureMessage(`${label}: ${details}`);\n });\n }\n }\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!supportsReportingObserver()) {\n return;\n }\n\n const observer = new (WINDOW as typeof WINDOW & { ReportingObserver: ReportingObserverClass }).ReportingObserver(\n handler,\n {\n buffered: true,\n types,\n },\n );\n\n observer.observe();\n },\n\n setup(client): void {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Reporting API integration - https://w3c.github.io/reporting/\n */\nexport const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);\n"],"names":[],"mappings":";;AAUA,MAAM,MAAA,GAAS,UAAA;;AAEf,MAAM,gBAAA,GAAmB,mBAAmB;;AAoD5C,MAAM,aAAA,GAAgB,IAAI,OAAO,EAAmB;;AAEpD,MAAM,6BAAA,IAAiC,CAAC,OAAO,GAA6B,EAAE,KAAK;AACnF,EAAE,MAAM,KAAA,GAAQ,OAAO,CAAC,KAAA,IAAS,CAAC,OAAO,EAAE,aAAa,EAAE,cAAc,CAAC;;AAEzE;AACA,EAAE,SAAS,OAAO,CAAC,OAAO,EAAkB;AAC5C,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAC,EAAY,EAAE;AACnD,MAAM;AACN,IAAI;;AAEJ,IAAI,KAAK,MAAM,MAAA,IAAU,OAAO,EAAE;AAClC,MAAM,SAAS,CAAC,KAAA,IAAS;AACzB,QAAQ,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC;;AAEzC,QAAQ,MAAM,KAAA,GAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC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OAAA,EAAA;AACA,IAAA,CAAA;;AAEA,IAAA,KAAA,CAAA,MAAA,EAAA;AACA,MAAA,aAAA,CAAA,GAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA,CAAA,CAAA;;AAEA;AACA;AACA;AACA,MAAA,4BAAA,GAAA,iBAAA,CAAA,6BAAA;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spotlight.js","sources":["../../../../../src/integrations/spotlight.ts"],"sourcesContent":["import type { Client, Envelope, Event, IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, serializeEnvelope } from '@sentry/core';\nimport { getNativeImplementation } from '@sentry-internal/browser-utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WINDOW } from '../helpers';\n\nexport type SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'SpotlightBrowser';\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';\n\n return {\n name: INTEGRATION_NAME,\n setup: () => {\n DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);\n },\n // We don't want to send interaction transactions/root spans created from\n // clicks within Spotlight to Sentry. Neither do we want them to be sent to\n // spotlight.\n processEvent: event => (isSpotlightInteraction(event) ? null : event),\n afterAllSetup: (client: Client) => {\n setupSidecarForwarding(client, sidecarUrl);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction setupSidecarForwarding(client: Client, sidecarUrl: string): void {\n const makeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch');\n let failCount = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failCount > 3) {\n debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:', failCount);\n return;\n }\n\n makeFetch(sidecarUrl, {\n method: 'POST',\n body: serializeEnvelope(envelope),\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n mode: 'cors',\n }).then(\n res => {\n if (res.status >= 200 && res.status < 400) {\n // Reset failed requests counter on success\n failCount = 0;\n }\n },\n err => {\n failCount++;\n debug.error(\n \"Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/\",\n err,\n );\n },\n );\n });\n}\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);\n\n/**\n * Flags if the event is a transaction created from an interaction with the spotlight UI.\n */\nexport function isSpotlightInteraction(event: Event): boolean {\n return Boolean(\n event.type === 'transaction' &&\n event.spans &&\n event.contexts?.trace &&\n event.contexts.trace.op === 'ui.action.click' &&\n event.spans.some(({ description }) => description?.includes('#sentry-spotlight')),\n );\n}\n"],"names":[],"mappings":";;;;AAcO,MAAM,gBAAA,GAAmB;;AAEhC,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAwC,EAAE,KAAK;AACtF,EAAE,MAAM,UAAA,GAAa,OAAO,CAAC,UAAA,IAAc,8BAA8B;;AAEzE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,EAAE,MAAM;AACjB,MAAM,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC;AAC/D,IAAI,CAAC;AACL;AACA;AACA;AACA,IAAI,YAAY,EAAE,KAAA,KAAU,sBAAsB,CAAC,KAAK,CAAA,GAAI,IAAA,GAAO,KAAK,CAAC;AACzE,IAAI,aAAa,EAAE,CAAC,MAAM,KAAa;AACvC,MAAM,sBAAsB,CAAC,MAAM,EAAE,UAAU,CAAC;AAChD,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED,SAAS,sBAAsB,CAAC,MAAM,EAAU,UAAU,EAAgB;AAC1E,EAAE,M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AAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,WAAA,EAAa,KAAK,WAAW,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACvF,GAAG;AACH;;;;"}
@@ -0,0 +1,247 @@
1
+ import { defineIntegration, debug, getClient, isPrimitive, captureEvent, isPlainObject } from '@sentry/core';
2
+ import { DEBUG_BUILD } from '../debug-build.js';
3
+ import { eventFromUnknownInput } from '../eventbuilder.js';
4
+ import { WINDOW } from '../helpers.js';
5
+ import { _eventFromRejectionWithPrimitive, _getUnhandledRejectionError } from './globalhandlers.js';
6
+
7
+ const INTEGRATION_NAME = 'WebWorker';
8
+
9
+ /**
10
+ * Use this integration to set up Sentry with web workers.
11
+ *
12
+ * IMPORTANT: This integration must be added **before** you start listening to
13
+ * any messages from the worker. Otherwise, your message handlers will receive
14
+ * messages from the Sentry SDK which you need to ignore.
15
+ *
16
+ * This integration only has an effect, if you call `Sentry.registerWebWorker(self)`
17
+ * from within the worker(s) you're adding to the integration.
18
+ *
19
+ * Given that you want to initialize the SDK as early as possible, you most likely
20
+ * want to add this integration **after** initializing the SDK:
21
+ *
22
+ * @example:
23
+ * ```ts filename={main.js}
24
+ * import * as Sentry from '@sentry/<your-sdk>';
25
+ *
26
+ * // some time earlier:
27
+ * Sentry.init(...)
28
+ *
29
+ * // 1. Initialize the worker
30
+ * const worker = new Worker(new URL('./worker.ts', import.meta.url));
31
+ *
32
+ * // 2. Add the integration
33
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker });
34
+ * Sentry.addIntegration(webWorkerIntegration);
35
+ *
36
+ * // 3. Register message listeners on the worker
37
+ * worker.addEventListener('message', event => {
38
+ * // ...
39
+ * });
40
+ * ```
41
+ *
42
+ * If you initialize multiple workers at the same time, you can also pass an array of workers
43
+ * to the integration:
44
+ *
45
+ * ```ts filename={main.js}
46
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: [worker1, worker2] });
47
+ * Sentry.addIntegration(webWorkerIntegration);
48
+ * ```
49
+ *
50
+ * If you have any additional workers that you initialize at a later point,
51
+ * you can add them to the integration as follows:
52
+ *
53
+ * ```ts filename={main.js}
54
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: worker1 });
55
+ * Sentry.addIntegration(webWorkerIntegration);
56
+ *
57
+ * // sometime later:
58
+ * webWorkerIntegration.addWorker(worker2);
59
+ * ```
60
+ *
61
+ * Of course, you can also directly add the integration in Sentry.init:
62
+ * ```ts filename={main.js}
63
+ * import * as Sentry from '@sentry/<your-sdk>';
64
+ *
65
+ * // 1. Initialize the worker
66
+ * const worker = new Worker(new URL('./worker.ts', import.meta.url));
67
+ *
68
+ * // 2. Initialize the SDK
69
+ * Sentry.init({
70
+ * integrations: [Sentry.webWorkerIntegration({ worker })]
71
+ * });
72
+ *
73
+ * // 3. Register message listeners on the worker
74
+ * worker.addEventListener('message', event => {
75
+ * // ...
76
+ * });
77
+ * ```
78
+ *
79
+ * @param options {WebWorkerIntegrationOptions} Integration options:
80
+ * - `worker`: The worker instance.
81
+ */
82
+ const webWorkerIntegration = defineIntegration(({ worker }) => ({
83
+ name: INTEGRATION_NAME,
84
+ setupOnce: () => {
85
+ (Array.isArray(worker) ? worker : [worker]).forEach(w => listenForSentryMessages(w));
86
+ },
87
+ addWorker: (worker) => listenForSentryMessages(worker),
88
+ })) ;
89
+
90
+ function listenForSentryMessages(worker) {
91
+ worker.addEventListener('message', event => {
92
+ if (isSentryMessage(event.data)) {
93
+ event.stopImmediatePropagation(); // other listeners should not receive this message
94
+
95
+ // Handle debug IDs
96
+ if (event.data._sentryDebugIds) {
97
+ DEBUG_BUILD && debug.log('Sentry debugId web worker message received', event.data);
98
+ WINDOW._sentryDebugIds = {
99
+ ...event.data._sentryDebugIds,
100
+ // debugIds of the main thread have precedence over the worker's in case of a collision.
101
+ ...WINDOW._sentryDebugIds,
102
+ };
103
+ }
104
+
105
+ // Handle unhandled rejections forwarded from worker
106
+ if (event.data._sentryWorkerError) {
107
+ DEBUG_BUILD && debug.log('Sentry worker rejection message received', event.data._sentryWorkerError);
108
+ handleForwardedWorkerRejection(event.data._sentryWorkerError);
109
+ }
110
+ }
111
+ });
112
+ }
113
+
114
+ function handleForwardedWorkerRejection(workerError) {
115
+ const client = getClient();
116
+ if (!client) {
117
+ return;
118
+ }
119
+
120
+ const stackParser = client.getOptions().stackParser;
121
+ const attachStacktrace = client.getOptions().attachStacktrace;
122
+
123
+ const error = workerError.reason;
124
+
125
+ // Follow same pattern as globalHandlers for unhandledrejection
126
+ // Handle both primitives and errors the same way
127
+ const event = isPrimitive(error)
128
+ ? _eventFromRejectionWithPrimitive(error)
129
+ : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);
130
+
131
+ event.level = 'error';
132
+
133
+ // Add worker-specific context
134
+ if (workerError.filename) {
135
+ event.contexts = {
136
+ ...event.contexts,
137
+ worker: {
138
+ filename: workerError.filename,
139
+ },
140
+ };
141
+ }
142
+
143
+ captureEvent(event, {
144
+ originalException: error,
145
+ mechanism: {
146
+ handled: false,
147
+ type: 'auto.browser.web_worker.onunhandledrejection',
148
+ },
149
+ });
150
+
151
+ DEBUG_BUILD && debug.log('Captured worker unhandled rejection', error);
152
+ }
153
+
154
+ /**
155
+ * Minimal interface for DedicatedWorkerGlobalScope, only requiring the postMessage method.
156
+ * (which is the only thing we need from the worker's global object)
157
+ *
158
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope
159
+ *
160
+ * We can't use the actual type because it breaks everyone who doesn't have {"lib": ["WebWorker"]}
161
+ * but uses {"skipLibCheck": true} in their tsconfig.json.
162
+ */
163
+
164
+ /**
165
+ * Use this function to register the worker with the Sentry SDK.
166
+ *
167
+ * This function will:
168
+ * - Send debug IDs to the parent thread
169
+ * - Set up a handler for unhandled rejections in the worker
170
+ * - Forward unhandled rejections to the parent thread for capture
171
+ *
172
+ * Note: Synchronous errors in workers are already captured by globalHandlers.
173
+ * This only handles unhandled promise rejections which don't bubble to the parent.
174
+ *
175
+ * @example
176
+ * ```ts filename={worker.js}
177
+ * import * as Sentry from '@sentry/<your-sdk>';
178
+ *
179
+ * // Do this as early as possible in your worker.
180
+ * Sentry.registerWebWorker({ self });
181
+ *
182
+ * // continue setting up your worker
183
+ * self.postMessage(...)
184
+ * ```
185
+ * @param options {RegisterWebWorkerOptions} Integration options:
186
+ * - `self`: The worker instance you're calling this function from (self).
187
+ */
188
+ function registerWebWorker({ self }) {
189
+ // Send debug IDs to parent thread
190
+ self.postMessage({
191
+ _sentryMessage: true,
192
+ _sentryDebugIds: self._sentryDebugIds ?? undefined,
193
+ });
194
+
195
+ // Set up unhandledrejection handler inside the worker
196
+ // Following the same pattern as globalHandlers
197
+ // unhandled rejections don't bubble to the parent thread, so we need to handle them here
198
+ self.addEventListener('unhandledrejection', (event) => {
199
+ const reason = _getUnhandledRejectionError(event);
200
+
201
+ // Forward the raw reason to parent thread
202
+ // The parent will handle primitives vs errors the same way globalHandlers does
203
+ const serializedError = {
204
+ reason: reason,
205
+ filename: self.location?.href,
206
+ };
207
+
208
+ // Forward to parent thread
209
+ self.postMessage({
210
+ _sentryMessage: true,
211
+ _sentryWorkerError: serializedError,
212
+ });
213
+
214
+ DEBUG_BUILD && debug.log('[Sentry Worker] Forwarding unhandled rejection to parent', serializedError);
215
+ });
216
+
217
+ DEBUG_BUILD && debug.log('[Sentry Worker] Registered worker with unhandled rejection handling');
218
+ }
219
+
220
+ function isSentryMessage(eventData) {
221
+ if (!isPlainObject(eventData) || eventData._sentryMessage !== true) {
222
+ return false;
223
+ }
224
+
225
+ // Must have at least one of: debug IDs or worker error
226
+ const hasDebugIds = '_sentryDebugIds' in eventData;
227
+ const hasWorkerError = '_sentryWorkerError' in eventData;
228
+
229
+ if (!hasDebugIds && !hasWorkerError) {
230
+ return false;
231
+ }
232
+
233
+ // Validate debug IDs if present
234
+ if (hasDebugIds && !(isPlainObject(eventData._sentryDebugIds) || eventData._sentryDebugIds === undefined)) {
235
+ return false;
236
+ }
237
+
238
+ // Validate worker error if present
239
+ if (hasWorkerError && !isPlainObject(eventData._sentryWorkerError)) {
240
+ return false;
241
+ }
242
+
243
+ return true;
244
+ }
245
+
246
+ export { INTEGRATION_NAME, registerWebWorker, webWorkerIntegration };
247
+ //# sourceMappingURL=webWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webWorker.js","sources":["../../../../../src/integrations/webWorker.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { captureEvent, debug, defineIntegration, getClient, isPlainObject, isPrimitive } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { WINDOW } from '../helpers';\nimport { _eventFromRejectionWithPrimitive, _getUnhandledRejectionError } from './globalhandlers';\n\nexport const INTEGRATION_NAME = 'WebWorker';\n\ninterface WebWorkerMessage {\n _sentryMessage: boolean;\n _sentryDebugIds?: Record<string, string>;\n _sentryWorkerError?: SerializedWorkerError;\n}\n\ninterface SerializedWorkerError {\n reason: unknown;\n filename?: string;\n}\n\ninterface WebWorkerIntegrationOptions {\n worker: Worker | Array<Worker>;\n}\n\ninterface WebWorkerIntegration extends Integration {\n addWorker: (worker: Worker) => void;\n}\n\n/**\n * Use this integration to set up Sentry with web workers.\n *\n * IMPORTANT: This integration must be added **before** you start listening to\n * any messages from the worker. Otherwise, your message handlers will receive\n * messages from the Sentry SDK which you need to ignore.\n *\n * This integration only has an effect, if you call `Sentry.registerWebWorker(self)`\n * from within the worker(s) you're adding to the integration.\n *\n * Given that you want to initialize the SDK as early as possible, you most likely\n * want to add this integration **after** initializing the SDK:\n *\n * @example:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // some time earlier:\n * Sentry.init(...)\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Add the integration\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * If you initialize multiple workers at the same time, you can also pass an array of workers\n * to the integration:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: [worker1, worker2] });\n * Sentry.addIntegration(webWorkerIntegration);\n * ```\n *\n * If you have any additional workers that you initialize at a later point,\n * you can add them to the integration as follows:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: worker1 });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // sometime later:\n * webWorkerIntegration.addWorker(worker2);\n * ```\n *\n * Of course, you can also directly add the integration in Sentry.init:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Initialize the SDK\n * Sentry.init({\n * integrations: [Sentry.webWorkerIntegration({ worker })]\n * });\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * @param options {WebWorkerIntegrationOptions} Integration options:\n * - `worker`: The worker instance.\n */\nexport const webWorkerIntegration = defineIntegration(({ worker }: WebWorkerIntegrationOptions) => ({\n name: INTEGRATION_NAME,\n setupOnce: () => {\n (Array.isArray(worker) ? worker : [worker]).forEach(w => listenForSentryMessages(w));\n },\n addWorker: (worker: Worker) => listenForSentryMessages(worker),\n})) as IntegrationFn<WebWorkerIntegration>;\n\nfunction listenForSentryMessages(worker: Worker): void {\n worker.addEventListener('message', event => {\n if (isSentryMessage(event.data)) {\n event.stopImmediatePropagation(); // other listeners should not receive this message\n\n // Handle debug IDs\n if (event.data._sentryDebugIds) {\n DEBUG_BUILD && debug.log('Sentry debugId web worker message received', event.data);\n WINDOW._sentryDebugIds = {\n ...event.data._sentryDebugIds,\n // debugIds of the main thread have precedence over the worker's in case of a collision.\n ...WINDOW._sentryDebugIds,\n };\n }\n\n // Handle unhandled rejections forwarded from worker\n if (event.data._sentryWorkerError) {\n DEBUG_BUILD && debug.log('Sentry worker rejection message received', event.data._sentryWorkerError);\n handleForwardedWorkerRejection(event.data._sentryWorkerError);\n }\n }\n });\n}\n\nfunction handleForwardedWorkerRejection(workerError: SerializedWorkerError): void {\n const client = getClient();\n if (!client) {\n return;\n }\n\n const stackParser = client.getOptions().stackParser;\n const attachStacktrace = client.getOptions().attachStacktrace;\n\n const error = workerError.reason;\n\n // Follow same pattern as globalHandlers for unhandledrejection\n // Handle both primitives and errors the same way\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n // Add worker-specific context\n if (workerError.filename) {\n event.contexts = {\n ...event.contexts,\n worker: {\n filename: workerError.filename,\n },\n };\n }\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.web_worker.onunhandledrejection',\n },\n });\n\n DEBUG_BUILD && debug.log('Captured worker unhandled rejection', error);\n}\n\n/**\n * Minimal interface for DedicatedWorkerGlobalScope, only requiring the postMessage method.\n * (which is the only thing we need from the worker's global object)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope\n *\n * We can't use the actual type because it breaks everyone who doesn't have {\"lib\": [\"WebWorker\"]}\n * but uses {\"skipLibCheck\": true} in their tsconfig.json.\n */\ninterface MinimalDedicatedWorkerGlobalScope {\n postMessage: (message: unknown) => void;\n addEventListener: (type: string, listener: (event: unknown) => void) => void;\n location?: { href?: string };\n}\n\ninterface RegisterWebWorkerOptions {\n self: MinimalDedicatedWorkerGlobalScope & { _sentryDebugIds?: Record<string, string> };\n}\n\n/**\n * Use this function to register the worker with the Sentry SDK.\n *\n * This function will:\n * - Send debug IDs to the parent thread\n * - Set up a handler for unhandled rejections in the worker\n * - Forward unhandled rejections to the parent thread for capture\n *\n * Note: Synchronous errors in workers are already captured by globalHandlers.\n * This only handles unhandled promise rejections which don't bubble to the parent.\n *\n * @example\n * ```ts filename={worker.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // Do this as early as possible in your worker.\n * Sentry.registerWebWorker({ self });\n *\n * // continue setting up your worker\n * self.postMessage(...)\n * ```\n * @param options {RegisterWebWorkerOptions} Integration options:\n * - `self`: The worker instance you're calling this function from (self).\n */\nexport function registerWebWorker({ self }: RegisterWebWorkerOptions): void {\n // Send debug IDs to parent thread\n self.postMessage({\n _sentryMessage: true,\n _sentryDebugIds: self._sentryDebugIds ?? undefined,\n });\n\n // Set up unhandledrejection handler inside the worker\n // Following the same pattern as globalHandlers\n // unhandled rejections don't bubble to the parent thread, so we need to handle them here\n self.addEventListener('unhandledrejection', (event: unknown) => {\n const reason = _getUnhandledRejectionError(event);\n\n // Forward the raw reason to parent thread\n // The parent will handle primitives vs errors the same way globalHandlers does\n const serializedError: SerializedWorkerError = {\n reason: reason,\n filename: self.location?.href,\n };\n\n // Forward to parent thread\n self.postMessage({\n _sentryMessage: true,\n _sentryWorkerError: serializedError,\n });\n\n DEBUG_BUILD && debug.log('[Sentry Worker] Forwarding unhandled rejection to parent', serializedError);\n });\n\n DEBUG_BUILD && debug.log('[Sentry Worker] Registered worker with unhandled rejection handling');\n}\n\nfunction isSentryMessage(eventData: unknown): eventData is WebWorkerMessage {\n if (!isPlainObject(eventData) || eventData._sentryMessage !== true) {\n return false;\n }\n\n // Must have at least one of: debug IDs or worker error\n const hasDebugIds = '_sentryDebugIds' in eventData;\n const hasWorkerError = '_sentryWorkerError' in eventData;\n\n if (!hasDebugIds && !hasWorkerError) {\n return false;\n }\n\n // Validate debug IDs if present\n if (hasDebugIds && !(isPlainObject(eventData._sentryDebugIds) || eventData._sentryDebugIds === undefined)) {\n return false;\n }\n\n // Validate worker error if present\n if (hasWorkerError && !isPlainObject(eventData._sentryWorkerError)) {\n return false;\n }\n\n return true;\n}\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,gBAAA,GAA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EF;AACA,EAAE,MAAM,WAAA,GAAc,iBAAA,IAAqB,SAAS;AACpD,EAAE,MAAM,cAAA,GAAiB,oBAAA,IAAwB,SAAS;;AAE1D,EAAE,IAAI,CAAC,eAAe,CAAC,cAAc,EAAE;AACvC,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF;AACA,EAAE,IAAI,WAAA,IAAe,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAA,IAAK,SAAS,CAAC,oBAAoB,SAAS,CAAC,EAAE;AAC7G,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF;AACA,EAAE,IAAI,cAAA,IAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE;AACtE,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,OAAO,IAAI;AACb;;;;"}
@@ -0,0 +1 @@
1
+ {"type":"module","version":"10.25.0","sideEffects":false}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.js","sources":["../../../../../src/profiling/integration.ts"],"sourcesContent":["import type { EventEnvelope, IntegrationFn, Profile, Span } from '@sentry/core';\nimport { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport { BrowserTraceLifecycleProfiler } from './lifecycleMode/traceLifecycleProfiler';\nimport { startProfileForSpan } from './startProfileForSpan';\nimport type { ProfiledEvent } from './utils';\nimport {\n addProfilesToEnvelope,\n attachProfiledThreadToEvent,\n createProfilingEvent,\n findProfiledTransactionsFromEnvelope,\n getActiveProfilesCount,\n hasLegacyProfiling,\n isAutomatedPageLoadSpan,\n shouldProfileSession,\n shouldProfileSpanLegacy,\n takeProfileFromGlobalCache,\n} from './utils';\n\nconst INTEGRATION_NAME = 'BrowserProfiling';\n\nconst _browserProfilingIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const options = client.getOptions() as BrowserOptions;\n\n if (!hasLegacyProfiling(options) && !options.profileLifecycle) {\n // Set default lifecycle mode\n options.profileLifecycle = 'manual';\n }\n\n if (hasLegacyProfiling(options) && !options.profilesSampleRate) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling disabled, no profiling options found.');\n return;\n }\n\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n\n if (hasLegacyProfiling(options) && options.profileSessionSampleRate !== undefined) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled.',\n );\n }\n\n // UI PROFILING (Profiling V2)\n if (!hasLegacyProfiling(options)) {\n const sessionSampled = shouldProfileSession(options);\n if (!sessionSampled) {\n DEBUG_BUILD && debug.log('[Profiling] Session not sampled. Skipping lifecycle profiler initialization.');\n }\n\n const lifecycleMode = options.profileLifecycle;\n\n if (lifecycleMode === 'trace') {\n if (!hasSpansEnabled(options)) {\n DEBUG_BUILD &&\n debug.warn(\n \"[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.\",\n );\n return;\n }\n\n const traceLifecycleProfiler = new BrowserTraceLifecycleProfiler();\n traceLifecycleProfiler.initialize(client, sessionSampled);\n\n // If there is an active, sampled root span already, notify the profiler\n if (rootSpan) {\n traceLifecycleProfiler.notifyRootSpanActive(rootSpan);\n }\n\n // In case rootSpan is created slightly after setup -> schedule microtask to re-check and notify.\n WINDOW.setTimeout(() => {\n const laterActiveSpan = getActiveSpan();\n const laterRootSpan = laterActiveSpan && getRootSpan(laterActiveSpan);\n if (laterRootSpan) {\n traceLifecycleProfiler.notifyRootSpanActive(laterRootSpan);\n }\n }, 0);\n }\n } else {\n // LEGACY PROFILING (v1)\n if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) {\n if (shouldProfileSpanLegacy(rootSpan)) {\n startProfileForSpan(rootSpan);\n }\n }\n\n client.on('spanStart', (span: Span) => {\n if (span === getRootSpan(span) && shouldProfileSpanLegacy(span)) {\n startProfileForSpan(span);\n }\n });\n\n client.on('beforeEnvelope', (envelope): void => {\n // if not profiles are in queue, there is nothing to add to the envelope.\n if (!getActiveProfilesCount()) {\n return;\n }\n\n const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope);\n if (!profiledTransactionEvents.length) {\n return;\n }\n\n const profilesToAddToEnvelope: Profile[] = [];\n\n for (const profiledTransaction of profiledTransactionEvents) {\n const context = profiledTransaction?.contexts;\n const profile_id = context?.profile?.['profile_id'];\n const start_timestamp = context?.profile?.['start_timestamp'];\n\n if (typeof profile_id !== 'string') {\n DEBUG_BUILD && debug.log('[Profiling] cannot find profile for a span without a profile context');\n continue;\n }\n\n if (!profile_id) {\n DEBUG_BUILD && debug.log('[Profiling] cannot find profile for a span without a profile context');\n continue;\n }\n\n // Remove the profile from the span context before sending, relay will take care of the rest.\n if (context?.profile) {\n delete context.profile;\n }\n\n const profile = takeProfileFromGlobalCache(profile_id);\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`);\n continue;\n }\n\n const profileEvent = createProfilingEvent(\n profile_id,\n start_timestamp as number | undefined,\n profile,\n profiledTransaction as ProfiledEvent,\n );\n if (profileEvent) {\n profilesToAddToEnvelope.push(profileEvent);\n }\n }\n\n addProfilesToEnvelope(envelope as EventEnvelope, profilesToAddToEnvelope);\n });\n }\n },\n processEvent(event) {\n return attachProfiledThreadToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration);\n"],"names":[],"mappings":";;;;;;;AAqBA,MAAM,gBAAA,GAAmB,kBAAkB;;AAE3C,MAAM,4BAAA,IAAgC,MAAM;AAC5C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,OAAA,GAAU,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceLifecycleProfiler.js","sources":["../../../../../../src/profiling/lifecycleMode/traceLifecycleProfiler.ts"],"sourcesContent":["import type { Client, ProfileChunk, Span } from '@sentry/core';\nimport {\n type ProfileChunkEnvelope,\n createEnvelope,\n debug,\n dsnToString,\n getGlobalScope,\n getRootSpan,\n getSdkMetadataForEnvelopeHeader,\n uuid4,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { JSSelfProfiler } from '../jsSelfProfiling';\nimport { createProfileChunkPayload, startJSSelfProfile, validateProfileChunk } from '../utils';\n\nconst CHUNK_INTERVAL_MS = 60_000; // 1 minute\n// Maximum length for trace lifecycle profiling per root span (e.g. if spanEnd never fires)\nconst MAX_ROOT_SPAN_PROFILE_MS = 300_000; // 5 minutes\n\n/**\n * Browser trace-lifecycle profiler (UI Profiling / Profiling V2):\n * - Starts when the first sampled root span starts\n * - Stops when the last sampled root span ends\n * - While running, periodically stops and restarts the JS self-profiling API to collect chunks\n *\n * Profiles are emitted as standalone `profile_chunk` envelopes either when:\n * - there are no more sampled root spans, or\n * - the 60s chunk timer elapses while profiling is running.\n */\nexport class BrowserTraceLifecycleProfiler {\n private _client: Client | undefined;\n private _profiler: JSSelfProfiler | undefined;\n private _chunkTimer: ReturnType<typeof setTimeout> | undefined;\n // For keeping track of active root spans\n private _activeRootSpanIds: Set<string>;\n private _rootSpanTimeouts: Map<string, ReturnType<typeof setTimeout>>;\n // ID for Profiler session\n private _profilerId: string | undefined;\n private _isRunning: boolean;\n private _sessionSampled: boolean;\n\n public constructor() {\n this._client = undefined;\n this._profiler = undefined;\n this._chunkTimer = undefined;\n this._activeRootSpanIds = new Set<string>();\n this._rootSpanTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n this._profilerId = undefined;\n this._isRunning = false;\n this._sessionSampled = false;\n }\n\n /**\n * Initialize the profiler with client and session sampling decision computed by the integration.\n */\n public initialize(client: Client, sessionSampled: boolean): void {\n // One Profiler ID per profiling session (user session)\n this._profilerId = uuid4();\n\n DEBUG_BUILD && debug.log(\"[Profiling] Initializing profiler (lifecycle='trace').\");\n\n this._client = client;\n this._sessionSampled = sessionSampled;\n\n client.on('spanStart', span => {\n if (!this._sessionSampled) {\n DEBUG_BUILD && debug.log('[Profiling] Session not sampled because of negative sampling decision.');\n return;\n }\n if (span !== getRootSpan(span)) {\n return;\n }\n // Only count sampled root spans\n if (!span.isRecording()) {\n DEBUG_BUILD && debug.log('[Profiling] Discarding profile because root span was not sampled.');\n return;\n }\n\n // Matching root spans with profiles\n getGlobalScope().setContext('profile', {\n profiler_id: this._profilerId,\n });\n\n const spanId = span.spanContext().spanId;\n if (!spanId) {\n return;\n }\n if (this._activeRootSpanIds.has(spanId)) {\n return;\n }\n\n this._activeRootSpanIds.add(spanId);\n const rootSpanCount = this._activeRootSpanIds.size;\n\n const timeout = setTimeout(() => {\n this._onRootSpanTimeout(spanId);\n }, MAX_ROOT_SPAN_PROFILE_MS);\n this._rootSpanTimeouts.set(spanId, timeout);\n\n if (rootSpanCount === 1) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Root span with ID ${spanId} started. Will continue profiling for as long as there are active root spans (currently: ${rootSpanCount}).`,\n );\n\n this.start();\n }\n });\n\n client.on('spanEnd', span => {\n if (!this._sessionSampled) {\n return;\n }\n\n const spanId = span.spanContext().spanId;\n if (!spanId || !this._activeRootSpanIds.has(spanId)) {\n return;\n }\n\n this._activeRootSpanIds.delete(spanId);\n const rootSpanCount = this._activeRootSpanIds.size;\n\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Root span with ID ${spanId} ended. Will continue profiling for as long as there are active root spans (currently: ${rootSpanCount}).`,\n );\n if (rootSpanCount === 0) {\n this._collectCurrentChunk().catch(e => {\n DEBUG_BUILD && debug.error('[Profiling] Failed to collect current profile chunk on `spanEnd`:', e);\n });\n\n this.stop();\n }\n });\n }\n\n /**\n * Handle an already-active root span at integration setup time.\n */\n public notifyRootSpanActive(rootSpan: Span): void {\n if (!this._sessionSampled) {\n return;\n }\n\n const spanId = rootSpan.spanContext().spanId;\n if (!spanId || this._activeRootSpanIds.has(spanId)) {\n return;\n }\n\n this._activeRootSpanIds.add(spanId);\n\n const rootSpanCount = this._activeRootSpanIds.size;\n\n if (rootSpanCount === 1) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Detected already active root span during setup. Active root spans now:', rootSpanCount);\n\n this.start();\n }\n }\n\n /**\n * Start profiling if not already running.\n */\n public start(): void {\n if (this._isRunning) {\n return;\n }\n this._isRunning = true;\n\n DEBUG_BUILD && debug.log('[Profiling] Started profiling with profile ID:', this._profilerId);\n\n this._startProfilerInstance();\n\n if (!this._profiler) {\n DEBUG_BUILD && debug.log('[Profiling] Stopping trace lifecycle profiling.');\n this._resetProfilerInfo();\n return;\n }\n\n this._startPeriodicChunking();\n }\n\n /**\n * Stop profiling; final chunk will be collected and sent.\n */\n public stop(): void {\n if (!this._isRunning) {\n return;\n }\n\n this._isRunning = false;\n if (this._chunkTimer) {\n clearTimeout(this._chunkTimer);\n this._chunkTimer = undefined;\n }\n\n this._clearAllRootSpanTimeouts();\n\n // Collect whatever was currently recording\n this._collectCurrentChunk().catch(e => {\n DEBUG_BUILD && debug.error('[Profiling] Failed to collect current profile chunk on `stop()`:', e);\n });\n }\n\n /**\n * Resets profiling information from scope and resets running state\n */\n private _resetProfilerInfo(): void {\n this._isRunning = false;\n getGlobalScope().setContext('profile', {});\n }\n\n /**\n * Clear and reset all per-root-span timeouts.\n */\n private _clearAllRootSpanTimeouts(): void {\n this._rootSpanTimeouts.forEach(timeout => clearTimeout(timeout));\n this._rootSpanTimeouts.clear();\n }\n\n /**\n * Start a profiler instance if needed.\n */\n private _startProfilerInstance(): void {\n if (this._profiler?.stopped === false) {\n return;\n }\n const profiler = startJSSelfProfile();\n if (!profiler) {\n DEBUG_BUILD && debug.log('[Profiling] Failed to start JS Profiler in trace lifecycle.');\n return;\n }\n this._profiler = profiler;\n }\n\n /**\n * Schedule the next 60s chunk while running.\n * Each tick collects a chunk and restarts the profiler.\n * A chunk should be closed when there are no active root spans anymore OR when the maximum chunk interval is reached.\n */\n private _startPeriodicChunking(): void {\n if (!this._isRunning) {\n return;\n }\n\n this._chunkTimer = setTimeout(() => {\n this._collectCurrentChunk().catch(e => {\n DEBUG_BUILD && debug.error('[Profiling] Failed to collect current profile chunk during periodic chunking:', e);\n });\n\n if (this._isRunning) {\n this._startProfilerInstance();\n\n if (!this._profiler) {\n // If restart failed, stop scheduling further chunks and reset context.\n this._resetProfilerInfo();\n return;\n }\n\n this._startPeriodicChunking();\n }\n }, CHUNK_INTERVAL_MS);\n }\n\n /**\n * Handle timeout for a specific root span ID to avoid indefinitely running profiler if `spanEnd` never fires.\n * If this was the last active root span, collect the current chunk and stop profiling.\n */\n private _onRootSpanTimeout(rootSpanId: string): void {\n // If span already ended, ignore\n if (!this._rootSpanTimeouts.has(rootSpanId)) {\n return;\n }\n this._rootSpanTimeouts.delete(rootSpanId);\n\n if (!this._activeRootSpanIds.has(rootSpanId)) {\n return;\n }\n\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Reached 5-minute timeout for root span ${rootSpanId}. You likely started a manual root span that never called \\`.end()\\`.`,\n );\n\n this._activeRootSpanIds.delete(rootSpanId);\n\n const rootSpanCount = this._activeRootSpanIds.size;\n if (rootSpanCount === 0) {\n this.stop();\n }\n }\n\n /**\n * Stop the current profiler, convert and send a profile chunk.\n */\n private async _collectCurrentChunk(): Promise<void> {\n const prevProfiler = this._profiler;\n this._profiler = undefined;\n\n if (!prevProfiler) {\n return;\n }\n\n try {\n const profile = await prevProfiler.stop();\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const chunk = createProfileChunkPayload(profile, this._client!, this._profilerId);\n\n // Validate chunk before sending\n const validationReturn = validateProfileChunk(chunk);\n if ('reason' in validationReturn) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Discarding invalid profile chunk (this is probably a bug in the SDK):',\n validationReturn.reason,\n );\n return;\n }\n\n this._sendProfileChunk(chunk);\n\n DEBUG_BUILD && debug.log('[Profiling] Collected browser profile chunk.');\n } catch (e) {\n DEBUG_BUILD && debug.log('[Profiling] Error while stopping JS Profiler for chunk:', e);\n }\n }\n\n /**\n * Send a profile chunk as a standalone envelope.\n */\n private _sendProfileChunk(chunk: ProfileChunk): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const client = this._client!;\n\n const sdkInfo = getSdkMetadataForEnvelopeHeader(client.getSdkMetadata?.());\n const dsn = client.getDsn();\n const tunnel = client.getOptions().tunnel;\n\n const envelope = createEnvelope<ProfileChunkEnvelope>(\n {\n event_id: uuid4(),\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n },\n [[{ type: 'profile_chunk' }, chunk]],\n );\n\n client.sendEnvelope(envelope).then(null, reason => {\n DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);\n });\n }\n}\n"],"names":[],"mappings":";;;;AAeA,MAAM,iBAAA,GAAoB,KAAM,CAAA;AAChC;AACA,MAAM,wBAAA,GAA2B,MAAO,CAAA;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,6BAAA,CAA8B;;AAI3C;;AAGA;;AAKA,GAAS,WAAW,GAAG;AACvB,IAAI,IAAI,CAAC,OAAA,GAAU,SAAS;AAC5B,IAAI,IAAI,CAAC,SAAA,GAAY,SAAS;AAC9B,IAAI,IAAI,CAAC,WAAA,GAAc,SAAS;AAChC,IAAI,IAAI,CAAC,kBAAA,GAAqB,IAAI,GAAG,EAAU;AAC/C,IAAI,IAAI,CAAC,iBAAA,GAAoB,IAAI,GAAG,EAAyC;AAC7E,IAAI,IAAI,CAAC,WAAA,GAAc,SAAS;AAChC,IAAI,IAAI,CAAC,UAAA,GAAa,KAAK;AAC3B,IAAI,IAAI,CAAC,eAAA,GAAkB,KAAK;AACh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,SAAS,MAAM,CAAC,UAAU,EAAE,CAAC,MAAM;;AAE7C,IAAI,MAAM,QAAA,GAAW,cAAc;AACnC,MAAM;AACN,QAAQ,QAAQ,EAAE,KAAK,EAAE;AACzB,QAAQ,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACzC,QAAQ,IAAI,OAAA,IAAW,EAAE,GAAG,EAAE,OAAA,EAAS,CAAC;AACxC,QAAQ,IAAI,CAAC,CAAC,MAAA,IAAU,GAAA,IAAO,EAAE,GAAG,EAAE,WAAW,CAAC,GAAG,CAAA,EAAG,CAAC;AACzD,OAAO;AACP,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;AAC1C,KAAK;;AAEL,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAA,IAAU;AACvD,MAAM,WAAA,IAAe,KAAK,CAAC,KAAK,CAAC,6CAA6C,EAAE,MAAM,CAAC;AACvF,IAAI,CAAC,CAAC;AACN,EAAE;AACF;;;;"}
@@ -0,0 +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":[],"mappings":";;;;;AAOA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,IAAI,EAAc;AACtD;AACA,EAAE,IAAI,cAAc;AACpB,EAAE,IAAI,uBAAuB,CAAC,IAAI,CAAC,EAAE;AACrC,IAAI,iBAAiB,kBAAkB,EAAC,GAAI,IAAI;AAChD,EAAE;;AAEF,EAAE,MAAM,QAAA,GAAW,kBAAkB,EAAE;;AAEvC;AACA;AACA,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI;AACJ,EAAE;;AAEF,EA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DAAA,EAAA,UAAA,CAAA,IAAA,CAAA,CAAA,WAAA,CAAA,CAAA;AACA,cAAA,8GAAA;AACA,aAAA;AACA,UAAA;AACA,UAAA;AACA,QAAA;;AAEA,QAAA,gBAAA,GAAA,OAAA;AACA,QAAA,uBAAA,CAAA,SAAA,EAAA,OAAA,CAAA;AACA,MAAA,CAAA;AACA,OAAA,KAAA,CAAA,KAAA,IAAA;AACA,QAAA,IAAA,WAAA,EAAA;AACA,UAAA,KAAA,CAAA,GAAA,CAAA,4CAAA,EAAA,KAAA,CAAA;AACA,QAAA;AACA,MAAA,CAAA,CAAA;AACA,EAAA;;AAEA;AACA,EAAA,IAAA,oBAAA,GAAA,MAAA,CAAA,UAAA,CAAA,MAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,KAAA,CAAA,GAAA,CAAA,mEAAA,EAAA,UAAA,CAAA,IAAA,CAAA,CAAA,WAAA,CAAA;AACA,IAAA;AACA;AACA;AACA,IAAA,gBAAA,EAAA;AACA,EAAA,CAAA,EAAA,uBAAA,CAAA;;AAEA;AACA,EAAA,MAAA,WAAA,GAAA,IAAA,CAAA,GAAA,CAAA,IAAA,CAAA,IAAA,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAA,SAAA,uBAAA,GAAA;AACA,IAAA,IAAA,CAAA,IAAA,EAAA;AACA,MAAA,OAAA,WAAA,EAAA;AACA,IAAA;AACA;AACA;AACA,IAAA,KAAA,gBAAA,EAAA,CAAA,IAAA;AACA,MAAA,MAAA;AACA,QAAA,WAAA,EAAA;AACA,MAAA,CAAA;AACA,MAAA,MAAA;AACA;AACA,QAAA,WAAA,EAAA;AACA,MAAA,CAAA;AACA,KAAA;;AAEA,IAAA,OAAA,IAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,GAAA,GAAA,uBAAA;AACA;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/profiling/utils.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n Envelope,\n Event,\n EventEnvelope,\n Profile,\n ProfileChunk,\n Span,\n ThreadCpuProfile,\n} from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n DEFAULT_ENVIRONMENT,\n forEachEnvelopeItem,\n getClient,\n getDebugImagesForResources,\n GLOBAL_OBJ,\n spanToJSON,\n timestampInSeconds,\n uuid4,\n} from '@sentry/core';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor, JSSelfProfileStack } from './jsSelfProfiling';\n\nconst MS_TO_NS = 1e6;\n\n// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers\nconst isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';\n\n// Setting ID to 0 as we cannot get an ID from Web Workers\nexport const PROFILER_THREAD_ID_STRING = String(0);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\n\n// We force make this optional to be on the safe side...\nconst navigator = WINDOW.navigator as typeof WINDOW.navigator | undefined;\n\n// Machine properties (eval only once)\nlet OS_PLATFORM = '';\nlet OS_PLATFORM_VERSION = '';\nlet OS_ARCH = '';\nlet OS_BROWSER = navigator?.userAgent || '';\nlet OS_MODEL = '';\nconst OS_LOCALE = navigator?.language || navigator?.languages?.[0] || '';\n\ntype UAData = {\n platform?: string;\n architecture?: string;\n model?: string;\n platformVersion?: string;\n fullVersionList?: {\n brand: string;\n version: string;\n }[];\n};\n\ninterface UserAgentData {\n getHighEntropyValues: (keys: string[]) => Promise<UAData>;\n}\n\nfunction isUserAgentData(data: unknown): data is UserAgentData {\n return typeof data === 'object' && data !== null && 'getHighEntropyValues' in data;\n}\n\n// @ts-expect-error userAgentData is not part of the navigator interface yet\nconst userAgentData = navigator?.userAgentData;\n\nif (isUserAgentData(userAgentData)) {\n userAgentData\n .getHighEntropyValues(['architecture', 'model', 'platform', 'platformVersion', 'fullVersionList'])\n .then((ua: UAData) => {\n OS_PLATFORM = ua.platform || '';\n OS_ARCH = ua.architecture || '';\n OS_MODEL = ua.model || '';\n OS_PLATFORM_VERSION = ua.platformVersion || '';\n\n if (ua.fullVersionList?.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1]!;\n OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;\n }\n })\n .catch(e => void e);\n}\n\nfunction isProcessedJSSelfProfile(profile: ThreadCpuProfile | JSSelfProfile): profile is JSSelfProfile {\n return !('thread_metadata' in profile);\n}\n\n// Enriches the profile with threadId of the current thread.\n// This is done in node as we seem to not be able to get the info from C native code.\n/**\n *\n */\nexport function enrichWithThreadInformation(profile: ThreadCpuProfile | JSSelfProfile): ThreadCpuProfile {\n if (!isProcessedJSSelfProfile(profile)) {\n return profile;\n }\n\n return convertJSSelfProfileToSampledFormat(profile);\n}\n\n// Profile is marked as optional because it is deleted from the metadata\n// by the integration before the event is processed by other integrations.\nexport interface ProfiledEvent extends Event {\n sdkProcessingMetadata: {\n profile?: JSSelfProfile;\n };\n}\n\nfunction getTraceId(event: Event): string {\n const traceId: unknown = event.contexts?.trace?.trace_id;\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (typeof traceId === 'string' && traceId.length !== 32) {\n if (DEBUG_BUILD) {\n debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);\n }\n }\n if (typeof traceId !== 'string') {\n return '';\n }\n\n return traceId;\n}\n/**\n * Creates a profiling event envelope from a Sentry event. If profile does not pass\n * validation, returns null.\n * @param event\n * @param dsn\n * @param metadata\n * @param tunnel\n * @returns {EventEnvelope | null}\n */\n\n/**\n * Creates a profiling event envelope from a Sentry event.\n */\nexport function createProfilePayload(\n profile_id: string,\n start_timestamp: number | undefined,\n processed_profile: JSSelfProfile,\n event: ProfiledEvent,\n): Profile {\n if (event.type !== 'transaction') {\n // createProfilingEventEnvelope should only be called for transactions,\n // we type guard this behavior with isProfiledTransactionEvent.\n throw new TypeError('Profiling events may only be attached to transactions, this should never occur.');\n }\n\n if (processed_profile === undefined || processed_profile === null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`,\n );\n }\n\n const traceId = getTraceId(event);\n const enrichedThreadProfile = enrichWithThreadInformation(processed_profile);\n const transactionStartMs = start_timestamp\n ? start_timestamp\n : typeof event.start_timestamp === 'number'\n ? event.start_timestamp * 1000\n : timestampInSeconds() * 1000;\n const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : timestampInSeconds() * 1000;\n\n const profile: Profile = {\n event_id: profile_id,\n timestamp: new Date(transactionStartMs).toISOString(),\n platform: 'javascript',\n version: '1',\n release: event.release || '',\n environment: event.environment || DEFAULT_ENVIRONMENT,\n runtime: {\n name: 'javascript',\n version: WINDOW.navigator.userAgent,\n },\n os: {\n name: OS_PLATFORM,\n version: OS_PLATFORM_VERSION,\n build_number: OS_BROWSER,\n },\n device: {\n locale: OS_LOCALE,\n model: OS_MODEL,\n manufacturer: OS_BROWSER,\n architecture: OS_ARCH,\n is_emulator: false,\n },\n debug_meta: {\n images: applyDebugMetadata(processed_profile.resources),\n },\n profile: enrichedThreadProfile,\n transactions: [\n {\n name: event.transaction || '',\n id: event.event_id || uuid4(),\n trace_id: traceId,\n active_thread_id: PROFILER_THREAD_ID_STRING,\n relative_start_ns: '0',\n relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0),\n },\n ],\n };\n\n return profile;\n}\n\n/**\n * Create a profile chunk envelope item\n */\nexport function createProfileChunkPayload(\n jsSelfProfile: JSSelfProfile,\n client: Client,\n profilerId?: string,\n): ProfileChunk {\n // only == to catch null and undefined\n if (jsSelfProfile == null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,\n );\n }\n\n const continuousProfile = convertToContinuousProfile(jsSelfProfile);\n\n const options = client.getOptions();\n const sdk = client.getSdkMetadata?.()?.sdk;\n\n return {\n chunk_id: uuid4(),\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.browser',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profilerId || uuid4(),\n platform: 'javascript',\n version: '2',\n release: options.release ?? '',\n environment: options.environment ?? 'production',\n debug_meta: {\n // function name obfuscation\n images: applyDebugMetadata(jsSelfProfile.resources),\n },\n profile: continuousProfile,\n };\n}\n\n/**\n * Validate a profile chunk against the Sample Format V2 requirements.\n * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/\n * - Presence of samples, stacks, frames\n * - Required metadata fields\n */\nexport function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { reason: string } {\n try {\n // Required metadata\n if (!chunk || typeof chunk !== 'object') {\n return { reason: 'chunk is not an object' };\n }\n\n // profiler_id and chunk_id must be 32 lowercase hex chars\n const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);\n if (!isHex32(chunk.profiler_id)) {\n return { reason: 'missing or invalid profiler_id' };\n }\n if (!isHex32(chunk.chunk_id)) {\n return { reason: 'missing or invalid chunk_id' };\n }\n\n if (!chunk.client_sdk) {\n return { reason: 'missing client_sdk metadata' };\n }\n\n // Profile data must have frames, stacks, samples\n const profile = chunk.profile as { frames?: unknown[]; stacks?: unknown[]; samples?: unknown[] } | undefined;\n if (!profile) {\n return { reason: 'missing profile data' };\n }\n\n if (!Array.isArray(profile.frames) || !profile.frames.length) {\n return { reason: 'profile has no frames' };\n }\n if (!Array.isArray(profile.stacks) || !profile.stacks.length) {\n return { reason: 'profile has no stacks' };\n }\n if (!Array.isArray(profile.samples) || !profile.samples.length) {\n return { reason: 'profile has no samples' };\n }\n\n return { valid: true };\n } catch (e) {\n return { reason: `unknown validation error: ${e}` };\n }\n}\n\n/**\n * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.\n */\nfunction convertToContinuousProfile(input: {\n frames: { name: string; resourceId?: number; line?: number; column?: number }[];\n stacks: { frameId: number; parentId?: number }[];\n samples: { timestamp: number; stackId?: number }[];\n resources: string[];\n}): ContinuousThreadCpuProfile {\n // Frames map 1:1 by index; fill only when present to avoid sparse writes\n const frames: ContinuousThreadCpuProfile['frames'] = [];\n for (let i = 0; i < input.frames.length; i++) {\n const frame = input.frames[i];\n if (!frame) {\n continue;\n }\n frames[i] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n // Build stacks by following parent links, top->down order (root last)\n const stacks: ContinuousThreadCpuProfile['stacks'] = [];\n for (let i = 0; i < input.stacks.length; i++) {\n const stackHead = input.stacks[i];\n if (!stackHead) {\n continue;\n }\n const list: number[] = [];\n let current: { frameId: number; parentId?: number } | undefined = stackHead;\n while (current) {\n list.push(current.frameId);\n current = current.parentId === undefined ? undefined : input.stacks[current.parentId];\n }\n stacks[i] = list;\n }\n\n // Align timestamps to SDK time origin to match span/event timelines\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n const samples: ContinuousThreadCpuProfile['samples'] = [];\n for (let i = 0; i < input.samples.length; i++) {\n const sample = input.samples[i];\n if (!sample) {\n continue;\n }\n // Convert ms to seconds epoch-based timestamp\n const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;\n samples[i] = {\n stack_id: sample.stackId ?? 0,\n thread_id: PROFILER_THREAD_ID_STRING,\n timestamp: timestampSeconds,\n };\n }\n\n return {\n frames,\n stacks,\n samples,\n thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },\n };\n}\n\n/**\n *\n */\nexport function isProfiledTransactionEvent(event: Event): event is ProfiledEvent {\n return !!event.sdkProcessingMetadata?.profile;\n}\n\n/*\n See packages/browser-utils/src/browser/router.ts\n*/\n/**\n *\n */\nexport function isAutomatedPageLoadSpan(span: Span): boolean {\n return spanToJSON(span).op === 'pageload';\n}\n\n/**\n * Converts a JSSelfProfile to a our sampled format.\n * Does not currently perform stack indexing.\n */\nexport function convertJSSelfProfileToSampledFormat(input: JSSelfProfile): Profile['profile'] {\n let EMPTY_STACK_ID: undefined | number = undefined;\n let STACK_ID = 0;\n\n // Initialize the profile that we will fill with data\n const profile: Profile['profile'] = {\n samples: [],\n stacks: [],\n frames: [],\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME },\n },\n };\n\n const firstSample = input.samples[0];\n if (!firstSample) {\n return profile;\n }\n\n // We assert samples.length > 0 above and timestamp should always be present\n const start = firstSample.timestamp;\n // The JS SDK might change it's time origin based on some heuristic (see See packages/utils/src/time.ts)\n // when that happens, we need to ensure we are correcting the profile timings so the two timelines stay in sync.\n // Since JS self profiling time origin is always initialized to performance.timeOrigin, we need to adjust for\n // the drift between the SDK selected value and our profile time origin.\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n input.samples.forEach((jsSample, i) => {\n // If sample has no stack, add an empty sample\n if (jsSample.stackId === undefined) {\n if (EMPTY_STACK_ID === undefined) {\n EMPTY_STACK_ID = STACK_ID;\n profile.stacks[EMPTY_STACK_ID] = [];\n STACK_ID++;\n }\n\n profile['samples'][i] = {\n // convert ms timestamp to ns\n elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),\n stack_id: EMPTY_STACK_ID,\n thread_id: PROFILER_THREAD_ID_STRING,\n };\n return;\n }\n\n let stackTop: JSSelfProfileStack | undefined = input.stacks[jsSample.stackId];\n\n // Functions in top->down order (root is last)\n // We follow the stackTop.parentId trail and collect each visited frameId\n const stack: number[] = [];\n\n while (stackTop) {\n stack.push(stackTop.frameId);\n\n const frame = input.frames[stackTop.frameId];\n\n // If our frame has not been indexed yet, index it\n if (frame && profile.frames[stackTop.frameId] === undefined) {\n profile.frames[stackTop.frameId] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n stackTop = stackTop.parentId === undefined ? undefined : input.stacks[stackTop.parentId];\n }\n\n const sample: Profile['profile']['samples'][0] = {\n // convert ms timestamp to ns\n elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),\n stack_id: STACK_ID,\n thread_id: PROFILER_THREAD_ID_STRING,\n };\n\n profile['stacks'][STACK_ID] = stack;\n profile['samples'][i] = sample;\n STACK_ID++;\n });\n\n return profile;\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: EventEnvelope, profiles: Profile[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n for (let j = 1; j < item.length; j++) {\n const event = item[j] as Event;\n\n if (event?.contexts?.profile?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Applies debug meta data to an event from a list of paths to resources (sourcemaps)\n */\nexport function applyDebugMetadata(resource_paths: ReadonlyArray<string>): DebugImage[] {\n const client = getClient();\n const options = client?.getOptions();\n const stackParser = options?.stackParser;\n\n if (!stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(stackParser, resource_paths);\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nexport function isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {\n DEBUG_BUILD &&\n debug.warn(\n `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // Boolean sample rates are always valid\n if (rate === true || rate === false) {\n return true;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\nfunction isValidProfile(profile: JSSelfProfile): profile is JSSelfProfile & { profile_id: string } {\n if (profile.samples.length < 2) {\n if (DEBUG_BUILD) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n\n if (!profile.frames.length) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Discarding profile because it contains no frames');\n }\n return false;\n }\n\n return true;\n}\n\n// Keep a flag value to avoid re-initializing the profiler constructor. If it fails\n// once, it will always fail and this allows us to early return.\nlet PROFILING_CONSTRUCTOR_FAILED: boolean = false;\nexport const MAX_PROFILE_DURATION_MS = 30_000;\n\n/**\n * Check if profiler constructor is available.\n * @param maybeProfiler\n */\nfunction isJSProfilerSupported(maybeProfiler: unknown): maybeProfiler is typeof JSSelfProfilerConstructor {\n return typeof maybeProfiler === 'function';\n}\n\n/**\n * Starts the profiler and returns the profiler instance.\n */\nexport function startJSSelfProfile(): JSSelfProfiler | undefined {\n // Feature support check first\n const JSProfilerConstructor = WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');\n }\n return;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch (e) {\n if (DEBUG_BUILD) {\n debug.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n debug.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n return;\n}\n\n/**\n * Determine if a profile should be profiled.\n */\nexport function shouldProfileSpanLegacy(span: Span): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');\n }\n return false;\n }\n\n if (!span.isRecording()) {\n DEBUG_BUILD && debug.log('[Profiling] Discarding profile because root span was not sampled.');\n return false;\n }\n\n const client = getClient();\n const options = client?.getOptions();\n if (!options) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling disabled, no options found.');\n return false;\n }\n\n // @ts-expect-error profilesSampleRate is not part of the browser options yet\n const profilesSampleRate: number | boolean | undefined = options.profilesSampleRate;\n\n // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The\n // only valid values are booleans or numbers between 0 and 1.)\n if (!isValidSampleRate(profilesSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid sample rate.');\n return false;\n }\n\n // if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped\n if (!profilesSampleRate) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0',\n );\n return false;\n }\n\n // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is\n // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.\n const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate;\n // Check if we should sample this profile\n if (!sampled) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(\n profilesSampleRate,\n )})`,\n );\n return false;\n }\n\n return true;\n}\n\n/**\n * Determine if a profile should be created for the current session (lifecycle profiling mode).\n */\nexport function shouldProfileSession(options: BrowserOptions): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');\n }\n return false;\n }\n\n if (options.profileLifecycle !== 'trace') {\n return false;\n }\n\n // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session\n const profileSessionSampleRate = options.profileSessionSampleRate;\n\n if (!isValidSampleRate(profileSessionSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');\n return false;\n }\n\n if (!profileSessionSampleRate) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');\n return false;\n }\n\n return Math.random() <= profileSessionSampleRate;\n}\n\n/**\n * Checks if legacy profiling is configured.\n */\nexport function hasLegacyProfiling(options: BrowserOptions): boolean {\n return typeof options.profilesSampleRate !== 'undefined';\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {Profile | null}\n */\nexport function createProfilingEvent(\n profile_id: string,\n start_timestamp: number | undefined,\n profile: JSSelfProfile,\n event: ProfiledEvent,\n): Profile | null {\n if (!isValidProfile(profile)) {\n return null;\n }\n\n return createProfilePayload(profile_id, start_timestamp, profile, event);\n}\n\n// TODO (v8): We need to obtain profile ids in @sentry-internal/tracing,\n// but we don't have access to this map because importing this map would\n// cause a circular dependency. We need to resolve this in v8.\nconst PROFILE_MAP: Map<string, JSSelfProfile> = new Map();\n/**\n *\n */\nexport function getActiveProfilesCount(): number {\n return PROFILE_MAP.size;\n}\n\n/**\n * Retrieves profile from global cache and removes it.\n */\nexport function takeProfileFromGlobalCache(profile_id: string): JSSelfProfile | undefined {\n const profile = PROFILE_MAP.get(profile_id);\n if (profile) {\n PROFILE_MAP.delete(profile_id);\n }\n return profile;\n}\n/**\n * Adds profile to global cache and evicts the oldest profile if the cache is full.\n */\nexport function addProfileToGlobalCache(profile_id: string, profile: JSSelfProfile): void {\n PROFILE_MAP.set(profile_id, profile);\n\n if (PROFILE_MAP.size > 30) {\n const last = PROFILE_MAP.keys().next().value;\n if (last !== undefined) {\n PROFILE_MAP.delete(last);\n }\n }\n}\n\n/**\n * Attaches the profiled thread information to the event's trace context.\n */\nexport function attachProfiledThreadToEvent(event: Event): Event {\n if (!event?.contexts?.profile) {\n return event;\n }\n\n if (!event.contexts) {\n return event;\n }\n\n // @ts-expect-error the trace fallback value is wrong, though it should never happen\n // and in case it does, we dont want to override whatever was passed initially.\n event.contexts.trace = {\n ...(event.contexts?.trace ?? {}),\n data: {\n ...(event.contexts?.trace?.data ?? {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THREAD_NAME,\n },\n };\n\n // Attach thread info to individual spans so that spans can be associated with the profiled thread on the UI even if contexts are missing.\n event.spans?.forEach(span => {\n span.data = {\n ...(span.data || {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THRE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,CAAA,IAAA,CAAA;AACA,IAAA;AACA,EAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,2BAAA,CAAA,KAAA,EAAA;AACA,EAAA,IAAA,CAAA,KAAA,EAAA,QAAA,EAAA,OAAA,EAAA;AACA,IAAA,OAAA,KAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,KAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,KAAA;AACA,EAAA;;AAEA;AACA;AACA,EAAA,KAAA,CAAA,QAAA,CAAA,KAAA,GAAA;AACA,IAAA,IAAA,KAAA,CAAA,QAAA,EAAA,KAAA,IAAA,EAAA,CAAA;AACA,IAAA,IAAA,EAAA;AACA,MAAA,IAAA,KAAA,CAAA,QAAA,EAAA,KAAA,EAAA,IAAA,IAAA,EAAA,CAAA;AACA,MAAA,CAAA,WAAA,GAAA,yBAAA;AACA,MAAA,CAAA,aAAA,GAAA,oBAAA;AACA,KAAA;AACA,GAAA;;AAEA;AACA,EAAA,KAAA,CAAA,KAAA,EAAA,OAAA,CAAA,IAAA,IAAA;AACA,IAAA,IAAA,CAAA,IAAA,GAAA;AACA,MAAA,IAAA,IAAA,CAAA,IAAA,IAAA,EAAA,CAAA;AACA,MAAA,CAAA,WAAA,GAAA,yBAAA;AACA,MAAA,CAAA,aAAA,GAAA,oBAAA;AACA,KAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,KAAA;AACA;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-dialog.js","sources":["../../../../src/report-dialog.ts"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/core';\nimport { debug, getClient, getCurrentScope, getReportDialogEndpoint, lastEventId } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n const optionalDocument = WINDOW.document as Document | undefined;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && debug.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && debug.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,OAAO,GAAwB,EAAE,EAAQ;AAC1E,EAAE,MAAM,gBAAA,GAAmB,MAAM,CAAC,QAAA;AAClC,EAAE,MAAM,iBAAiB,gBAAgB,EAAE,IAAA,IAAQ,gBAAgB,EAAE,IAAI;;AAEzE;AACA,EAAE,IAAI,CAAC,cAAc,EAAE;AACvB,IAAI,eAAe,KAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC;AAChF,IAAI;AACJ,EAAE;;AAEF,EAAE,MAAM,KAAA,GAAQ,eAAe,EAAE;AACjC,EAAE,MAAM,MAAA,GAAS,SAAS,EAAE;AAC5B,EAAE,MAAM,GAAA,GAAM,MAAM,EAAE,MAAM,EAAE;;AAE9B,EAAE,IAAI,CAAC,GAAG,EAAE;AACZ,IAAI,eAAe,KAAK,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