@sentry/core 10.37.0 → 10.39.0-alpha.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 (296) hide show
  1. package/build/cjs/attributes.js.map +1 -1
  2. package/build/cjs/client.js +22 -12
  3. package/build/cjs/client.js.map +1 -1
  4. package/build/cjs/envelope.js +41 -7
  5. package/build/cjs/envelope.js.map +1 -1
  6. package/build/cjs/index.js +131 -79
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/cjs/integration.js +12 -0
  9. package/build/cjs/integration.js.map +1 -1
  10. package/build/cjs/integrations/captureconsole.js +2 -2
  11. package/build/cjs/integrations/captureconsole.js.map +1 -1
  12. package/build/cjs/integrations/eventFilters.js +1 -1
  13. package/build/cjs/integrations/eventFilters.js.map +1 -1
  14. package/build/cjs/integrations/mcp-server/correlation.js +54 -10
  15. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  16. package/build/cjs/integrations/mcp-server/errorCapture.js +2 -2
  17. package/build/cjs/integrations/mcp-server/errorCapture.js.map +1 -1
  18. package/build/cjs/integrations/mcp-server/sessionManagement.js +50 -16
  19. package/build/cjs/integrations/mcp-server/sessionManagement.js.map +1 -1
  20. package/build/cjs/integrations/requestdata.js +72 -6
  21. package/build/cjs/integrations/requestdata.js.map +1 -1
  22. package/build/cjs/integrations/spanStreaming.js +54 -0
  23. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  24. package/build/cjs/integrations/supabase.js +4 -4
  25. package/build/cjs/integrations/supabase.js.map +1 -1
  26. package/build/cjs/metrics/public-api.js +3 -3
  27. package/build/cjs/metrics/public-api.js.map +1 -1
  28. package/build/cjs/scope.js +1 -1
  29. package/build/cjs/scope.js.map +1 -1
  30. package/build/cjs/semanticAttributes.js +84 -0
  31. package/build/cjs/semanticAttributes.js.map +1 -1
  32. package/build/cjs/spans/captureSpan.js +104 -0
  33. package/build/cjs/spans/captureSpan.js.map +1 -0
  34. package/build/cjs/spans/spanBuffer.js +121 -0
  35. package/build/cjs/spans/spanBuffer.js.map +1 -0
  36. package/build/cjs/spans/spanFirstUtils.js +186 -0
  37. package/build/cjs/spans/spanFirstUtils.js.map +1 -0
  38. package/build/cjs/tracing/ai/gen-ai-attributes.js +6 -0
  39. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  40. package/build/cjs/tracing/anthropic-ai/index.js +3 -3
  41. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  42. package/build/cjs/tracing/anthropic-ai/streaming.js +3 -3
  43. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  44. package/build/cjs/tracing/anthropic-ai/utils.js +2 -2
  45. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  46. package/build/cjs/tracing/google-genai/index.js +3 -3
  47. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  48. package/build/cjs/tracing/google-genai/streaming.js +2 -2
  49. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  50. package/build/cjs/tracing/langchain/index.js +4 -4
  51. package/build/cjs/tracing/langchain/index.js.map +1 -1
  52. package/build/cjs/tracing/langgraph/index.js +3 -3
  53. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  54. package/build/cjs/tracing/openai/index.js +136 -53
  55. package/build/cjs/tracing/openai/index.js.map +1 -1
  56. package/build/cjs/tracing/openai/streaming.js +2 -2
  57. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  58. package/build/cjs/tracing/sentrySpan.js +32 -0
  59. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  60. package/build/cjs/tracing/trace.js +1 -0
  61. package/build/cjs/tracing/trace.js.map +1 -1
  62. package/build/cjs/tracing/vercel-ai/constants.js +4 -0
  63. package/build/cjs/tracing/vercel-ai/constants.js.map +1 -1
  64. package/build/cjs/tracing/vercel-ai/index.js +14 -0
  65. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  66. package/build/cjs/tracing/vercel-ai/utils.js +71 -22
  67. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  68. package/build/cjs/transports/base.js +18 -2
  69. package/build/cjs/transports/base.js.map +1 -1
  70. package/build/cjs/transports/offline.js +16 -17
  71. package/build/cjs/transports/offline.js.map +1 -1
  72. package/build/cjs/trpc.js +3 -3
  73. package/build/cjs/trpc.js.map +1 -1
  74. package/build/cjs/utils/aggregate-errors.js +13 -5
  75. package/build/cjs/utils/aggregate-errors.js.map +1 -1
  76. package/build/cjs/utils/beforeSendSpan.js +36 -0
  77. package/build/cjs/utils/beforeSendSpan.js.map +1 -0
  78. package/build/cjs/utils/envToBool.js +32 -0
  79. package/build/cjs/utils/envToBool.js.map +1 -0
  80. package/build/cjs/utils/exports.js +7 -7
  81. package/build/cjs/utils/exports.js.map +1 -1
  82. package/build/cjs/utils/featureFlags.js +1 -0
  83. package/build/cjs/utils/featureFlags.js.map +1 -1
  84. package/build/cjs/utils/flushIfServerless.js +2 -2
  85. package/build/cjs/utils/flushIfServerless.js.map +1 -1
  86. package/build/cjs/utils/hasSpanStreamingEnabled.js +21 -0
  87. package/build/cjs/utils/hasSpanStreamingEnabled.js.map +1 -0
  88. package/build/cjs/utils/prepareEvent.js +6 -1
  89. package/build/cjs/utils/prepareEvent.js.map +1 -1
  90. package/build/cjs/utils/promisebuffer.js +5 -3
  91. package/build/cjs/utils/promisebuffer.js.map +1 -1
  92. package/build/cjs/utils/scopeData.js +4 -0
  93. package/build/cjs/utils/scopeData.js.map +1 -1
  94. package/build/cjs/utils/sdkMetadata.js +7 -11
  95. package/build/cjs/utils/sdkMetadata.js.map +1 -1
  96. package/build/cjs/utils/should-ignore-span.js +31 -9
  97. package/build/cjs/utils/should-ignore-span.js.map +1 -1
  98. package/build/cjs/utils/spanUtils.js +90 -2
  99. package/build/cjs/utils/spanUtils.js.map +1 -1
  100. package/build/cjs/utils/timer.js +20 -0
  101. package/build/cjs/utils/timer.js.map +1 -0
  102. package/build/cjs/utils/traceData.js +2 -2
  103. package/build/cjs/utils/traceData.js.map +1 -1
  104. package/build/cjs/utils/tracePropagationTargets.js +38 -0
  105. package/build/cjs/utils/tracePropagationTargets.js.map +1 -0
  106. package/build/cjs/utils/version.js +1 -1
  107. package/build/cjs/utils/version.js.map +1 -1
  108. package/build/esm/attributes.js.map +1 -1
  109. package/build/esm/client.js +18 -8
  110. package/build/esm/client.js.map +1 -1
  111. package/build/esm/envelope.js +41 -8
  112. package/build/esm/envelope.js.map +1 -1
  113. package/build/esm/exports.js +2 -2
  114. package/build/esm/feedback.js +1 -1
  115. package/build/esm/index.js +12 -3
  116. package/build/esm/index.js.map +1 -1
  117. package/build/esm/integration.js +12 -1
  118. package/build/esm/integration.js.map +1 -1
  119. package/build/esm/integrations/eventFilters.js +1 -1
  120. package/build/esm/integrations/eventFilters.js.map +1 -1
  121. package/build/esm/integrations/mcp-server/correlation.js +54 -10
  122. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  123. package/build/esm/integrations/mcp-server/sessionManagement.js +50 -16
  124. package/build/esm/integrations/mcp-server/sessionManagement.js.map +1 -1
  125. package/build/esm/integrations/moduleMetadata.js +1 -1
  126. package/build/esm/integrations/requestdata.js +72 -6
  127. package/build/esm/integrations/requestdata.js.map +1 -1
  128. package/build/esm/integrations/spanStreaming.js +52 -0
  129. package/build/esm/integrations/spanStreaming.js.map +1 -0
  130. package/build/esm/integrations/third-party-errors-filter.js +1 -1
  131. package/build/esm/logs/internal.js +1 -1
  132. package/build/esm/metrics/public-api.js +3 -3
  133. package/build/esm/metrics/public-api.js.map +1 -1
  134. package/build/esm/package.json +1 -1
  135. package/build/esm/scope.js +1 -1
  136. package/build/esm/scope.js.map +1 -1
  137. package/build/esm/semanticAttributes.js +57 -1
  138. package/build/esm/semanticAttributes.js.map +1 -1
  139. package/build/esm/spans/captureSpan.js +102 -0
  140. package/build/esm/spans/captureSpan.js.map +1 -0
  141. package/build/esm/spans/spanBuffer.js +119 -0
  142. package/build/esm/spans/spanBuffer.js.map +1 -0
  143. package/build/esm/spans/spanFirstUtils.js +182 -0
  144. package/build/esm/spans/spanFirstUtils.js.map +1 -0
  145. package/build/esm/tracing/ai/gen-ai-attributes.js +6 -1
  146. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  147. package/build/esm/tracing/measurement.js +1 -1
  148. package/build/esm/tracing/openai/index.js +134 -51
  149. package/build/esm/tracing/openai/index.js.map +1 -1
  150. package/build/esm/tracing/sentrySpan.js +33 -1
  151. package/build/esm/tracing/sentrySpan.js.map +1 -1
  152. package/build/esm/tracing/trace.js +4 -3
  153. package/build/esm/tracing/trace.js.map +1 -1
  154. package/build/esm/tracing/vercel-ai/constants.js +4 -1
  155. package/build/esm/tracing/vercel-ai/constants.js.map +1 -1
  156. package/build/esm/tracing/vercel-ai/index.js +15 -1
  157. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  158. package/build/esm/tracing/vercel-ai/utils.js +73 -24
  159. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  160. package/build/esm/transports/base.js +18 -2
  161. package/build/esm/transports/base.js.map +1 -1
  162. package/build/esm/transports/offline.js +16 -17
  163. package/build/esm/transports/offline.js.map +1 -1
  164. package/build/esm/utils/aggregate-errors.js +13 -5
  165. package/build/esm/utils/aggregate-errors.js.map +1 -1
  166. package/build/esm/utils/beforeSendSpan.js +33 -0
  167. package/build/esm/utils/beforeSendSpan.js.map +1 -0
  168. package/build/esm/utils/envToBool.js +28 -0
  169. package/build/esm/utils/envToBool.js.map +1 -0
  170. package/build/esm/utils/exports.js +7 -7
  171. package/build/esm/utils/exports.js.map +1 -1
  172. package/build/esm/utils/featureFlags.js +1 -0
  173. package/build/esm/utils/featureFlags.js.map +1 -1
  174. package/build/esm/utils/flushIfServerless.js.map +1 -1
  175. package/build/esm/utils/hasSpanStreamingEnabled.js +19 -0
  176. package/build/esm/utils/hasSpanStreamingEnabled.js.map +1 -0
  177. package/build/esm/utils/prepareEvent.js +6 -1
  178. package/build/esm/utils/prepareEvent.js.map +1 -1
  179. package/build/esm/utils/promisebuffer.js +5 -3
  180. package/build/esm/utils/promisebuffer.js.map +1 -1
  181. package/build/esm/utils/scopeData.js +4 -0
  182. package/build/esm/utils/scopeData.js.map +1 -1
  183. package/build/esm/utils/sdkMetadata.js +7 -11
  184. package/build/esm/utils/sdkMetadata.js.map +1 -1
  185. package/build/esm/utils/should-ignore-span.js +31 -9
  186. package/build/esm/utils/should-ignore-span.js.map +1 -1
  187. package/build/esm/utils/spanUtils.js +87 -3
  188. package/build/esm/utils/spanUtils.js.map +1 -1
  189. package/build/esm/utils/timer.js +18 -0
  190. package/build/esm/utils/timer.js.map +1 -0
  191. package/build/esm/utils/tracePropagationTargets.js +36 -0
  192. package/build/esm/utils/tracePropagationTargets.js.map +1 -0
  193. package/build/esm/utils/version.js +1 -1
  194. package/build/esm/utils/version.js.map +1 -1
  195. package/build/types/attributes.d.ts +1 -1
  196. package/build/types/attributes.d.ts.map +1 -1
  197. package/build/types/client.d.ts +40 -2
  198. package/build/types/client.d.ts.map +1 -1
  199. package/build/types/envelope.d.ts +6 -1
  200. package/build/types/envelope.d.ts.map +1 -1
  201. package/build/types/index.d.ts +13 -4
  202. package/build/types/index.d.ts.map +1 -1
  203. package/build/types/integration.d.ts +4 -0
  204. package/build/types/integration.d.ts.map +1 -1
  205. package/build/types/integrations/mcp-server/correlation.d.ts +6 -2
  206. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  207. package/build/types/integrations/mcp-server/sessionManagement.d.ts +8 -2
  208. package/build/types/integrations/mcp-server/sessionManagement.d.ts.map +1 -1
  209. package/build/types/integrations/requestdata.d.ts.map +1 -1
  210. package/build/types/integrations/spanStreaming.d.ts +11 -0
  211. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  212. package/build/types/metrics/public-api.d.ts +3 -3
  213. package/build/types/semanticAttributes.d.ts +38 -0
  214. package/build/types/semanticAttributes.d.ts.map +1 -1
  215. package/build/types/spans/captureSpan.d.ts +10 -0
  216. package/build/types/spans/captureSpan.d.ts.map +1 -0
  217. package/build/types/spans/spanBuffer.d.ts +35 -0
  218. package/build/types/spans/spanBuffer.d.ts.map +1 -0
  219. package/build/types/spans/spanFirstUtils.d.ts +20 -0
  220. package/build/types/spans/spanFirstUtils.d.ts.map +1 -0
  221. package/build/types/tracing/ai/gen-ai-attributes.d.ts +4 -0
  222. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  223. package/build/types/tracing/openai/index.d.ts.map +1 -1
  224. package/build/types/tracing/sentrySpan.d.ts +10 -1
  225. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  226. package/build/types/tracing/vercel-ai/constants.d.ts +1 -0
  227. package/build/types/tracing/vercel-ai/constants.d.ts.map +1 -1
  228. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  229. package/build/types/tracing/vercel-ai/utils.d.ts +2 -2
  230. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  231. package/build/types/transports/base.d.ts.map +1 -1
  232. package/build/types/transports/offline.d.ts.map +1 -1
  233. package/build/types/types-hoist/attributes.d.ts +19 -0
  234. package/build/types/types-hoist/attributes.d.ts.map +1 -0
  235. package/build/types/types-hoist/envelope.d.ts +22 -2
  236. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  237. package/build/types/types-hoist/feedback/index.d.ts.map +1 -1
  238. package/build/types/types-hoist/integration.d.ts +7 -0
  239. package/build/types/types-hoist/integration.d.ts.map +1 -1
  240. package/build/types/types-hoist/link.d.ts +2 -2
  241. package/build/types/types-hoist/link.d.ts.map +1 -1
  242. package/build/types/types-hoist/options.d.ts +18 -2
  243. package/build/types/types-hoist/options.d.ts.map +1 -1
  244. package/build/types/types-hoist/span.d.ts +27 -0
  245. package/build/types/types-hoist/span.d.ts.map +1 -1
  246. package/build/types/utils/beforeSendSpan.d.ts +22 -0
  247. package/build/types/utils/beforeSendSpan.d.ts.map +1 -0
  248. package/build/types/utils/envToBool.d.ts +13 -0
  249. package/build/types/utils/envToBool.d.ts.map +1 -0
  250. package/build/types/utils/featureFlags.d.ts.map +1 -1
  251. package/build/types/utils/flushIfServerless.d.ts.map +1 -1
  252. package/build/types/utils/hasSpanStreamingEnabled.d.ts +9 -0
  253. package/build/types/utils/hasSpanStreamingEnabled.d.ts.map +1 -0
  254. package/build/types/utils/prepareEvent.d.ts.map +1 -1
  255. package/build/types/utils/promisebuffer.d.ts.map +1 -1
  256. package/build/types/utils/scopeData.d.ts.map +1 -1
  257. package/build/types/utils/sdkMetadata.d.ts.map +1 -1
  258. package/build/types/utils/should-ignore-span.d.ts +3 -3
  259. package/build/types/utils/should-ignore-span.d.ts.map +1 -1
  260. package/build/types/utils/spanUtils.d.ts +22 -2
  261. package/build/types/utils/spanUtils.d.ts.map +1 -1
  262. package/build/types/utils/timer.d.ts +11 -0
  263. package/build/types/utils/timer.d.ts.map +1 -0
  264. package/build/types/utils/tracePropagationTargets.d.ts +9 -0
  265. package/build/types/utils/tracePropagationTargets.d.ts.map +1 -0
  266. package/build/types-ts3.8/attributes.d.ts +1 -1
  267. package/build/types-ts3.8/client.d.ts +40 -2
  268. package/build/types-ts3.8/envelope.d.ts +6 -1
  269. package/build/types-ts3.8/index.d.ts +13 -4
  270. package/build/types-ts3.8/integration.d.ts +4 -0
  271. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +6 -2
  272. package/build/types-ts3.8/integrations/mcp-server/sessionManagement.d.ts +8 -2
  273. package/build/types-ts3.8/integrations/spanStreaming.d.ts +11 -0
  274. package/build/types-ts3.8/metrics/public-api.d.ts +3 -3
  275. package/build/types-ts3.8/semanticAttributes.d.ts +38 -0
  276. package/build/types-ts3.8/spans/captureSpan.d.ts +10 -0
  277. package/build/types-ts3.8/spans/spanBuffer.d.ts +35 -0
  278. package/build/types-ts3.8/spans/spanFirstUtils.d.ts +20 -0
  279. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +4 -0
  280. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  281. package/build/types-ts3.8/tracing/vercel-ai/constants.d.ts +1 -0
  282. package/build/types-ts3.8/tracing/vercel-ai/utils.d.ts +2 -2
  283. package/build/types-ts3.8/types-hoist/attributes.d.ts +19 -0
  284. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  285. package/build/types-ts3.8/types-hoist/integration.d.ts +7 -0
  286. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  287. package/build/types-ts3.8/types-hoist/options.d.ts +18 -2
  288. package/build/types-ts3.8/types-hoist/span.d.ts +27 -0
  289. package/build/types-ts3.8/utils/beforeSendSpan.d.ts +22 -0
  290. package/build/types-ts3.8/utils/envToBool.d.ts +13 -0
  291. package/build/types-ts3.8/utils/hasSpanStreamingEnabled.d.ts +9 -0
  292. package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
  293. package/build/types-ts3.8/utils/spanUtils.d.ts +22 -2
  294. package/build/types-ts3.8/utils/timer.d.ts +11 -0
  295. package/build/types-ts3.8/utils/tracePropagationTargets.d.ts +9 -0
  296. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"spanUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/spanUtils.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAc,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAS5D,eAAO,MAAM,eAAe,IAAM,CAAC;AACnC,eAAO,MAAM,kBAAkB,IAAM,CAAC;AAItC;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CActE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAe3D;AAED;;GAE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;AAE1C,KAAK,yBAAyB,GAAG,IAAI,GAAG;IACtC,CAAC,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAazF;AAED,kDAAkD;AAClD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAI9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,EAAE,CAoB1E;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,gCAA0B,CAAC;AAEnD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAE7E;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,GAAG,SAAS,CAQhD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAU1C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAM7D"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Calls `unref` on a timer, if the method is available on @param timer.
3
+ *
4
+ * `unref()` is used to allow processes to exit immediately, even if the timer
5
+ * is still running and hasn't resolved yet.
6
+ *
7
+ * Use this in places where code can run on browser or server, since browsers
8
+ * do not support `unref`.
9
+ */
10
+ export declare function safeUnref(timer: ReturnType<typeof setTimeout>): ReturnType<typeof setTimeout>;
11
+ //# sourceMappingURL=timer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../../src/utils/timer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAK7F"}
@@ -0,0 +1,9 @@
1
+ import type { CoreOptions as Options } from '../types-hoist/options';
2
+ import type { LRUMap } from './lru';
3
+ /**
4
+ * Check if a given URL should be propagated to or not.
5
+ * If no url is defined, or no trace propagation targets are defined, this will always return `true`.
6
+ * You can also optionally provide a decision map, to cache decisions and avoid repeated regex lookups.
7
+ */
8
+ export declare function shouldPropagateTraceForUrl(url: string | undefined, tracePropagationTargets: Options['tracePropagationTargets'], decisionMap?: LRUMap<string, boolean>): boolean;
9
+ //# sourceMappingURL=tracePropagationTargets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracePropagationTargets.d.ts","sourceRoot":"","sources":["../../../src/utils/tracePropagationTargets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAMpC;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,uBAAuB,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAC3D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,OAAO,CAgBT"}
@@ -30,7 +30,7 @@ export type AttributeObject = {
30
30
  value: unknown;
31
31
  unit?: AttributeUnit;
32
32
  };
33
- type AttributeUnit = DurationUnit | InformationUnit | FractionUnit;
33
+ export type AttributeUnit = DurationUnit | InformationUnit | FractionUnit;
34
34
  export type ValidatedAttributes<T> = {
35
35
  [K in keyof T]: T[K] extends {
36
36
  value: any;
@@ -1,5 +1,5 @@
1
1
  import { IntegrationIndex } from './integration';
2
- import { Scope } from './scope';
2
+ import { Scope, ScopeData } from './scope';
3
3
  import { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types-hoist/breadcrumb';
4
4
  import { CheckIn, MonitorConfig } from './types-hoist/checkin';
5
5
  import { EventDropReason, Outcome } from './types-hoist/clientreport';
@@ -18,7 +18,7 @@ import { RequestEventData } from './types-hoist/request';
18
18
  import { SdkMetadata } from './types-hoist/sdkmetadata';
19
19
  import { Session, SessionAggregates } from './types-hoist/session';
20
20
  import { SeverityLevel } from './types-hoist/severity';
21
- import { Span, SpanAttributes, SpanContextData } from './types-hoist/span';
21
+ import { Span, SpanAttributes, SpanContextData, SpanV2JSON, SpanV2JSONWithSegmentRef } from './types-hoist/span';
22
22
  import { StartSpanOptions } from './types-hoist/startSpanOptions';
23
23
  import { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
24
24
  /**
@@ -207,6 +207,30 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
207
207
  * @returns {() => void} A function that, when executed, removes the registered callback.
208
208
  */
209
209
  on(hook: 'spanEnd', callback: (span: Span) => void): () => void;
210
+ /**
211
+ * Register a callback for after a span is ended.
212
+ */
213
+ on(hook: 'afterSpanEnd', callback: (span: Span) => void): () => void;
214
+ /**
215
+ * Register a callback for after a segment span is ended.
216
+ */
217
+ on(hook: 'afterSegmentSpanEnd', callback: (span: Span) => void): () => void;
218
+ /**
219
+ * Register a callback for when the span JSON is ready to be enqueued into the span buffer.
220
+ */
221
+ on(hook: 'enqueueSpan', callback: (spanJSON: SpanV2JSONWithSegmentRef) => void): () => void;
222
+ /**
223
+ * Register a callback for when a span JSON is processed, to add some data to the span JSON.
224
+ */
225
+ on(hook: 'processSpan', callback: (spanJSON: SpanV2JSON, hint: {
226
+ readOnlySpan: Span;
227
+ }) => void): () => void;
228
+ /**
229
+ * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.
230
+ */
231
+ on(hook: 'processSegmentSpan', callback: (spanJSON: SpanV2JSON, hint: {
232
+ scopeData: ScopeData;
233
+ }) => void): () => void;
210
234
  /**
211
235
  * Register a callback for when an idle span is allowed to auto-finish.
212
236
  * @returns {() => void} A function that, when executed, removes the registered callback.
@@ -402,6 +426,20 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
402
426
  }): void;
403
427
  /** Fire a hook whenever a span ends. */
404
428
  emit(hook: 'spanEnd', span: Span): void;
429
+ /** Fire a hook after the `spanEnd` hook */
430
+ emit(hook: 'afterSpanEnd', span: Span): void;
431
+ /** Fire a hook after a span is processed, to add some attributes to the span JSON. */
432
+ emit(hook: 'processSpan', spanJSON: SpanV2JSON, hint: {
433
+ readOnlySpan: Span;
434
+ }): void;
435
+ /** Fire a hook after a span is processed, to add some attributes to the span JSON. */
436
+ emit(hook: 'processSegmentSpan', spanJSON: SpanV2JSON, hint: {
437
+ scopeData: ScopeData;
438
+ }): void;
439
+ /** Fire a hook after the `segmentSpanEnd` hook is fired. */
440
+ emit(hook: 'afterSegmentSpanEnd', span: Span): void;
441
+ /** Fire a hook after a span ready to be enqueued into the span buffer. */
442
+ emit(hook: 'enqueueSpan', spanJSON: SpanV2JSONWithSegmentRef): void;
405
443
  /**
406
444
  * Fire a hook indicating that an idle span is allowed to auto finish.
407
445
  */
@@ -2,11 +2,12 @@ import { Client } from './client';
2
2
  import { SentrySpan } from './tracing/sentrySpan';
3
3
  import { LegacyCSPReport } from './types-hoist/csp';
4
4
  import { DsnComponents } from './types-hoist/dsn';
5
- import { EventEnvelope, RawSecurityEnvelope, SessionEnvelope, SpanEnvelope } from './types-hoist/envelope';
5
+ import { DynamicSamplingContext, EventEnvelope, RawSecurityEnvelope, SessionEnvelope, SpanEnvelope, SpanV2Envelope } from './types-hoist/envelope';
6
6
  import { Event } from './types-hoist/event';
7
7
  import { SdkInfo } from './types-hoist/sdkinfo';
8
8
  import { SdkMetadata } from './types-hoist/sdkmetadata';
9
9
  import { Session, SessionAggregates } from './types-hoist/session';
10
+ import { SpanV2JSON } from './types-hoist/span';
10
11
  /**
11
12
  * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.
12
13
  * Merge with existing data if any.
@@ -29,6 +30,10 @@ export declare function createSpanEnvelope(spans: [
29
30
  SentrySpan,
30
31
  ...SentrySpan[]
31
32
  ], client?: Client): SpanEnvelope;
33
+ /**
34
+ * Creates a span v2 envelope
35
+ */
36
+ export declare function createSpanV2Envelope(serializedSpans: SpanV2JSON[], dsc: Partial<DynamicSamplingContext>, client: Client): SpanV2Envelope;
32
37
  /**
33
38
  * Create an Envelope from a CSP report.
34
39
  */
@@ -6,7 +6,7 @@ export { ServerRuntimeClientOptions } from './server-runtime-client';
6
6
  export { IntegrationIndex } from './integration';
7
7
  export * from './tracing';
8
8
  export * from './semanticAttributes';
9
- export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope';
9
+ export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope, createSpanV2Envelope } from './envelope';
10
10
  export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports';
11
11
  export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, } from './currentScopes';
12
12
  export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes';
@@ -25,21 +25,27 @@ export { makeOfflineTransport } from './transports/offline';
25
25
  export { makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY } from './transports/multiplexed';
26
26
  export { getIntegrationsToSetup, addIntegration, defineIntegration, installedIntegrations } from './integration';
27
27
  export { _INTERNAL_skipAiProviderWrapping, _INTERNAL_shouldSkipAiProviderWrapping, _INTERNAL_clearAiProviderSkips, } from './utils/ai/providerSkip';
28
+ export { envToBool } from './utils/envToBool';
28
29
  export { applyScopeDataToEvent, mergeScopeData, getCombinedScopeData } from './utils/scopeData';
29
30
  export { prepareEvent } from './utils/prepareEvent';
30
31
  export { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
31
32
  export { createCheckInEnvelope } from './checkin';
32
33
  export { hasSpansEnabled } from './utils/hasSpansEnabled';
34
+ export { hasSpanStreamingEnabled } from './utils/hasSpanStreamingEnabled';
33
35
  export { isSentryRequestUrl } from './utils/isSentryRequestUrl';
34
36
  export { handleCallbackErrors } from './utils/handleCallbackErrors';
35
37
  export { parameterize, fmt } from './utils/parameterize';
36
38
  export { addAutoIpAddressToSession } from './utils/ipAddress';
37
39
  export { addAutoIpAddressToUser } from './utils/ipAddress';
38
- export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, } from './utils/spanUtils';
40
+ export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, INTERNAL_getSegmentSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, spanToV2JSON, showSpanDropWarning, } from './utils/spanUtils';
41
+ export { captureSpan } from './spans/captureSpan';
42
+ export { safeSetSpanJSONAttributes } from './spans/spanFirstUtils';
43
+ export { SpanBuffer, SpanBufferOptions } from './spans/spanBuffer';
39
44
  export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope';
40
45
  export { parseSampleRate } from './utils/parseSampleRate';
41
46
  export { applySdkMetadata } from './utils/sdkMetadata';
42
47
  export { getTraceData } from './utils/traceData';
48
+ export { shouldPropagateTraceForUrl } from './utils/tracePropagationTargets';
43
49
  export { getTraceMetaTags } from './utils/meta';
44
50
  export { debounce } from './utils/debounce';
45
51
  export { winterCGHeadersToDict, winterCGRequestToRequestData, httpRequestToRequestData, extractQueryParamsFromUrl, headersToDict, httpHeadersToSpanAttributes, } from './utils/request';
@@ -62,6 +68,7 @@ export { consoleIntegration } from './integrations/console';
62
68
  export { featureFlagsIntegration, FeatureFlagsIntegration } from './integrations/featureFlags';
63
69
  export { growthbookIntegration } from './integrations/featureFlags';
64
70
  export { conversationIdIntegration } from './integrations/conversationId';
71
+ export { spanStreamingIntegration } from './integrations/spanStreaming';
65
72
  export { profiler } from './profiling';
66
73
  export { instrumentFetchRequest } from './fetch';
67
74
  export { trpcMiddleware } from './trpc';
@@ -147,6 +154,8 @@ export { SDK_VERSION } from './utils/version';
147
154
  export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids';
148
155
  export { getFilenameToMetadataMap } from './metadata';
149
156
  export { escapeStringForRegex } from './vendor/escapeStringForRegex';
157
+ export { isV2BeforeSendSpanCallback, withStreamSpan } from './utils/beforeSendSpan';
158
+ export { shouldIgnoreSpan, reparentChildSpans } from './utils/should-ignore-span';
150
159
  export { Attachment } from './types-hoist/attachment';
151
160
  export { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, XhrBreadcrumbData, FetchBreadcrumbHint, XhrBreadcrumbHint, } from './types-hoist/breadcrumb';
152
161
  export { ClientReport, Outcome, EventDropReason } from './types-hoist/clientreport';
@@ -154,7 +163,7 @@ export { Context, Contexts, DeviceContext, OsContext, AppContext, CultureContext
154
163
  export { DataCategory } from './types-hoist/datacategory';
155
164
  export { DsnComponents, DsnLike, DsnProtocol } from './types-hoist/dsn';
156
165
  export { DebugImage, DebugMeta } from './types-hoist/debugMeta';
157
- export { AttachmentItem, BaseEnvelopeHeaders, BaseEnvelopeItemHeaders, ClientReportEnvelope, ClientReportItem, DynamicSamplingContext, Envelope, EnvelopeItemType, EnvelopeItem, EventEnvelope, EventEnvelopeHeaders, EventItem, ReplayEnvelope, FeedbackItem, SessionEnvelope, SessionItem, UserFeedbackItem, CheckInItem, CheckInEnvelope, RawSecurityEnvelope, RawSecurityItem, ProfileItem, ProfileChunkEnvelope, ProfileChunkItem, SpanEnvelope, SpanItem, LogEnvelope, MetricEnvelope, } from './types-hoist/envelope';
166
+ export { AttachmentItem, BaseEnvelopeHeaders, BaseEnvelopeItemHeaders, ClientReportEnvelope, ClientReportItem, DynamicSamplingContext, Envelope, EnvelopeItemType, EnvelopeItem, EventEnvelope, EventEnvelopeHeaders, EventItem, ReplayEnvelope, FeedbackItem, SessionEnvelope, SessionItem, UserFeedbackItem, CheckInItem, CheckInEnvelope, RawSecurityEnvelope, RawSecurityItem, ProfileItem, ProfileChunkEnvelope, ProfileChunkItem, SpanEnvelope, SpanV2Envelope, SpanItem, LogEnvelope, MetricEnvelope, } from './types-hoist/envelope';
158
167
  export { ExtendedError } from './types-hoist/error';
159
168
  export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types-hoist/event';
160
169
  export { EventProcessor } from './types-hoist/eventprocessor';
@@ -175,7 +184,7 @@ export { SdkInfo } from './types-hoist/sdkinfo';
175
184
  export { SdkMetadata } from './types-hoist/sdkmetadata';
176
185
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, SerializedSession, } from './types-hoist/session';
177
186
  export { SeverityLevel } from './types-hoist/severity';
178
- export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, } from './types-hoist/span';
187
+ export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, SpanV2JSON, SpanV2JSONWithSegmentRef, SerializedSpanContainer, } from './types-hoist/span';
179
188
  export { SpanStatus } from './types-hoist/spanStatus';
180
189
  export { Log, LogSeverityLevel } from './types-hoist/log';
181
190
  export { Metric, MetricType, SerializedMetric, SerializedMetricContainer, SerializedMetricAttributeValue, } from './types-hoist/metric';
@@ -15,6 +15,10 @@ export declare function getIntegrationsToSetup(options: Pick<CoreOptions, 'defau
15
15
  * @param withDefault should enable default integrations
16
16
  */
17
17
  export declare function setupIntegrations(client: Client, integrations: Integration[]): IntegrationIndex;
18
+ /**
19
+ * Runs the `beforeSetup` hooks of the given integrations on the given client.
20
+ */
21
+ export declare function beforeSetupIntegrations(client: Client, integrations: Integration[]): void;
18
22
  /**
19
23
  * Execute the `afterAllSetup` hooks of the given integrations.
20
24
  */
@@ -2,8 +2,12 @@
2
2
  * Request-span correlation system for MCP server instrumentation
3
3
  *
4
4
  * Handles mapping requestId to span data for correlation with handler execution.
5
- * Uses WeakMap to scope correlation maps per transport instance, preventing
6
- * request ID collisions between different MCP sessions.
5
+ *
6
+ * Uses sessionId as the primary key for stateful transports. This handles the wrapper
7
+ * transport pattern (e.g., NodeStreamableHTTPServerTransport wrapping WebStandardStreamableHTTPServerTransport)
8
+ * where onmessage and send may receive different `this` values but share the same sessionId.
9
+ *
10
+ * Falls back to WeakMap by transport instance for stateless transports (no sessionId).
7
11
  */
8
12
  import { Span } from '../../types-hoist/span';
9
13
  import { MCPTransport, RequestId, ResolvedMcpOptions } from './types';
@@ -1,15 +1,21 @@
1
1
  /**
2
2
  * Session data management for MCP server instrumentation
3
+ *
4
+ * Uses sessionId as the primary key for stateful transports. This handles the wrapper
5
+ * transport pattern (e.g., NodeStreamableHTTPServerTransport wrapping WebStandardStreamableHTTPServerTransport)
6
+ * where different methods may receive different `this` values but share the same sessionId.
7
+ *
8
+ * Falls back to WeakMap by transport instance for stateless transports (no sessionId).
3
9
  */
4
10
  import { MCPTransport, PartyInfo, SessionData } from './types';
5
11
  /**
6
- * Stores session data for a transport with sessionId
12
+ * Stores session data for a transport
7
13
  * @param transport - MCP transport instance
8
14
  * @param sessionData - Session data to store
9
15
  */
10
16
  export declare function storeSessionDataForTransport(transport: MCPTransport, sessionData: SessionData): void;
11
17
  /**
12
- * Updates session data for a transport with sessionId (merges with existing data)
18
+ * Updates session data for a transport (merges with existing data)
13
19
  * @param transport - MCP transport instance
14
20
  * @param partialSessionData - Partial session data to merge with existing data
15
21
  */
@@ -0,0 +1,11 @@
1
+ export interface ServerSpanStreamingOptions {
2
+ /** Max spans per envelope batch (default: 1000) */
3
+ maxSpanLimit?: number;
4
+ /** Flush interval in ms (default: 5000) */
5
+ flushInterval?: number;
6
+ }
7
+ /**
8
+ * Span streaming integration used by server runtime SDKs.
9
+ */
10
+ export declare const spanStreamingIntegration: (options?: ServerSpanStreamingOptions | undefined) => import("../types-hoist/integration").Integration;
11
+ //# sourceMappingURL=spanStreaming.d.ts.map
@@ -18,7 +18,7 @@ export interface MetricOptions {
18
18
  scope?: Scope;
19
19
  }
20
20
  /**
21
- * @summary Increment a counter metric. Requires the `_experiments.enableMetrics` option to be enabled.
21
+ * @summary Increment a counter metric.
22
22
  *
23
23
  * @param name - The name of the counter metric.
24
24
  * @param value - The value to increment by (defaults to 1).
@@ -49,7 +49,7 @@ export interface MetricOptions {
49
49
  */
50
50
  export declare function count(name: string, value?: number, options?: MetricOptions): void;
51
51
  /**
52
- * @summary Set a gauge metric to a specific value. Requires the `_experiments.enableMetrics` option to be enabled.
52
+ * @summary Set a gauge metric to a specific value.
53
53
  *
54
54
  * @param name - The name of the gauge metric.
55
55
  * @param value - The current value of the gauge.
@@ -80,7 +80,7 @@ export declare function count(name: string, value?: number, options?: MetricOpti
80
80
  */
81
81
  export declare function gauge(name: string, value: number, options?: MetricOptions): void;
82
82
  /**
83
- * @summary Record a value in a distribution metric. Requires the `_experiments.enableMetrics` option to be enabled.
83
+ * @summary Record a value in a distribution metric.
84
84
  *
85
85
  * @param name - The name of the distribution metric.
86
86
  * @param value - The value to record in the distribution.
@@ -4,6 +4,7 @@
4
4
  *
5
5
  */
6
6
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source";
7
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SPAN_SOURCE = "sentry.span.source";
7
8
  /**
8
9
  * Attributes that holds the sample rate that was locally applied to a span.
9
10
  * If this attribute is not defined, it means that the span inherited a sampling decision.
@@ -50,7 +51,9 @@ export declare const SEMANTIC_ATTRIBUTE_CACHE_KEY = "cache.key";
50
51
  export declare const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size";
51
52
  /** TODO: Remove these once we update to latest semantic conventions */
52
53
  export declare const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = "http.request.method";
54
+ export declare const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_TIME_TO_FIRST_BYTE = "http.request.time_to_first_byte";
53
55
  export declare const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full";
56
+ export declare const SEMANTIC_ATTRIBUTE_URL_QUERY = "url.query";
54
57
  /**
55
58
  * A span link attribute to mark the link as a special span link.
56
59
  *
@@ -75,4 +78,39 @@ export declare const SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = "sentry.link.type";
75
78
  * For LangGraph: configurable.thread_id
76
79
  */
77
80
  export declare const GEN_AI_CONVERSATION_ID_ATTRIBUTE = "gen_ai.conversation.id";
81
+ /** The release version of the application */
82
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = "sentry.release";
83
+ /** The environment name (e.g., "production", "staging", "development") */
84
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = "sentry.environment";
85
+ /** The segment name (e.g., "GET /users") */
86
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = "sentry.segment.name";
87
+ /** The id of the segment that this span belongs to. */
88
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = "sentry.segment.id";
89
+ /** The user ID (gated by sendDefaultPii) */
90
+ export declare const SEMANTIC_ATTRIBUTE_USER_ID = "user.id";
91
+ /** The user email (gated by sendDefaultPii) */
92
+ export declare const SEMANTIC_ATTRIBUTE_USER_EMAIL = "user.email";
93
+ /** The user IP address (gated by sendDefaultPii) */
94
+ export declare const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = "user.ip_address";
95
+ /** The user username (gated by sendDefaultPii) */
96
+ export declare const SEMANTIC_ATTRIBUTE_USER_USERNAME = "user.name";
97
+ /** The name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") */
98
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = "sentry.sdk.name";
99
+ /** The version of the Sentry SDK */
100
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = "sentry.sdk.version";
101
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_VALUE = "browser.web_vital.lcp.value";
102
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ELEMENT = "browser.web_vital.lcp.element";
103
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ID = "browser.web_vital.lcp.id";
104
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_URL = "browser.web_vital.lcp.url";
105
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_LOAD_TIME = "browser.web_vital.lcp.load_time";
106
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_RENDER_TIME = "browser.web_vital.lcp.render_time";
107
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_SIZE = "browser.web_vital.lcp.size";
108
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_VALUE = "browser.web_vital.cls.value";
109
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_SOURCES = "browser.web_vital.cls.source";
110
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_INP_VALUE = "browser.web_vital.inp.value";
111
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_VALUE = "browser.web_vital.ttfb.value";
112
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_REQUEST_TIME = "browser.web_vital.ttfb.request_time";
113
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_FP_VALUE = "browser.web_vital.fp.value";
114
+ export declare const SEMANTIC_ATTRIBUTE_WEB_VITAL_FCP_VALUE = "browser.web_vital.fcp.value";
115
+ export declare const SEMANTIC_ATTRIBUTE_BROWSER_CONNECTION_RTT = "browser.connection.rtt";
78
116
  //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Client } from '../client';
2
+ import { Span } from '../types-hoist/span';
3
+ /**
4
+ * Captures a span and returns a JSON representation to be enqueued for sending.
5
+ *
6
+ * IMPORTANT: This function converts the span to JSON immediately to avoid writing
7
+ * to an already-ended OTel span instance (which is blocked by the OTel Span class).
8
+ */
9
+ export declare function captureSpan(span: Span, client?: Client<import("..").ClientOptions<import("..").BaseTransportOptions>> | undefined): void;
10
+ //# sourceMappingURL=captureSpan.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { Client } from '../client';
2
+ import { SpanV2JSONWithSegmentRef } from '../types-hoist/span';
3
+ export interface SpanBufferOptions {
4
+ /** Max spans per trace before auto-flush (default: 1000) */
5
+ maxSpanLimit?: number;
6
+ /** Flush interval in ms (default: 5000) */
7
+ flushInterval?: number;
8
+ }
9
+ /**
10
+ * A buffer for span JSON objects that flushes them to Sentry in Span v2 envelopes.
11
+ * Handles interval-based flushing, size thresholds, and graceful shutdown.
12
+ */
13
+ export declare class SpanBuffer {
14
+ private _spanTreeMap;
15
+ private _flushIntervalId;
16
+ private _client;
17
+ private _maxSpanLimit;
18
+ private _flushInterval;
19
+ constructor(client: Client, options?: SpanBufferOptions);
20
+ /**
21
+ * Add a span to the buffer.
22
+ */
23
+ addSpan(spanJSON: SpanV2JSONWithSegmentRef): void;
24
+ /**
25
+ * Flush all buffered traces.
26
+ */
27
+ flush(): void;
28
+ /**
29
+ * Flush spans of a specific trace.
30
+ * In contrast to {@link SpanBuffer.flush}, this method does not flush all traces, but only the one with the given traceId.
31
+ */
32
+ flushTrace(traceId: string): void;
33
+ private _debounceFlushInterval;
34
+ }
35
+ //# sourceMappingURL=spanBuffer.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { RawAttributes } from '../attributes';
2
+ import { Contexts } from '../types-hoist/context';
3
+ import { SpanV2JSON } from '../types-hoist/span';
4
+ /**
5
+ * Only set a span JSON attribute if it is not already set.
6
+ * This is used to safely set attributes on JSON objects without mutating already-ended span instances.
7
+ */
8
+ export declare function safeSetSpanJSONAttributes(spanJSON: SpanV2JSON, newAttributes: RawAttributes<Record<string, unknown>>): void;
9
+ /**
10
+ * Apply a user-provided beforeSendSpan callback to a span JSON.
11
+ */
12
+ export declare function applyBeforeSendSpanCallback(span: SpanV2JSON, beforeSendSpan: (span: SpanV2JSON) => SpanV2JSON): SpanV2JSON;
13
+ /**
14
+ * Converts a context object to a set of attributes.
15
+ * Only includes attributes that are primitives (for now).
16
+ * @param contexts - The context object to convert.
17
+ * @returns The attributes object.
18
+ */
19
+ export declare function contextsToAttributes(contexts: Contexts): RawAttributes<Record<string, unknown>>;
20
+ //# sourceMappingURL=spanFirstUtils.d.ts.map
@@ -186,6 +186,10 @@ export declare const GEN_AI_EMBED_DO_EMBED_OPERATION_ATTRIBUTE = "gen_ai.embed";
186
186
  * The span operation name for embedding many
187
187
  */
188
188
  export declare const GEN_AI_EMBED_MANY_DO_EMBED_OPERATION_ATTRIBUTE = "gen_ai.embed_many";
189
+ /**
190
+ * The span operation name for reranking
191
+ */
192
+ export declare const GEN_AI_RERANK_DO_RERANK_OPERATION_ATTRIBUTE = "gen_ai.rerank";
189
193
  /**
190
194
  * The span operation name for executing a tool
191
195
  */
@@ -1,5 +1,5 @@
1
1
  import { SpanLink } from '../types-hoist/link';
2
- import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput } from '../types-hoist/span';
2
+ import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput, SpanV2JSON } from '../types-hoist/span';
3
3
  import { SpanStatus } from '../types-hoist/spanStatus';
4
4
  import { TimedEvent } from '../types-hoist/timedEvent';
5
5
  /**
@@ -77,6 +77,15 @@ export declare class SentrySpan implements Span {
77
77
  * use `spanToJSON(span)` instead.
78
78
  */
79
79
  getSpanJSON(): SpanJSON;
80
+ /**
81
+ * Get SpanV2JSON representation of this span.
82
+ *
83
+ * @hidden
84
+ * @internal This method is purely for internal purposes and should not be used outside
85
+ * of SDK code. If you need to get a JSON representation of a span,
86
+ * use `spanToV2JSON(span)` instead.
87
+ */
88
+ getSpanV2JSON(): SpanV2JSON;
80
89
  /** @inheritdoc */
81
90
  isRecording(): boolean;
82
91
  /**
@@ -3,4 +3,5 @@ export declare const toolCallSpanMap: Map<string, Span>;
3
3
  export declare const INVOKE_AGENT_OPS: Set<string>;
4
4
  export declare const GENERATE_CONTENT_OPS: Set<string>;
5
5
  export declare const EMBEDDINGS_OPS: Set<string>;
6
+ export declare const RERANK_OPS: Set<string>;
6
7
  //# sourceMappingURL=constants.d.ts.map
@@ -26,9 +26,9 @@ export declare function _INTERNAL_cleanupToolCallSpan(toolCallId: string): void;
26
26
  */
27
27
  export declare function convertAvailableToolsToJsonString(tools: unknown[]): string;
28
28
  /**
29
- * Convert the prompt string to messages array
29
+ * Normalize the user input (stringified object with prompt, system, messages) to messages array
30
30
  */
31
- export declare function convertPromptToMessages(prompt: string): {
31
+ export declare function convertUserInputToMessagesFormat(userInput: string): {
32
32
  role: string;
33
33
  content: string;
34
34
  }[];
@@ -0,0 +1,19 @@
1
+ import { AttributeUnit } from '../attributes';
2
+ export type SerializedAttributes = Record<string, SerializedAttribute>;
3
+ export type SerializedAttribute = ({
4
+ type: 'string';
5
+ value: string;
6
+ } | {
7
+ type: 'integer';
8
+ value: number;
9
+ } | {
10
+ type: 'double';
11
+ value: number;
12
+ } | {
13
+ type: 'boolean';
14
+ value: boolean;
15
+ }) & {
16
+ unit?: AttributeUnit;
17
+ };
18
+ export type SerializedAttributeType = 'string' | 'integer' | 'double' | 'boolean';
19
+ //# sourceMappingURL=attributes.d.ts.map
@@ -11,7 +11,7 @@ import { Profile, ProfileChunk } from './profiling';
11
11
  import { ReplayEvent, ReplayRecordingData } from './replay';
12
12
  import { SdkInfo } from './sdkinfo';
13
13
  import { SerializedSession, SessionAggregates } from './session';
14
- import { SpanJSON } from './span';
14
+ import { SerializedSpanContainer, SpanJSON } from './span';
15
15
  export type DynamicSamplingContext = {
16
16
  trace_id: string;
17
17
  public_key: DsnComponents['publicKey'];
@@ -87,6 +87,21 @@ type ProfileChunkItemHeaders = {
87
87
  type SpanItemHeaders = {
88
88
  type: 'span';
89
89
  };
90
+ type SpanContainerItemHeaders = {
91
+ /**
92
+ * Same as v1 span item type but this envelope is distinguished by {@link SpanContainerItemHeaders.content_type}.
93
+ */
94
+ type: 'span';
95
+ /**
96
+ * The number of span items in the container. This must be the same as the number of span items in the payload.
97
+ */
98
+ item_count: number;
99
+ /**
100
+ * The content type of the span items. This must be `application/vnd.sentry.items.span.v2+json`.
101
+ * (the presence of this field also distinguishes the span item from the v1 span item)
102
+ */
103
+ content_type: 'application/vnd.sentry.items.span.v2+json';
104
+ };
90
105
  type LogContainerItemHeaders = {
91
106
  type: 'log';
92
107
  /**
@@ -120,6 +135,7 @@ export type FeedbackItem = BaseEnvelopeItem<FeedbackItemHeaders, FeedbackEvent>;
120
135
  export type ProfileItem = BaseEnvelopeItem<ProfileItemHeaders, Profile>;
121
136
  export type ProfileChunkItem = BaseEnvelopeItem<ProfileChunkItemHeaders, ProfileChunk>;
122
137
  export type SpanItem = BaseEnvelopeItem<SpanItemHeaders, Partial<SpanJSON>>;
138
+ export type SpanContainerItem = BaseEnvelopeItem<SpanContainerItemHeaders, SerializedSpanContainer>;
123
139
  export type LogContainerItem = BaseEnvelopeItem<LogContainerItemHeaders, SerializedLogContainer>;
124
140
  export type MetricContainerItem = BaseEnvelopeItem<MetricContainerItemHeaders, SerializedMetricContainer>;
125
141
  export type RawSecurityItem = BaseEnvelopeItem<RawSecurityHeaders, LegacyCSPReport>;
@@ -139,6 +155,9 @@ type ReplayEnvelopeHeaders = BaseEnvelopeHeaders;
139
155
  type SpanEnvelopeHeaders = BaseEnvelopeHeaders & {
140
156
  trace?: DynamicSamplingContext;
141
157
  };
158
+ type SpanV2EnvelopeHeaders = BaseEnvelopeHeaders & {
159
+ trace?: DynamicSamplingContext;
160
+ };
142
161
  type LogEnvelopeHeaders = BaseEnvelopeHeaders;
143
162
  type MetricEnvelopeHeaders = BaseEnvelopeHeaders;
144
163
  export type EventEnvelope = BaseEnvelope<EventEnvelopeHeaders, EventItem | AttachmentItem | UserFeedbackItem | FeedbackItem | ProfileItem>;
@@ -153,11 +172,12 @@ export type ReplayEnvelope = [
153
172
  ];
154
173
  export type CheckInEnvelope = BaseEnvelope<CheckInEnvelopeHeaders, CheckInItem>;
155
174
  export type SpanEnvelope = BaseEnvelope<SpanEnvelopeHeaders, SpanItem>;
175
+ export type SpanV2Envelope = BaseEnvelope<SpanV2EnvelopeHeaders, SpanContainerItem>;
156
176
  export type ProfileChunkEnvelope = BaseEnvelope<BaseEnvelopeHeaders, ProfileChunkItem>;
157
177
  export type RawSecurityEnvelope = BaseEnvelope<BaseEnvelopeHeaders, RawSecurityItem>;
158
178
  export type LogEnvelope = BaseEnvelope<LogEnvelopeHeaders, LogContainerItem>;
159
179
  export type MetricEnvelope = BaseEnvelope<MetricEnvelopeHeaders, MetricContainerItem>;
160
- export type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope | ProfileChunkEnvelope | ReplayEnvelope | CheckInEnvelope | SpanEnvelope | RawSecurityEnvelope | LogEnvelope | MetricEnvelope;
180
+ export type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope | ProfileChunkEnvelope | ReplayEnvelope | CheckInEnvelope | SpanEnvelope | SpanV2Envelope | RawSecurityEnvelope | LogEnvelope | MetricEnvelope;
161
181
  export type EnvelopeItem = Envelope[1][number];
162
182
  export {};
163
183
  //# sourceMappingURL=envelope.d.ts.map
@@ -11,6 +11,13 @@ export interface Integration {
11
11
  * It does not receives any arguments, and should only use for e.g. global monkey patching and similar things.
12
12
  */
13
13
  setupOnce?(): void;
14
+ /**
15
+ * This hook is called for all integrations before the `setup` hook.
16
+ * This is useful for integrations that need to e.g. modify client values before other integrations are set up.
17
+ * Use this hook with caution and prefer `setup` whenever possible.
18
+ * @param client
19
+ */
20
+ beforeSetup?(client: Client): void;
14
21
  /**
15
22
  * Set up an integration for the given client.
16
23
  * Receives the client as argument.
@@ -19,11 +19,11 @@ export interface SpanLink {
19
19
  * Link interface for the event envelope item. It's a flattened representation of `SpanLink`.
20
20
  * Can include additional fields defined by OTel.
21
21
  */
22
- export interface SpanLinkJSON extends Record<string, unknown> {
22
+ export interface SpanLinkJSON<TAttributes = SpanLinkAttributes> extends Record<string, unknown> {
23
23
  span_id: string;
24
24
  trace_id: string;
25
25
  sampled?: boolean;
26
- attributes?: SpanLinkAttributes;
26
+ attributes?: TAttributes;
27
27
  }
28
28
  export {};
29
29
  //# sourceMappingURL=link.d.ts.map