@sentry/core 10.46.0 → 10.48.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 (381) hide show
  1. package/build/cjs/api.js +1 -0
  2. package/build/cjs/api.js.map +1 -1
  3. package/build/cjs/attributes.js +43 -0
  4. package/build/cjs/attributes.js.map +1 -1
  5. package/build/cjs/client.js +13 -6
  6. package/build/cjs/client.js.map +1 -1
  7. package/build/cjs/currentScopes.js +33 -0
  8. package/build/cjs/currentScopes.js.map +1 -1
  9. package/build/cjs/envelope.js +4 -3
  10. package/build/cjs/envelope.js.map +1 -1
  11. package/build/cjs/index.js +50 -13
  12. package/build/cjs/index.js.map +1 -1
  13. package/build/cjs/integration.js +6 -0
  14. package/build/cjs/integration.js.map +1 -1
  15. package/build/cjs/integrations/express/index.js +206 -0
  16. package/build/cjs/integrations/express/index.js.map +1 -0
  17. package/build/cjs/integrations/express/patch-layer.js +251 -0
  18. package/build/cjs/integrations/express/patch-layer.js.map +1 -0
  19. package/build/cjs/integrations/express/request-layer-store.js +25 -0
  20. package/build/cjs/integrations/express/request-layer-store.js.map +1 -0
  21. package/build/cjs/integrations/express/set-sdk-processing-metadata.js +17 -0
  22. package/build/cjs/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  23. package/build/cjs/integrations/express/types.js +17 -0
  24. package/build/cjs/integrations/express/types.js.map +1 -0
  25. package/build/cjs/integrations/express/utils.js +238 -0
  26. package/build/cjs/integrations/express/utils.js.map +1 -0
  27. package/build/cjs/integrations/mcp-server/correlation.js +5 -1
  28. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  29. package/build/cjs/integrations/mcp-server/handlers.js +18 -10
  30. package/build/cjs/integrations/mcp-server/handlers.js.map +1 -1
  31. package/build/cjs/integrations/mcp-server/index.js +2 -1
  32. package/build/cjs/integrations/mcp-server/index.js.map +1 -1
  33. package/build/cjs/integrations/mcp-server/transport.js +1 -1
  34. package/build/cjs/integrations/mcp-server/transport.js.map +1 -1
  35. package/build/cjs/integrations/mcp-server/validation.js +7 -5
  36. package/build/cjs/integrations/mcp-server/validation.js.map +1 -1
  37. package/build/cjs/integrations/spanStreaming.js +48 -0
  38. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  39. package/build/cjs/integrations/supabase.js +1 -1
  40. package/build/cjs/integrations/supabase.js.map +1 -1
  41. package/build/cjs/semanticAttributes.js +35 -3
  42. package/build/cjs/semanticAttributes.js.map +1 -1
  43. package/build/cjs/tracing/ai/gen-ai-attributes.js +9 -79
  44. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  45. package/build/cjs/tracing/ai/utils.js +50 -35
  46. package/build/cjs/tracing/ai/utils.js.map +1 -1
  47. package/build/cjs/tracing/anthropic-ai/constants.js +10 -10
  48. package/build/cjs/tracing/anthropic-ai/constants.js.map +1 -1
  49. package/build/cjs/tracing/anthropic-ai/index.js +18 -20
  50. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  51. package/build/cjs/tracing/anthropic-ai/streaming.js +2 -100
  52. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  53. package/build/cjs/tracing/anthropic-ai/utils.js +0 -9
  54. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  55. package/build/cjs/tracing/dynamicSamplingContext.js +2 -1
  56. package/build/cjs/tracing/dynamicSamplingContext.js.map +1 -1
  57. package/build/cjs/tracing/google-genai/constants.js +9 -12
  58. package/build/cjs/tracing/google-genai/constants.js.map +1 -1
  59. package/build/cjs/tracing/google-genai/index.js +49 -27
  60. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  61. package/build/cjs/tracing/google-genai/streaming.js +2 -23
  62. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  63. package/build/cjs/tracing/google-genai/utils.js +0 -25
  64. package/build/cjs/tracing/google-genai/utils.js.map +1 -1
  65. package/build/cjs/tracing/langchain/embeddings.js +132 -0
  66. package/build/cjs/tracing/langchain/embeddings.js.map +1 -0
  67. package/build/cjs/tracing/langchain/index.js.map +1 -1
  68. package/build/cjs/tracing/openai/constants.js +7 -7
  69. package/build/cjs/tracing/openai/constants.js.map +1 -1
  70. package/build/cjs/tracing/openai/index.js +19 -37
  71. package/build/cjs/tracing/openai/index.js.map +1 -1
  72. package/build/cjs/tracing/openai/streaming.js +3 -34
  73. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  74. package/build/cjs/tracing/openai/utils.js +78 -243
  75. package/build/cjs/tracing/openai/utils.js.map +1 -1
  76. package/build/cjs/tracing/sentryNonRecordingSpan.js +7 -0
  77. package/build/cjs/tracing/sentryNonRecordingSpan.js.map +1 -1
  78. package/build/cjs/tracing/sentrySpan.js +39 -0
  79. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  80. package/build/cjs/tracing/spans/beforeSendSpan.js +43 -0
  81. package/build/cjs/tracing/spans/beforeSendSpan.js.map +1 -0
  82. package/build/cjs/tracing/spans/captureSpan.js +126 -0
  83. package/build/cjs/tracing/spans/captureSpan.js.map +1 -0
  84. package/build/cjs/tracing/spans/envelope.js +38 -0
  85. package/build/cjs/tracing/spans/envelope.js.map +1 -0
  86. package/build/cjs/tracing/spans/estimateSize.js +41 -0
  87. package/build/cjs/tracing/spans/estimateSize.js.map +1 -0
  88. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js +11 -0
  89. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  90. package/build/cjs/tracing/spans/spanBuffer.js +158 -0
  91. package/build/cjs/tracing/spans/spanBuffer.js.map +1 -0
  92. package/build/cjs/tracing/trace.js +88 -13
  93. package/build/cjs/tracing/trace.js.map +1 -1
  94. package/build/cjs/tracing/vercel-ai/utils.js +1 -4
  95. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  96. package/build/cjs/utils/featureFlags.js +6 -0
  97. package/build/cjs/utils/featureFlags.js.map +1 -1
  98. package/build/cjs/utils/object.js +33 -0
  99. package/build/cjs/utils/object.js.map +1 -1
  100. package/build/cjs/utils/spanUtils.js +116 -13
  101. package/build/cjs/utils/spanUtils.js.map +1 -1
  102. package/build/cjs/utils/stacktrace.js +3 -1
  103. package/build/cjs/utils/stacktrace.js.map +1 -1
  104. package/build/cjs/utils/string.js +3 -0
  105. package/build/cjs/utils/string.js.map +1 -1
  106. package/build/cjs/utils/traceData.js +11 -0
  107. package/build/cjs/utils/traceData.js.map +1 -1
  108. package/build/cjs/utils/version.js +1 -1
  109. package/build/esm/api.js +1 -1
  110. package/build/esm/api.js.map +1 -1
  111. package/build/esm/attributes.js +43 -1
  112. package/build/esm/attributes.js.map +1 -1
  113. package/build/esm/client.js +8 -1
  114. package/build/esm/client.js.map +1 -1
  115. package/build/esm/currentScopes.js +31 -1
  116. package/build/esm/currentScopes.js.map +1 -1
  117. package/build/esm/envelope.js +2 -1
  118. package/build/esm/envelope.js.map +1 -1
  119. package/build/esm/index.js +13 -4
  120. package/build/esm/index.js.map +1 -1
  121. package/build/esm/integration.js +6 -0
  122. package/build/esm/integration.js.map +1 -1
  123. package/build/esm/integrations/express/index.js +202 -0
  124. package/build/esm/integrations/express/index.js.map +1 -0
  125. package/build/esm/integrations/express/patch-layer.js +249 -0
  126. package/build/esm/integrations/express/patch-layer.js.map +1 -0
  127. package/build/esm/integrations/express/request-layer-store.js +22 -0
  128. package/build/esm/integrations/express/request-layer-store.js.map +1 -0
  129. package/build/esm/integrations/express/set-sdk-processing-metadata.js +15 -0
  130. package/build/esm/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  131. package/build/esm/integrations/express/types.js +10 -0
  132. package/build/esm/integrations/express/types.js.map +1 -0
  133. package/build/esm/integrations/express/utils.js +225 -0
  134. package/build/esm/integrations/express/utils.js.map +1 -0
  135. package/build/esm/integrations/mcp-server/correlation.js +5 -1
  136. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  137. package/build/esm/integrations/mcp-server/handlers.js +18 -10
  138. package/build/esm/integrations/mcp-server/handlers.js.map +1 -1
  139. package/build/esm/integrations/mcp-server/index.js +2 -1
  140. package/build/esm/integrations/mcp-server/index.js.map +1 -1
  141. package/build/esm/integrations/mcp-server/transport.js +1 -1
  142. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  143. package/build/esm/integrations/mcp-server/validation.js +7 -5
  144. package/build/esm/integrations/mcp-server/validation.js.map +1 -1
  145. package/build/esm/integrations/spanStreaming.js +46 -0
  146. package/build/esm/integrations/spanStreaming.js.map +1 -0
  147. package/build/esm/integrations/supabase.js +1 -1
  148. package/build/esm/integrations/supabase.js.map +1 -1
  149. package/build/esm/package.json +1 -1
  150. package/build/esm/semanticAttributes.js +26 -4
  151. package/build/esm/semanticAttributes.js.map +1 -1
  152. package/build/esm/tracing/ai/gen-ai-attributes.js +8 -69
  153. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  154. package/build/esm/tracing/ai/utils.js +51 -35
  155. package/build/esm/tracing/ai/utils.js.map +1 -1
  156. package/build/esm/tracing/anthropic-ai/constants.js +10 -10
  157. package/build/esm/tracing/anthropic-ai/constants.js.map +1 -1
  158. package/build/esm/tracing/anthropic-ai/index.js +21 -23
  159. package/build/esm/tracing/anthropic-ai/index.js.map +1 -1
  160. package/build/esm/tracing/anthropic-ai/streaming.js +3 -101
  161. package/build/esm/tracing/anthropic-ai/streaming.js.map +1 -1
  162. package/build/esm/tracing/anthropic-ai/utils.js +1 -9
  163. package/build/esm/tracing/anthropic-ai/utils.js.map +1 -1
  164. package/build/esm/tracing/dynamicSamplingContext.js +2 -1
  165. package/build/esm/tracing/dynamicSamplingContext.js.map +1 -1
  166. package/build/esm/tracing/google-genai/constants.js +9 -10
  167. package/build/esm/tracing/google-genai/constants.js.map +1 -1
  168. package/build/esm/tracing/google-genai/index.js +53 -31
  169. package/build/esm/tracing/google-genai/index.js.map +1 -1
  170. package/build/esm/tracing/google-genai/streaming.js +2 -23
  171. package/build/esm/tracing/google-genai/streaming.js.map +1 -1
  172. package/build/esm/tracing/google-genai/utils.js +1 -24
  173. package/build/esm/tracing/google-genai/utils.js.map +1 -1
  174. package/build/esm/tracing/langchain/embeddings.js +129 -0
  175. package/build/esm/tracing/langchain/embeddings.js.map +1 -0
  176. package/build/esm/tracing/langchain/index.js.map +1 -1
  177. package/build/esm/tracing/openai/constants.js +7 -7
  178. package/build/esm/tracing/openai/constants.js.map +1 -1
  179. package/build/esm/tracing/openai/index.js +21 -39
  180. package/build/esm/tracing/openai/index.js.map +1 -1
  181. package/build/esm/tracing/openai/streaming.js +4 -35
  182. package/build/esm/tracing/openai/streaming.js.map +1 -1
  183. package/build/esm/tracing/openai/utils.js +79 -232
  184. package/build/esm/tracing/openai/utils.js.map +1 -1
  185. package/build/esm/tracing/sentryNonRecordingSpan.js +7 -0
  186. package/build/esm/tracing/sentryNonRecordingSpan.js.map +1 -1
  187. package/build/esm/tracing/sentrySpan.js +40 -1
  188. package/build/esm/tracing/sentrySpan.js.map +1 -1
  189. package/build/esm/tracing/spans/beforeSendSpan.js +40 -0
  190. package/build/esm/tracing/spans/beforeSendSpan.js.map +1 -0
  191. package/build/esm/tracing/spans/captureSpan.js +122 -0
  192. package/build/esm/tracing/spans/captureSpan.js.map +1 -0
  193. package/build/esm/tracing/spans/envelope.js +36 -0
  194. package/build/esm/tracing/spans/envelope.js.map +1 -0
  195. package/build/esm/tracing/spans/estimateSize.js +39 -0
  196. package/build/esm/tracing/spans/estimateSize.js.map +1 -0
  197. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js +9 -0
  198. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  199. package/build/esm/tracing/spans/spanBuffer.js +156 -0
  200. package/build/esm/tracing/spans/spanBuffer.js.map +1 -0
  201. package/build/esm/tracing/trace.js +89 -14
  202. package/build/esm/tracing/trace.js.map +1 -1
  203. package/build/esm/tracing/vercel-ai/utils.js +2 -5
  204. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  205. package/build/esm/utils/featureFlags.js +6 -0
  206. package/build/esm/utils/featureFlags.js.map +1 -1
  207. package/build/esm/utils/object.js +33 -1
  208. package/build/esm/utils/object.js.map +1 -1
  209. package/build/esm/utils/spanUtils.js +112 -14
  210. package/build/esm/utils/spanUtils.js.map +1 -1
  211. package/build/esm/utils/stacktrace.js +3 -1
  212. package/build/esm/utils/stacktrace.js.map +1 -1
  213. package/build/esm/utils/string.js +3 -0
  214. package/build/esm/utils/string.js.map +1 -1
  215. package/build/esm/utils/traceData.js +12 -1
  216. package/build/esm/utils/traceData.js.map +1 -1
  217. package/build/esm/utils/version.js +1 -1
  218. package/build/types/api.d.ts +1 -0
  219. package/build/types/api.d.ts.map +1 -1
  220. package/build/types/asyncContext/types.d.ts +3 -1
  221. package/build/types/asyncContext/types.d.ts.map +1 -1
  222. package/build/types/attributes.d.ts +5 -0
  223. package/build/types/attributes.d.ts.map +1 -1
  224. package/build/types/client.d.ts +35 -1
  225. package/build/types/client.d.ts.map +1 -1
  226. package/build/types/currentScopes.d.ts +20 -0
  227. package/build/types/currentScopes.d.ts.map +1 -1
  228. package/build/types/envelope.d.ts.map +1 -1
  229. package/build/types/index.d.ts +15 -6
  230. package/build/types/index.d.ts.map +1 -1
  231. package/build/types/integration.d.ts.map +1 -1
  232. package/build/types/integrations/express/index.d.ts +75 -0
  233. package/build/types/integrations/express/index.d.ts.map +1 -0
  234. package/build/types/integrations/express/patch-layer.d.ts +32 -0
  235. package/build/types/integrations/express/patch-layer.d.ts.map +1 -0
  236. package/build/types/integrations/express/request-layer-store.d.ts +32 -0
  237. package/build/types/integrations/express/request-layer-store.d.ts.map +1 -0
  238. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  239. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts.map +1 -0
  240. package/build/types/integrations/express/types.d.ts +154 -0
  241. package/build/types/integrations/express/types.d.ts.map +1 -0
  242. package/build/types/integrations/express/utils.d.ts +93 -0
  243. package/build/types/integrations/express/utils.d.ts.map +1 -0
  244. package/build/types/integrations/mcp-server/correlation.d.ts +2 -1
  245. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  246. package/build/types/integrations/mcp-server/handlers.d.ts +9 -4
  247. package/build/types/integrations/mcp-server/handlers.d.ts.map +1 -1
  248. package/build/types/integrations/mcp-server/index.d.ts +2 -1
  249. package/build/types/integrations/mcp-server/index.d.ts.map +1 -1
  250. package/build/types/integrations/mcp-server/types.d.ts +40 -7
  251. package/build/types/integrations/mcp-server/types.d.ts.map +1 -1
  252. package/build/types/integrations/mcp-server/validation.d.ts +4 -1
  253. package/build/types/integrations/mcp-server/validation.d.ts.map +1 -1
  254. package/build/types/integrations/spanStreaming.d.ts +2 -0
  255. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  256. package/build/types/semanticAttributes.d.ts +23 -3
  257. package/build/types/semanticAttributes.d.ts.map +1 -1
  258. package/build/types/tracing/ai/gen-ai-attributes.d.ts +6 -46
  259. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  260. package/build/types/tracing/ai/utils.d.ts +34 -9
  261. package/build/types/tracing/ai/utils.d.ts.map +1 -1
  262. package/build/types/tracing/anthropic-ai/constants.d.ts +24 -1
  263. package/build/types/tracing/anthropic-ai/constants.d.ts.map +1 -1
  264. package/build/types/tracing/anthropic-ai/index.d.ts.map +1 -1
  265. package/build/types/tracing/anthropic-ai/streaming.d.ts.map +1 -1
  266. package/build/types/tracing/anthropic-ai/types.d.ts +5 -2
  267. package/build/types/tracing/anthropic-ai/types.d.ts.map +1 -1
  268. package/build/types/tracing/anthropic-ai/utils.d.ts +1 -5
  269. package/build/types/tracing/anthropic-ai/utils.d.ts.map +1 -1
  270. package/build/types/tracing/dynamicSamplingContext.d.ts.map +1 -1
  271. package/build/types/tracing/google-genai/constants.d.ts +22 -3
  272. package/build/types/tracing/google-genai/constants.d.ts.map +1 -1
  273. package/build/types/tracing/google-genai/index.d.ts.map +1 -1
  274. package/build/types/tracing/google-genai/streaming.d.ts.map +1 -1
  275. package/build/types/tracing/google-genai/types.d.ts +6 -2
  276. package/build/types/tracing/google-genai/types.d.ts.map +1 -1
  277. package/build/types/tracing/google-genai/utils.d.ts +0 -9
  278. package/build/types/tracing/google-genai/utils.d.ts.map +1 -1
  279. package/build/types/tracing/index.d.ts +1 -0
  280. package/build/types/tracing/index.d.ts.map +1 -1
  281. package/build/types/tracing/langchain/embeddings.d.ts +27 -0
  282. package/build/types/tracing/langchain/embeddings.d.ts.map +1 -0
  283. package/build/types/tracing/langchain/index.d.ts +1 -0
  284. package/build/types/tracing/langchain/index.d.ts.map +1 -1
  285. package/build/types/tracing/openai/constants.d.ts +14 -1
  286. package/build/types/tracing/openai/constants.d.ts.map +1 -1
  287. package/build/types/tracing/openai/index.d.ts.map +1 -1
  288. package/build/types/tracing/openai/streaming.d.ts.map +1 -1
  289. package/build/types/tracing/openai/types.d.ts +5 -2
  290. package/build/types/tracing/openai/types.d.ts.map +1 -1
  291. package/build/types/tracing/openai/utils.d.ts +4 -63
  292. package/build/types/tracing/openai/utils.d.ts.map +1 -1
  293. package/build/types/tracing/sentryNonRecordingSpan.d.ts +12 -1
  294. package/build/types/tracing/sentryNonRecordingSpan.d.ts.map +1 -1
  295. package/build/types/tracing/sentrySpan.d.ts +10 -1
  296. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  297. package/build/types/tracing/spans/beforeSendSpan.d.ts +35 -0
  298. package/build/types/tracing/spans/beforeSendSpan.d.ts.map +1 -0
  299. package/build/types/tracing/spans/captureSpan.d.ts +26 -0
  300. package/build/types/tracing/spans/captureSpan.d.ts.map +1 -0
  301. package/build/types/tracing/spans/envelope.d.ts +8 -0
  302. package/build/types/tracing/spans/envelope.d.ts.map +1 -0
  303. package/build/types/tracing/spans/estimateSize.d.ts +12 -0
  304. package/build/types/tracing/spans/estimateSize.d.ts.map +1 -0
  305. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  306. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts.map +1 -0
  307. package/build/types/tracing/spans/spanBuffer.d.ts +60 -0
  308. package/build/types/tracing/spans/spanBuffer.d.ts.map +1 -0
  309. package/build/types/tracing/trace.d.ts.map +1 -1
  310. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  311. package/build/types/types-hoist/envelope.d.ts +22 -2
  312. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  313. package/build/types/types-hoist/integration.d.ts +8 -0
  314. package/build/types/types-hoist/integration.d.ts.map +1 -1
  315. package/build/types/types-hoist/link.d.ts +2 -2
  316. package/build/types/types-hoist/link.d.ts.map +1 -1
  317. package/build/types/types-hoist/options.d.ts +26 -2
  318. package/build/types/types-hoist/options.d.ts.map +1 -1
  319. package/build/types/types-hoist/span.d.ts +35 -0
  320. package/build/types/types-hoist/span.d.ts.map +1 -1
  321. package/build/types/utils/featureFlags.d.ts.map +1 -1
  322. package/build/types/utils/object.d.ts +10 -0
  323. package/build/types/utils/object.d.ts.map +1 -1
  324. package/build/types/utils/spanUtils.d.ts +27 -2
  325. package/build/types/utils/spanUtils.d.ts.map +1 -1
  326. package/build/types/utils/stacktrace.d.ts.map +1 -1
  327. package/build/types/utils/string.d.ts +2 -2
  328. package/build/types/utils/string.d.ts.map +1 -1
  329. package/build/types/utils/traceData.d.ts +4 -0
  330. package/build/types/utils/traceData.d.ts.map +1 -1
  331. package/build/types-ts3.8/api.d.ts +1 -0
  332. package/build/types-ts3.8/asyncContext/types.d.ts +3 -1
  333. package/build/types-ts3.8/attributes.d.ts +5 -0
  334. package/build/types-ts3.8/client.d.ts +35 -1
  335. package/build/types-ts3.8/currentScopes.d.ts +20 -0
  336. package/build/types-ts3.8/index.d.ts +15 -6
  337. package/build/types-ts3.8/integrations/express/index.d.ts +75 -0
  338. package/build/types-ts3.8/integrations/express/patch-layer.d.ts +32 -0
  339. package/build/types-ts3.8/integrations/express/request-layer-store.d.ts +32 -0
  340. package/build/types-ts3.8/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  341. package/build/types-ts3.8/integrations/express/types.d.ts +154 -0
  342. package/build/types-ts3.8/integrations/express/utils.d.ts +96 -0
  343. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -1
  344. package/build/types-ts3.8/integrations/mcp-server/handlers.d.ts +9 -4
  345. package/build/types-ts3.8/integrations/mcp-server/index.d.ts +2 -1
  346. package/build/types-ts3.8/integrations/mcp-server/types.d.ts +40 -7
  347. package/build/types-ts3.8/integrations/mcp-server/validation.d.ts +4 -1
  348. package/build/types-ts3.8/integrations/spanStreaming.d.ts +2 -0
  349. package/build/types-ts3.8/semanticAttributes.d.ts +23 -3
  350. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +6 -46
  351. package/build/types-ts3.8/tracing/ai/utils.d.ts +34 -9
  352. package/build/types-ts3.8/tracing/anthropic-ai/constants.d.ts +24 -9
  353. package/build/types-ts3.8/tracing/anthropic-ai/types.d.ts +5 -2
  354. package/build/types-ts3.8/tracing/anthropic-ai/utils.d.ts +1 -5
  355. package/build/types-ts3.8/tracing/google-genai/constants.d.ts +22 -9
  356. package/build/types-ts3.8/tracing/google-genai/types.d.ts +6 -2
  357. package/build/types-ts3.8/tracing/google-genai/utils.d.ts +0 -9
  358. package/build/types-ts3.8/tracing/index.d.ts +1 -0
  359. package/build/types-ts3.8/tracing/langchain/embeddings.d.ts +27 -0
  360. package/build/types-ts3.8/tracing/langchain/index.d.ts +1 -0
  361. package/build/types-ts3.8/tracing/openai/constants.d.ts +14 -6
  362. package/build/types-ts3.8/tracing/openai/types.d.ts +5 -2
  363. package/build/types-ts3.8/tracing/openai/utils.d.ts +4 -63
  364. package/build/types-ts3.8/tracing/sentryNonRecordingSpan.d.ts +12 -1
  365. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  366. package/build/types-ts3.8/tracing/spans/beforeSendSpan.d.ts +35 -0
  367. package/build/types-ts3.8/tracing/spans/captureSpan.d.ts +26 -0
  368. package/build/types-ts3.8/tracing/spans/envelope.d.ts +8 -0
  369. package/build/types-ts3.8/tracing/spans/estimateSize.d.ts +12 -0
  370. package/build/types-ts3.8/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  371. package/build/types-ts3.8/tracing/spans/spanBuffer.d.ts +60 -0
  372. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  373. package/build/types-ts3.8/types-hoist/integration.d.ts +8 -0
  374. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  375. package/build/types-ts3.8/types-hoist/options.d.ts +26 -2
  376. package/build/types-ts3.8/types-hoist/span.d.ts +35 -0
  377. package/build/types-ts3.8/utils/object.d.ts +10 -0
  378. package/build/types-ts3.8/utils/spanUtils.d.ts +27 -2
  379. package/build/types-ts3.8/utils/string.d.ts +2 -2
  380. package/build/types-ts3.8/utils/traceData.d.ts +4 -0
  381. package/package.json +1 -1
@@ -6,22 +6,27 @@
6
6
  */
7
7
  import { MCPServerInstance } from './types';
8
8
  /**
9
- * Wraps tool handlers to associate them with request spans
9
+ * Wraps tool handlers to associate them with request spans.
10
+ * Instruments both `tool` (legacy API) and `registerTool` (new API) if present.
10
11
  * @param serverInstance - MCP server instance
11
12
  */
12
13
  export declare function wrapToolHandlers(serverInstance: MCPServerInstance): void;
13
14
  /**
14
- * Wraps resource handlers to associate them with request spans
15
+ * Wraps resource handlers to associate them with request spans.
16
+ * Instruments both `resource` (legacy API) and `registerResource` (new API) if present.
15
17
  * @param serverInstance - MCP server instance
16
18
  */
17
19
  export declare function wrapResourceHandlers(serverInstance: MCPServerInstance): void;
18
20
  /**
19
- * Wraps prompt handlers to associate them with request spans
21
+ * Wraps prompt handlers to associate them with request spans.
22
+ * Instruments both `prompt` (legacy API) and `registerPrompt` (new API) if present.
20
23
  * @param serverInstance - MCP server instance
21
24
  */
22
25
  export declare function wrapPromptHandlers(serverInstance: MCPServerInstance): void;
23
26
  /**
24
- * Wraps all MCP handler types (tool, resource, prompt) for span correlation
27
+ * Wraps all MCP handler types for span correlation.
28
+ * Supports both the legacy API (`tool`, `resource`, `prompt`) and the newer API
29
+ * (`registerTool`, `registerResource`, `registerPrompt`), instrumenting whichever methods are present.
25
30
  * @param serverInstance - MCP server instance
26
31
  */
27
32
  export declare function wrapAllMCPHandlers(serverInstance: MCPServerInstance): void;
@@ -2,7 +2,8 @@ import { McpServerWrapperOptions } from './types';
2
2
  /**
3
3
  * Wraps a MCP Server instance from the `@modelcontextprotocol/sdk` package with Sentry instrumentation.
4
4
  *
5
- * Compatible with versions `^1.9.0` of the `@modelcontextprotocol/sdk` package.
5
+ * Compatible with versions `^1.9.0` of the `@modelcontextprotocol/sdk` package (legacy `tool`/`resource`/`prompt` API)
6
+ * and versions that expose the newer `registerTool`/`registerResource`/`registerPrompt` API (introduced in 1.x, sole API in 2.x).
6
7
  * Automatically instruments transport methods and handler functions for comprehensive monitoring.
7
8
  *
8
9
  * @example
@@ -74,15 +74,48 @@ export interface MCPTransport {
74
74
  export type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
75
75
  /**
76
76
  * MCP server instance interface
77
- * @description MCP server methods for registering handlers
77
+ * @description MCP server methods for registering handlers.
78
+ * Supports both the legacy API (`tool`, `resource`, `prompt`) used in SDK 1.x
79
+ * and the newer API (`registerTool`, `registerResource`, `registerPrompt`) introduced in SDK 1.x
80
+ * and made the only option in SDK 2.x.
78
81
  */
79
82
  export interface MCPServerInstance {
80
- /** Register a resource handler */
81
- resource: (name: string, ...args: unknown[]) => void;
82
- /** Register a tool handler */
83
- tool: (name: string, ...args: unknown[]) => void;
84
- /** Register a prompt handler */
85
- prompt: (name: string, ...args: unknown[]) => void;
83
+ /**
84
+ * Register a resource handler.
85
+ * Supported in `@modelcontextprotocol/sdk` v1.x alongside `registerResource`.
86
+ * @deprecated Removed in `@modelcontextprotocol/sdk` v2.0.0 — use `registerResource` instead.
87
+ */
88
+ resource?: (name: string, ...args: unknown[]) => void;
89
+ /**
90
+ * Register a tool handler.
91
+ * Supported in `@modelcontextprotocol/sdk` v1.x alongside `registerTool`.
92
+ * @deprecated Removed in `@modelcontextprotocol/sdk` v2.0.0 — use `registerTool` instead.
93
+ */
94
+ tool?: (name: string, ...args: unknown[]) => void;
95
+ /**
96
+ * Register a prompt handler.
97
+ * Supported in `@modelcontextprotocol/sdk` v1.x alongside `registerPrompt`.
98
+ * @deprecated Removed in `@modelcontextprotocol/sdk` v2.0.0 — use `registerPrompt` instead.
99
+ */
100
+ prompt?: (name: string, ...args: unknown[]) => void;
101
+ /**
102
+ * Register a resource handler.
103
+ * Available in `@modelcontextprotocol/sdk` v1.x (alongside the legacy `resource` method)
104
+ * and the only supported form in v2.0.0+.
105
+ */
106
+ registerResource?: (name: string, ...args: unknown[]) => void;
107
+ /**
108
+ * Register a tool handler.
109
+ * Available in `@modelcontextprotocol/sdk` v1.x (alongside the legacy `tool` method)
110
+ * and the only supported form in v2.0.0+.
111
+ */
112
+ registerTool?: (name: string, ...args: unknown[]) => void;
113
+ /**
114
+ * Register a prompt handler.
115
+ * Available in `@modelcontextprotocol/sdk` v1.x (alongside the legacy `prompt` method)
116
+ * and the only supported form in v2.0.0+.
117
+ */
118
+ registerPrompt?: (name: string, ...args: unknown[]) => void;
86
119
  /** Connect the server to a transport */
87
120
  connect(transport: MCPTransport): Promise<void>;
88
121
  }
@@ -23,7 +23,10 @@ export declare function isJsonRpcNotification(message: unknown): message is Json
23
23
  */
24
24
  export declare function isJsonRpcResponse(message: unknown): message is JsonRpcResponse;
25
25
  /**
26
- * Validates MCP server instance with type checking
26
+ * Validates MCP server instance with type checking.
27
+ * Accepts both the legacy API (`tool`, `resource`, `prompt`) used in SDK 1.x
28
+ * and the newer API (`registerTool`, `registerResource`, `registerPrompt`) introduced
29
+ * alongside the legacy API in SDK 1.x and made the only option in SDK 2.x.
27
30
  * @param instance - Object to validate as MCP server instance
28
31
  * @returns True if instance has required MCP server methods
29
32
  */
@@ -0,0 +1,2 @@
1
+ export declare const spanStreamingIntegration: () => import("../types-hoist/integration").Integration;
2
+ //# sourceMappingURL=spanStreaming.d.ts.map
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Use this attribute to represent the source of a span.
3
- * Should be one of: custom, url, route, view, component, task, unknown
4
- *
2
+ * Use this attribute to represent the source of a span name.
3
+ * Must be one of: custom, url, route, view, component, task
4
+ * TODO(v11): rename this to sentry.span.source'
5
5
  */
6
6
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source";
7
7
  /**
@@ -32,6 +32,26 @@ export declare const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry
32
32
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit";
33
33
  /** The value of a measurement, which may be stored as a TimedEvent. */
34
34
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value";
35
+ /** The release version of the application */
36
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = "sentry.release";
37
+ /** The environment name (e.g., "production", "staging", "development") */
38
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = "sentry.environment";
39
+ /** The segment name (e.g., "GET /users") */
40
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = "sentry.segment.name";
41
+ /** The id of the segment that this span belongs to. */
42
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = "sentry.segment.id";
43
+ /** The name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") */
44
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = "sentry.sdk.name";
45
+ /** The version of the Sentry SDK */
46
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = "sentry.sdk.version";
47
+ /** The user ID (gated by sendDefaultPii) */
48
+ export declare const SEMANTIC_ATTRIBUTE_USER_ID = "user.id";
49
+ /** The user email (gated by sendDefaultPii) */
50
+ export declare const SEMANTIC_ATTRIBUTE_USER_EMAIL = "user.email";
51
+ /** The user IP address (gated by sendDefaultPii) */
52
+ export declare const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = "user.ip_address";
53
+ /** The user username (gated by sendDefaultPii) */
54
+ export declare const SEMANTIC_ATTRIBUTE_USER_USERNAME = "user.name";
35
55
  /**
36
56
  * A custom span name set by users guaranteed to be taken over any automatically
37
57
  * inferred name. This attribute is removed before the span is sent.
@@ -165,26 +165,18 @@ export declare const GEN_AI_USAGE_INPUT_TOKENS_CACHED_ATTRIBUTE = "gen_ai.usage.
165
165
  */
166
166
  export declare const GEN_AI_INVOKE_AGENT_OPERATION_ATTRIBUTE = "gen_ai.invoke_agent";
167
167
  /**
168
- * The span operation name for generating text
168
+ * The span operation name for generating content
169
169
  */
170
- export declare const GEN_AI_GENERATE_TEXT_DO_GENERATE_OPERATION_ATTRIBUTE = "gen_ai.generate_text";
171
- /**
172
- * The span operation name for streaming text
173
- */
174
- export declare const GEN_AI_STREAM_TEXT_DO_STREAM_OPERATION_ATTRIBUTE = "gen_ai.stream_text";
175
- /**
176
- * The span operation name for generating object
177
- */
178
- export declare const GEN_AI_GENERATE_OBJECT_DO_GENERATE_OPERATION_ATTRIBUTE = "gen_ai.generate_object";
179
- /**
180
- * The span operation name for streaming object
181
- */
182
- export declare const GEN_AI_STREAM_OBJECT_DO_STREAM_OPERATION_ATTRIBUTE = "gen_ai.stream_object";
170
+ export declare const GEN_AI_GENERATE_CONTENT_OPERATION_ATTRIBUTE = "gen_ai.generate_content";
183
171
  /**
184
172
  * The embeddings input
185
173
  * Only recorded when recordInputs is enabled
186
174
  */
187
175
  export declare const GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE = "gen_ai.embeddings.input";
176
+ /**
177
+ * The span operation for embeddings
178
+ */
179
+ export declare const GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE = "gen_ai.embeddings";
188
180
  /**
189
181
  * The span operation name for embedding
190
182
  */
@@ -226,36 +218,4 @@ export declare const GEN_AI_TOOL_OUTPUT_ATTRIBUTE = "gen_ai.tool.output";
226
218
  * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-description
227
219
  */
228
220
  export declare const GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE = "gen_ai.tool.description";
229
- /**
230
- * The response ID from OpenAI
231
- */
232
- export declare const OPENAI_RESPONSE_ID_ATTRIBUTE = "openai.response.id";
233
- /**
234
- * The response model from OpenAI
235
- */
236
- export declare const OPENAI_RESPONSE_MODEL_ATTRIBUTE = "openai.response.model";
237
- /**
238
- * The response timestamp from OpenAI (ISO string)
239
- */
240
- export declare const OPENAI_RESPONSE_TIMESTAMP_ATTRIBUTE = "openai.response.timestamp";
241
- /**
242
- * The number of completion tokens used
243
- */
244
- export declare const OPENAI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = "openai.usage.completion_tokens";
245
- /**
246
- * The number of prompt tokens used
247
- */
248
- export declare const OPENAI_USAGE_PROMPT_TOKENS_ATTRIBUTE = "openai.usage.prompt_tokens";
249
- /**
250
- * OpenAI API operations following OpenTelemetry semantic conventions
251
- * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#llm-request-spans
252
- */
253
- export declare const OPENAI_OPERATIONS: {
254
- readonly CHAT: "chat";
255
- readonly EMBEDDINGS: "embeddings";
256
- };
257
- /**
258
- * The response timestamp from Anthropic AI (ISO string)
259
- */
260
- export declare const ANTHROPIC_AI_RESPONSE_TIMESTAMP_ATTRIBUTE = "anthropic.response.timestamp";
261
221
  //# sourceMappingURL=gen-ai-attributes.d.ts.map
@@ -4,20 +4,28 @@ export interface AIRecordingOptions {
4
4
  recordOutputs?: boolean;
5
5
  }
6
6
  /**
7
- * Resolves AI recording options by falling back to the client's `sendDefaultPii` setting.
8
- * Precedence: explicit option > sendDefaultPii > false
7
+ * A method registry entry describes a single instrumented method:
8
+ * which gen_ai operation it maps to and whether it is intrinsically streaming.
9
9
  */
10
- export declare function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions>;
10
+ export interface InstrumentedMethodEntry {
11
+ /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */
12
+ operation?: string;
13
+ /** True if the method itself is always streaming (not param-based) */
14
+ streaming?: boolean;
15
+ /** When set, the method's return value is re-proxied with this as the base path */
16
+ proxyResultPath?: string;
17
+ }
11
18
  /**
12
- * Maps AI method paths to OpenTelemetry semantic convention operation names
13
- * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#llm-request-spans
19
+ * Maps method paths to their registry entries.
20
+ * Used by proxy-based AI client instrumentations to determine which methods
21
+ * to instrument, what operation name to use, and whether they stream.
14
22
  */
15
- export declare function getFinalOperationName(methodPath: string): string;
23
+ export type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>;
16
24
  /**
17
- * Get the span operation for AI methods
18
- * Following Sentry's convention: "gen_ai.{operation_name}"
25
+ * Resolves AI recording options by falling back to the client's `sendDefaultPii` setting.
26
+ * Precedence: explicit option > sendDefaultPii > false
19
27
  */
20
- export declare function getSpanOperation(methodPath: string): string;
28
+ export declare function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions>;
21
29
  /**
22
30
  * Build method path from current traversal
23
31
  */
@@ -31,6 +39,23 @@ export declare function buildMethodPath(currentPath: string, prop: string): stri
31
39
  * @param cachedOutputTokens - The number of cached output tokens
32
40
  */
33
41
  export declare function setTokenUsageAttributes(span: Span, promptTokens?: number, completionTokens?: number, cachedInputTokens?: number, cachedOutputTokens?: number): void;
42
+ export interface StreamResponseState {
43
+ responseId?: string;
44
+ responseModel?: string;
45
+ finishReasons: string[];
46
+ responseTexts: string[];
47
+ toolCalls: unknown[];
48
+ promptTokens?: number;
49
+ completionTokens?: number;
50
+ totalTokens?: number;
51
+ cacheCreationInputTokens?: number;
52
+ cacheReadInputTokens?: number;
53
+ }
54
+ /**
55
+ * Ends a streaming span by setting all accumulated response attributes and ending the span.
56
+ * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.
57
+ */
58
+ export declare function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void;
34
59
  /**
35
60
  * Get the truncated JSON string for a string or array of strings.
36
61
  *
@@ -1,11 +1,26 @@
1
1
  export declare const ANTHROPIC_AI_INTEGRATION_NAME = "Anthropic_AI";
2
- export declare const ANTHROPIC_AI_INSTRUMENTED_METHODS: readonly [
3
- "messages.create",
4
- "messages.stream",
5
- "messages.countTokens",
6
- "models.get",
7
- "completions.create",
8
- "models.retrieve",
9
- "beta.messages.create"
10
- ];
2
+ export declare const ANTHROPIC_METHOD_REGISTRY: {
3
+ readonly 'messages.create': {
4
+ readonly operation: "chat";
5
+ };
6
+ readonly 'messages.stream': {
7
+ readonly operation: "chat";
8
+ readonly streaming: true;
9
+ };
10
+ readonly 'messages.countTokens': {
11
+ readonly operation: "chat";
12
+ };
13
+ readonly 'models.get': {
14
+ readonly operation: "models";
15
+ };
16
+ readonly 'completions.create': {
17
+ readonly operation: "chat";
18
+ };
19
+ readonly 'models.retrieve': {
20
+ readonly operation: "models";
21
+ };
22
+ readonly 'beta.messages.create': {
23
+ readonly operation: "chat";
24
+ };
25
+ };
11
26
  //# sourceMappingURL=constants.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ANTHROPIC_AI_INSTRUMENTED_METHODS } from './constants';
1
+ import { ANTHROPIC_METHOD_REGISTRY } from './constants';
2
2
  export interface AnthropicAiOptions {
3
3
  /**
4
4
  * Enable or disable input recording.
@@ -74,7 +74,10 @@ export interface AnthropicAiIntegration {
74
74
  name: string;
75
75
  options: AnthropicAiOptions;
76
76
  }
77
- export type AnthropicAiInstrumentedMethod = (typeof ANTHROPIC_AI_INSTRUMENTED_METHODS)[number];
77
+ /**
78
+ * @deprecated This type is no longer used and will be removed in the next major version.
79
+ */
80
+ export type AnthropicAiInstrumentedMethod = keyof typeof ANTHROPIC_METHOD_REGISTRY;
78
81
  /**
79
82
  * Message type for Anthropic AI
80
83
  */
@@ -1,10 +1,6 @@
1
1
  import { Span } from '../../types-hoist/span';
2
2
  import { SpanStatusType } from '../../types-hoist/spanStatus';
3
- import { AnthropicAiInstrumentedMethod, AnthropicAiResponse } from './types';
4
- /**
5
- * Check if a method path should be instrumented
6
- */
7
- export declare function shouldInstrument(methodPath: string): methodPath is AnthropicAiInstrumentedMethod;
3
+ import { AnthropicAiResponse } from './types';
8
4
  /**
9
5
  * Set the messages and messages original length attributes.
10
6
  * Extracts system instructions before truncation.
@@ -1,12 +1,25 @@
1
1
  export declare const GOOGLE_GENAI_INTEGRATION_NAME = "Google_GenAI";
2
- export declare const GOOGLE_GENAI_INSTRUMENTED_METHODS: readonly [
3
- "models.generateContent",
4
- "models.generateContentStream",
5
- "chats.create",
6
- "sendMessage",
7
- "sendMessageStream"
8
- ];
2
+ export declare const GOOGLE_GENAI_METHOD_REGISTRY: {
3
+ readonly 'models.generateContent': {
4
+ readonly operation: "generate_content";
5
+ };
6
+ readonly 'models.generateContentStream': {
7
+ readonly operation: "generate_content";
8
+ readonly streaming: true;
9
+ };
10
+ readonly 'models.embedContent': {
11
+ readonly operation: "embeddings";
12
+ };
13
+ readonly 'chats.create': {
14
+ readonly proxyResultPath: "chat";
15
+ };
16
+ readonly 'chat.sendMessage': {
17
+ readonly operation: "chat";
18
+ };
19
+ readonly 'chat.sendMessageStream': {
20
+ readonly operation: "chat";
21
+ readonly streaming: true;
22
+ };
23
+ };
9
24
  export declare const GOOGLE_GENAI_SYSTEM_NAME = "google_genai";
10
- export declare const CHATS_CREATE_METHOD = "chats.create";
11
- export declare const CHAT_PATH = "chat";
12
25
  //# sourceMappingURL=constants.d.ts.map
@@ -1,4 +1,4 @@
1
- import { GOOGLE_GENAI_INSTRUMENTED_METHODS } from './constants';
1
+ import { GOOGLE_GENAI_METHOD_REGISTRY } from './constants';
2
2
  export interface GoogleGenAIOptions {
3
3
  /**
4
4
  * Enable or disable input recording.
@@ -152,6 +152,7 @@ export interface GoogleGenAIClient {
152
152
  models: {
153
153
  generateContent: (...args: unknown[]) => Promise<GenerateContentResponse>;
154
154
  generateContentStream: (...args: unknown[]) => Promise<AsyncGenerator<GenerateContentResponse, any, unknown>>;
155
+ embedContent: (...args: unknown[]) => Promise<unknown>;
155
156
  };
156
157
  chats: {
157
158
  create: (...args: unknown[]) => GoogleGenAIChat;
@@ -164,7 +165,10 @@ export interface GoogleGenAIChat {
164
165
  sendMessage: (...args: unknown[]) => Promise<GenerateContentResponse>;
165
166
  sendMessageStream: (...args: unknown[]) => Promise<AsyncGenerator<GenerateContentResponse, any, unknown>>;
166
167
  }
167
- export type GoogleGenAIIstrumentedMethod = (typeof GOOGLE_GENAI_INSTRUMENTED_METHODS)[number];
168
+ /**
169
+ * @deprecated This type is no longer used and will be removed in the next major version.
170
+ */
171
+ export type GoogleGenAIIstrumentedMethod = keyof typeof GOOGLE_GENAI_METHOD_REGISTRY;
168
172
  export type GoogleGenAIResponse = GenerateContentResponse;
169
173
  export {};
170
174
  //# sourceMappingURL=types.d.ts.map
@@ -1,12 +1,3 @@
1
- import { GoogleGenAIIstrumentedMethod } from './types';
2
- /**
3
- * Check if a method path should be instrumented
4
- */
5
- export declare function shouldInstrument(methodPath: string): methodPath is GoogleGenAIIstrumentedMethod;
6
- /**
7
- * Check if a method is a streaming method
8
- */
9
- export declare function isStreamingMethod(methodPath: string): boolean;
10
1
  export type ContentListUnion = Content | Content[] | PartListUnion;
11
2
  export type ContentUnion = Content | PartUnion[] | PartUnion;
12
3
  export type Content = {
@@ -10,4 +10,5 @@ export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan,
10
10
  export { setMeasurement, timedEventsToMeasurements } from './measurement';
11
11
  export { sampleSpan } from './sampling';
12
12
  export { logSpanEnd, logSpanStart } from './logSpans';
13
+ export { captureSpan } from './spans/captureSpan';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { LangChainOptions } from './types';
2
+ /**
3
+ * Wraps a LangChain embedding method (embedQuery or embedDocuments) to create Sentry spans.
4
+ *
5
+ * Used internally by the Node.js auto-instrumentation to patch embedding class prototypes.
6
+ */
7
+ export declare function instrumentEmbeddingMethod(originalMethod: (...args: unknown[]) => Promise<unknown>, options?: LangChainOptions): (...args: unknown[]) => Promise<unknown>;
8
+ /**
9
+ * Wraps a LangChain embeddings instance to create Sentry spans for `embedQuery` and `embedDocuments` calls.
10
+ *
11
+ * Use this in non-Node runtimes (Cloudflare, browser, etc.) where auto-instrumentation is not available.
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * import * as Sentry from '@sentry/cloudflare';
16
+ * import { OpenAIEmbeddings } from '@langchain/openai';
17
+ *
18
+ * const embeddings = Sentry.instrumentLangChainEmbeddings(
19
+ * new OpenAIEmbeddings({ model: 'text-embedding-3-small' })
20
+ * );
21
+ *
22
+ * await embeddings.embedQuery('Hello world');
23
+ * await embeddings.embedDocuments(['doc1', 'doc2']);
24
+ * ```
25
+ */
26
+ export declare function instrumentLangChainEmbeddings<T extends object>(instance: T, options?: LangChainOptions): T;
27
+ //# sourceMappingURL=embeddings.d.ts.map
@@ -6,4 +6,5 @@ import { LangChainCallbackHandler, LangChainOptions } from './types';
6
6
  * This is a stateful handler that tracks spans across multiple LangChain executions.
7
7
  */
8
8
  export declare function createLangChainCallbackHandler(options?: LangChainOptions): LangChainCallbackHandler;
9
+ export { instrumentLangChainEmbeddings } from './embeddings';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,18 @@
1
1
  export declare const OPENAI_INTEGRATION_NAME = "OpenAI";
2
- export declare const INSTRUMENTED_METHODS: readonly [
3
- "responses.create",
4
- "chat.completions.create",
5
- "embeddings.create",
6
- "conversations.create"
7
- ];
2
+ export declare const OPENAI_METHOD_REGISTRY: {
3
+ readonly 'responses.create': {
4
+ readonly operation: "chat";
5
+ };
6
+ readonly 'chat.completions.create': {
7
+ readonly operation: "chat";
8
+ };
9
+ readonly 'embeddings.create': {
10
+ readonly operation: "embeddings";
11
+ };
12
+ readonly 'conversations.create': {
13
+ readonly operation: "chat";
14
+ };
15
+ };
8
16
  export declare const RESPONSES_TOOL_CALL_EVENT_TYPES: readonly [
9
17
  "response.output_item.added",
10
18
  "response.function_call_arguments.delta",
@@ -1,4 +1,4 @@
1
- import { INSTRUMENTED_METHODS } from './constants';
1
+ import { OPENAI_METHOD_REGISTRY } from './constants';
2
2
  /**
3
3
  * Attribute values may be any non-nullish primitive value except an object.
4
4
  *
@@ -313,6 +313,9 @@ export interface OpenAiIntegration {
313
313
  name: string;
314
314
  options: OpenAiOptions;
315
315
  }
316
- export type InstrumentedMethod = (typeof INSTRUMENTED_METHODS)[number];
316
+ /**
317
+ * @deprecated This type is no longer used and will be removed in the next major version.
318
+ */
319
+ export type InstrumentedMethod = keyof typeof OPENAI_METHOD_REGISTRY;
317
320
  export {};
318
321
  //# sourceMappingURL=types.d.ts.map
@@ -1,36 +1,5 @@
1
1
  import { Span } from '../../types-hoist/span';
2
- import { ChatCompletionChunk, InstrumentedMethod, OpenAiChatCompletionObject, OpenAIConversationObject, OpenAICreateEmbeddingsObject, OpenAIResponseObject, ResponseStreamingEvent } from './types';
3
- /**
4
- * Maps OpenAI method paths to OpenTelemetry semantic convention operation names
5
- * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#llm-request-spans
6
- */
7
- export declare function getOperationName(methodPath: string): string;
8
- /**
9
- * Get the span operation for OpenAI methods
10
- * Following Sentry's convention: "gen_ai.{operation_name}"
11
- */
12
- export declare function getSpanOperation(methodPath: string): string;
13
- /**
14
- * Check if a method path should be instrumented
15
- */
16
- export declare function shouldInstrument(methodPath: string): methodPath is InstrumentedMethod;
17
- /**
18
- * Check if response is a Chat Completion object
19
- */
20
- export declare function isChatCompletionResponse(response: unknown): response is OpenAiChatCompletionObject;
21
- /**
22
- * Check if response is a Responses API object
23
- */
24
- export declare function isResponsesApiResponse(response: unknown): response is OpenAIResponseObject;
25
- /**
26
- * Check if response is an Embeddings API object
27
- */
28
- export declare function isEmbeddingsResponse(response: unknown): response is OpenAICreateEmbeddingsObject;
29
- /**
30
- * Check if response is a Conversations API object
31
- * @see https://platform.openai.com/docs/api-reference/conversations
32
- */
33
- export declare function isConversationResponse(response: unknown): response is OpenAIConversationObject;
2
+ import { ChatCompletionChunk, ResponseStreamingEvent } from './types';
34
3
  /**
35
4
  * Check if streaming event is from the Responses API
36
5
  */
@@ -40,38 +9,10 @@ export declare function isResponsesApiStreamEvent(event: unknown): event is Resp
40
9
  */
41
10
  export declare function isChatCompletionChunk(event: unknown): event is ChatCompletionChunk;
42
11
  /**
43
- * Add attributes for Chat Completion responses
44
- */
45
- export declare function addChatCompletionAttributes(span: Span, response: OpenAiChatCompletionObject, recordOutputs?: boolean): void;
46
- /**
47
- * Add attributes for Responses API responses
48
- */
49
- export declare function addResponsesApiAttributes(span: Span, response: OpenAIResponseObject, recordOutputs?: boolean): void;
50
- /**
51
- * Add attributes for Embeddings API responses
52
- */
53
- export declare function addEmbeddingsAttributes(span: Span, response: OpenAICreateEmbeddingsObject): void;
54
- /**
55
- * Add attributes for Conversations API responses
56
- * @see https://platform.openai.com/docs/api-reference/conversations
57
- */
58
- export declare function addConversationAttributes(span: Span, response: OpenAIConversationObject): void;
59
- /**
60
- * Set token usage attributes
61
- * @param span - The span to add attributes to
62
- * @param promptTokens - The number of prompt tokens
63
- * @param completionTokens - The number of completion tokens
64
- * @param totalTokens - The number of total tokens
65
- */
66
- export declare function setTokenUsageAttributes(span: Span, promptTokens?: number, completionTokens?: number, totalTokens?: number): void;
67
- /**
68
- * Set common response attributes
69
- * @param span - The span to add attributes to
70
- * @param id - The response id
71
- * @param model - The response model
72
- * @param timestamp - The response timestamp
12
+ * Add response attributes to a span using duck-typing.
13
+ * Works for Chat Completions, Responses API, Embeddings, and Conversations API responses.
73
14
  */
74
- export declare function setCommonResponseAttributes(span: Span, id: string, model: string, timestamp: number): void;
15
+ export declare function addResponseAttributes(span: Span, result: unknown, recordOutputs?: boolean): void;
75
16
  /**
76
17
  * Extract request parameters including model settings and conversation context
77
18
  */
@@ -1,12 +1,22 @@
1
+ import { EventDropReason } from '../types-hoist/clientreport';
1
2
  import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanTimeInput } from '../types-hoist/span';
2
3
  import { SpanStatus } from '../types-hoist/spanStatus';
4
+ interface SentryNonRecordingSpanArguments extends SentrySpanArguments {
5
+ dropReason?: EventDropReason;
6
+ }
3
7
  /**
4
8
  * A Sentry Span that is non-recording, meaning it will not be sent to Sentry.
5
9
  */
6
10
  export declare class SentryNonRecordingSpan implements Span {
7
11
  private _traceId;
8
12
  private _spanId;
9
- constructor(spanContext?: SentrySpanArguments);
13
+ /**
14
+ * Reason why this span was dropped, if applicable ('ignored' or 'sample_rate').
15
+ * Used to propagate the correct client report outcome to descendant spans
16
+ * when span streaming is enabled.
17
+ */
18
+ dropReason?: EventDropReason;
19
+ constructor(spanContext?: SentryNonRecordingSpanArguments);
10
20
  /** @inheritdoc */
11
21
  spanContext(): SpanContextData;
12
22
  /** @inheritdoc */
@@ -36,4 +46,5 @@ export declare class SentryNonRecordingSpan implements Span {
36
46
  */
37
47
  recordException(_exception: unknown, _time?: number | undefined): void;
38
48
  }
49
+ export {};
39
50
  //# sourceMappingURL=sentryNonRecordingSpan.d.ts.map