@sentry/core 10.47.0 → 10.49.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 (413) hide show
  1. package/build/cjs/attributes.js +43 -0
  2. package/build/cjs/attributes.js.map +1 -1
  3. package/build/cjs/client.js +13 -6
  4. package/build/cjs/client.js.map +1 -1
  5. package/build/cjs/envelope.js +4 -3
  6. package/build/cjs/envelope.js.map +1 -1
  7. package/build/cjs/fetch.js +36 -17
  8. package/build/cjs/fetch.js.map +1 -1
  9. package/build/cjs/index.js +53 -18
  10. package/build/cjs/index.js.map +1 -1
  11. package/build/cjs/integration.js +6 -0
  12. package/build/cjs/integration.js.map +1 -1
  13. package/build/cjs/integrations/conversationId.js +11 -0
  14. package/build/cjs/integrations/conversationId.js.map +1 -1
  15. package/build/cjs/integrations/express/index.js +243 -0
  16. package/build/cjs/integrations/express/index.js.map +1 -0
  17. package/build/cjs/integrations/express/patch-layer.js +257 -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/requestdata.js.map +1 -1
  38. package/build/cjs/integrations/spanStreaming.js +48 -0
  39. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  40. package/build/cjs/semanticAttributes.js +35 -3
  41. package/build/cjs/semanticAttributes.js.map +1 -1
  42. package/build/cjs/tracing/ai/gen-ai-attributes.js +3 -89
  43. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  44. package/build/cjs/tracing/ai/utils.js +74 -0
  45. package/build/cjs/tracing/ai/utils.js.map +1 -1
  46. package/build/cjs/tracing/anthropic-ai/index.js +6 -17
  47. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  48. package/build/cjs/tracing/anthropic-ai/streaming.js +2 -100
  49. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  50. package/build/cjs/tracing/anthropic-ai/utils.js +4 -2
  51. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  52. package/build/cjs/tracing/dynamicSamplingContext.js +2 -1
  53. package/build/cjs/tracing/dynamicSamplingContext.js.map +1 -1
  54. package/build/cjs/tracing/google-genai/constants.js +1 -6
  55. package/build/cjs/tracing/google-genai/constants.js.map +1 -1
  56. package/build/cjs/tracing/google-genai/index.js +40 -35
  57. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  58. package/build/cjs/tracing/google-genai/streaming.js +2 -23
  59. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  60. package/build/cjs/tracing/langchain/embeddings.js +132 -0
  61. package/build/cjs/tracing/langchain/embeddings.js.map +1 -0
  62. package/build/cjs/tracing/langchain/index.js +3 -0
  63. package/build/cjs/tracing/langchain/index.js.map +1 -1
  64. package/build/cjs/tracing/langchain/utils.js +12 -4
  65. package/build/cjs/tracing/langchain/utils.js.map +1 -1
  66. package/build/cjs/tracing/langgraph/index.js +4 -3
  67. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  68. package/build/cjs/tracing/openai/index.js +14 -34
  69. package/build/cjs/tracing/openai/index.js.map +1 -1
  70. package/build/cjs/tracing/openai/streaming.js +3 -34
  71. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  72. package/build/cjs/tracing/openai/utils.js +78 -204
  73. package/build/cjs/tracing/openai/utils.js.map +1 -1
  74. package/build/cjs/tracing/sentryNonRecordingSpan.js +7 -0
  75. package/build/cjs/tracing/sentryNonRecordingSpan.js.map +1 -1
  76. package/build/cjs/tracing/sentrySpan.js +39 -0
  77. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  78. package/build/cjs/tracing/spans/beforeSendSpan.js +43 -0
  79. package/build/cjs/tracing/spans/beforeSendSpan.js.map +1 -0
  80. package/build/cjs/tracing/spans/captureSpan.js +126 -0
  81. package/build/cjs/tracing/spans/captureSpan.js.map +1 -0
  82. package/build/cjs/tracing/spans/envelope.js +38 -0
  83. package/build/cjs/tracing/spans/envelope.js.map +1 -0
  84. package/build/cjs/tracing/spans/estimateSize.js +41 -0
  85. package/build/cjs/tracing/spans/estimateSize.js.map +1 -0
  86. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js +11 -0
  87. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  88. package/build/cjs/tracing/spans/spanBuffer.js +158 -0
  89. package/build/cjs/tracing/spans/spanBuffer.js.map +1 -0
  90. package/build/cjs/tracing/trace.js +83 -13
  91. package/build/cjs/tracing/trace.js.map +1 -1
  92. package/build/cjs/tracing/utils.js +3 -37
  93. package/build/cjs/tracing/utils.js.map +1 -1
  94. package/build/cjs/tracing/vercel-ai/constants.js +15 -23
  95. package/build/cjs/tracing/vercel-ai/constants.js.map +1 -1
  96. package/build/cjs/tracing/vercel-ai/index.js +32 -45
  97. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  98. package/build/cjs/tracing/vercel-ai/utils.js +11 -42
  99. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  100. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  101. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  102. package/build/cjs/utils/browser.js +2 -3
  103. package/build/cjs/utils/browser.js.map +1 -1
  104. package/build/cjs/utils/featureFlags.js +6 -0
  105. package/build/cjs/utils/featureFlags.js.map +1 -1
  106. package/build/cjs/utils/object.js +33 -0
  107. package/build/cjs/utils/object.js.map +1 -1
  108. package/build/cjs/utils/spanUtils.js +116 -13
  109. package/build/cjs/utils/spanUtils.js.map +1 -1
  110. package/build/cjs/utils/stacktrace.js +3 -1
  111. package/build/cjs/utils/stacktrace.js.map +1 -1
  112. package/build/cjs/utils/string.js +3 -0
  113. package/build/cjs/utils/string.js.map +1 -1
  114. package/build/cjs/utils/version.js +1 -1
  115. package/build/cjs/utils/weakRef.js +62 -0
  116. package/build/cjs/utils/weakRef.js.map +1 -0
  117. package/build/esm/attributes.js +43 -1
  118. package/build/esm/attributes.js.map +1 -1
  119. package/build/esm/client.js +8 -1
  120. package/build/esm/client.js.map +1 -1
  121. package/build/esm/envelope.js +2 -1
  122. package/build/esm/envelope.js.map +1 -1
  123. package/build/esm/fetch.js +36 -17
  124. package/build/esm/fetch.js.map +1 -1
  125. package/build/esm/index.js +12 -3
  126. package/build/esm/index.js.map +1 -1
  127. package/build/esm/integration.js +6 -0
  128. package/build/esm/integration.js.map +1 -1
  129. package/build/esm/integrations/conversationId.js +11 -0
  130. package/build/esm/integrations/conversationId.js.map +1 -1
  131. package/build/esm/integrations/express/index.js +239 -0
  132. package/build/esm/integrations/express/index.js.map +1 -0
  133. package/build/esm/integrations/express/patch-layer.js +255 -0
  134. package/build/esm/integrations/express/patch-layer.js.map +1 -0
  135. package/build/esm/integrations/express/request-layer-store.js +22 -0
  136. package/build/esm/integrations/express/request-layer-store.js.map +1 -0
  137. package/build/esm/integrations/express/set-sdk-processing-metadata.js +15 -0
  138. package/build/esm/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  139. package/build/esm/integrations/express/types.js +10 -0
  140. package/build/esm/integrations/express/types.js.map +1 -0
  141. package/build/esm/integrations/express/utils.js +225 -0
  142. package/build/esm/integrations/express/utils.js.map +1 -0
  143. package/build/esm/integrations/mcp-server/correlation.js +5 -1
  144. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  145. package/build/esm/integrations/mcp-server/handlers.js +18 -10
  146. package/build/esm/integrations/mcp-server/handlers.js.map +1 -1
  147. package/build/esm/integrations/mcp-server/index.js +2 -1
  148. package/build/esm/integrations/mcp-server/index.js.map +1 -1
  149. package/build/esm/integrations/mcp-server/transport.js +1 -1
  150. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  151. package/build/esm/integrations/mcp-server/validation.js +7 -5
  152. package/build/esm/integrations/mcp-server/validation.js.map +1 -1
  153. package/build/esm/integrations/requestdata.js.map +1 -1
  154. package/build/esm/integrations/spanStreaming.js +46 -0
  155. package/build/esm/integrations/spanStreaming.js.map +1 -0
  156. package/build/esm/package.json +1 -1
  157. package/build/esm/semanticAttributes.js +26 -4
  158. package/build/esm/semanticAttributes.js.map +1 -1
  159. package/build/esm/tracing/ai/gen-ai-attributes.js +3 -76
  160. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  161. package/build/esm/tracing/ai/utils.js +73 -2
  162. package/build/esm/tracing/ai/utils.js.map +1 -1
  163. package/build/esm/tracing/anthropic-ai/index.js +8 -19
  164. package/build/esm/tracing/anthropic-ai/index.js.map +1 -1
  165. package/build/esm/tracing/anthropic-ai/streaming.js +3 -101
  166. package/build/esm/tracing/anthropic-ai/streaming.js.map +1 -1
  167. package/build/esm/tracing/anthropic-ai/utils.js +5 -3
  168. package/build/esm/tracing/anthropic-ai/utils.js.map +1 -1
  169. package/build/esm/tracing/dynamicSamplingContext.js +2 -1
  170. package/build/esm/tracing/dynamicSamplingContext.js.map +1 -1
  171. package/build/esm/tracing/google-genai/constants.js +2 -5
  172. package/build/esm/tracing/google-genai/constants.js.map +1 -1
  173. package/build/esm/tracing/google-genai/index.js +42 -37
  174. package/build/esm/tracing/google-genai/index.js.map +1 -1
  175. package/build/esm/tracing/google-genai/streaming.js +2 -23
  176. package/build/esm/tracing/google-genai/streaming.js.map +1 -1
  177. package/build/esm/tracing/langchain/embeddings.js +129 -0
  178. package/build/esm/tracing/langchain/embeddings.js.map +1 -0
  179. package/build/esm/tracing/langchain/index.js +4 -1
  180. package/build/esm/tracing/langchain/index.js.map +1 -1
  181. package/build/esm/tracing/langchain/utils.js +13 -5
  182. package/build/esm/tracing/langchain/utils.js.map +1 -1
  183. package/build/esm/tracing/langgraph/index.js +5 -4
  184. package/build/esm/tracing/langgraph/index.js.map +1 -1
  185. package/build/esm/tracing/openai/index.js +16 -36
  186. package/build/esm/tracing/openai/index.js.map +1 -1
  187. package/build/esm/tracing/openai/streaming.js +4 -35
  188. package/build/esm/tracing/openai/streaming.js.map +1 -1
  189. package/build/esm/tracing/openai/utils.js +79 -196
  190. package/build/esm/tracing/openai/utils.js.map +1 -1
  191. package/build/esm/tracing/sentryNonRecordingSpan.js +7 -0
  192. package/build/esm/tracing/sentryNonRecordingSpan.js.map +1 -1
  193. package/build/esm/tracing/sentrySpan.js +40 -1
  194. package/build/esm/tracing/sentrySpan.js.map +1 -1
  195. package/build/esm/tracing/spans/beforeSendSpan.js +40 -0
  196. package/build/esm/tracing/spans/beforeSendSpan.js.map +1 -0
  197. package/build/esm/tracing/spans/captureSpan.js +122 -0
  198. package/build/esm/tracing/spans/captureSpan.js.map +1 -0
  199. package/build/esm/tracing/spans/envelope.js +36 -0
  200. package/build/esm/tracing/spans/envelope.js.map +1 -0
  201. package/build/esm/tracing/spans/estimateSize.js +39 -0
  202. package/build/esm/tracing/spans/estimateSize.js.map +1 -0
  203. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js +9 -0
  204. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  205. package/build/esm/tracing/spans/spanBuffer.js +156 -0
  206. package/build/esm/tracing/spans/spanBuffer.js.map +1 -0
  207. package/build/esm/tracing/trace.js +84 -14
  208. package/build/esm/tracing/trace.js.map +1 -1
  209. package/build/esm/tracing/utils.js +3 -37
  210. package/build/esm/tracing/utils.js.map +1 -1
  211. package/build/esm/tracing/vercel-ai/constants.js +15 -19
  212. package/build/esm/tracing/vercel-ai/constants.js.map +1 -1
  213. package/build/esm/tracing/vercel-ai/index.js +29 -42
  214. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  215. package/build/esm/tracing/vercel-ai/utils.js +14 -44
  216. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  217. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  218. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  219. package/build/esm/utils/browser.js +2 -3
  220. package/build/esm/utils/browser.js.map +1 -1
  221. package/build/esm/utils/featureFlags.js +6 -0
  222. package/build/esm/utils/featureFlags.js.map +1 -1
  223. package/build/esm/utils/object.js +33 -1
  224. package/build/esm/utils/object.js.map +1 -1
  225. package/build/esm/utils/spanUtils.js +112 -14
  226. package/build/esm/utils/spanUtils.js.map +1 -1
  227. package/build/esm/utils/stacktrace.js +3 -1
  228. package/build/esm/utils/stacktrace.js.map +1 -1
  229. package/build/esm/utils/string.js +3 -0
  230. package/build/esm/utils/string.js.map +1 -1
  231. package/build/esm/utils/version.js +1 -1
  232. package/build/esm/utils/weakRef.js +59 -0
  233. package/build/esm/utils/weakRef.js.map +1 -0
  234. package/build/types/attributes.d.ts +5 -0
  235. package/build/types/attributes.d.ts.map +1 -1
  236. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  237. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts.map +1 -1
  238. package/build/types/client.d.ts +35 -1
  239. package/build/types/client.d.ts.map +1 -1
  240. package/build/types/envelope.d.ts.map +1 -1
  241. package/build/types/fetch.d.ts +12 -8
  242. package/build/types/fetch.d.ts.map +1 -1
  243. package/build/types/index.d.ts +16 -5
  244. package/build/types/index.d.ts.map +1 -1
  245. package/build/types/integration.d.ts.map +1 -1
  246. package/build/types/integrations/conversationId.d.ts.map +1 -1
  247. package/build/types/integrations/express/index.d.ts +82 -0
  248. package/build/types/integrations/express/index.d.ts.map +1 -0
  249. package/build/types/integrations/express/patch-layer.d.ts +32 -0
  250. package/build/types/integrations/express/patch-layer.d.ts.map +1 -0
  251. package/build/types/integrations/express/request-layer-store.d.ts +32 -0
  252. package/build/types/integrations/express/request-layer-store.d.ts.map +1 -0
  253. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  254. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts.map +1 -0
  255. package/build/types/integrations/express/types.d.ts +158 -0
  256. package/build/types/integrations/express/types.d.ts.map +1 -0
  257. package/build/types/integrations/express/utils.d.ts +93 -0
  258. package/build/types/integrations/express/utils.d.ts.map +1 -0
  259. package/build/types/integrations/mcp-server/correlation.d.ts +2 -1
  260. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  261. package/build/types/integrations/mcp-server/handlers.d.ts +9 -4
  262. package/build/types/integrations/mcp-server/handlers.d.ts.map +1 -1
  263. package/build/types/integrations/mcp-server/index.d.ts +2 -1
  264. package/build/types/integrations/mcp-server/index.d.ts.map +1 -1
  265. package/build/types/integrations/mcp-server/types.d.ts +40 -7
  266. package/build/types/integrations/mcp-server/types.d.ts.map +1 -1
  267. package/build/types/integrations/mcp-server/validation.d.ts +4 -1
  268. package/build/types/integrations/mcp-server/validation.d.ts.map +1 -1
  269. package/build/types/integrations/requestdata.d.ts.map +1 -1
  270. package/build/types/integrations/spanStreaming.d.ts +2 -0
  271. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  272. package/build/types/semanticAttributes.d.ts +23 -3
  273. package/build/types/semanticAttributes.d.ts.map +1 -1
  274. package/build/types/tracing/ai/gen-ai-attributes.d.ts +4 -44
  275. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  276. package/build/types/tracing/ai/utils.d.ts +32 -2
  277. package/build/types/tracing/ai/utils.d.ts.map +1 -1
  278. package/build/types/tracing/anthropic-ai/index.d.ts.map +1 -1
  279. package/build/types/tracing/anthropic-ai/streaming.d.ts.map +1 -1
  280. package/build/types/tracing/anthropic-ai/types.d.ts +5 -0
  281. package/build/types/tracing/anthropic-ai/types.d.ts.map +1 -1
  282. package/build/types/tracing/anthropic-ai/utils.d.ts +1 -1
  283. package/build/types/tracing/anthropic-ai/utils.d.ts.map +1 -1
  284. package/build/types/tracing/dynamicSamplingContext.d.ts.map +1 -1
  285. package/build/types/tracing/google-genai/constants.d.ts +1 -3
  286. package/build/types/tracing/google-genai/constants.d.ts.map +1 -1
  287. package/build/types/tracing/google-genai/index.d.ts.map +1 -1
  288. package/build/types/tracing/google-genai/streaming.d.ts.map +1 -1
  289. package/build/types/tracing/google-genai/types.d.ts +5 -0
  290. package/build/types/tracing/google-genai/types.d.ts.map +1 -1
  291. package/build/types/tracing/index.d.ts +1 -0
  292. package/build/types/tracing/index.d.ts.map +1 -1
  293. package/build/types/tracing/langchain/embeddings.d.ts +27 -0
  294. package/build/types/tracing/langchain/embeddings.d.ts.map +1 -0
  295. package/build/types/tracing/langchain/index.d.ts +1 -0
  296. package/build/types/tracing/langchain/index.d.ts.map +1 -1
  297. package/build/types/tracing/langchain/types.d.ts +5 -0
  298. package/build/types/tracing/langchain/types.d.ts.map +1 -1
  299. package/build/types/tracing/langchain/utils.d.ts +2 -2
  300. package/build/types/tracing/langchain/utils.d.ts.map +1 -1
  301. package/build/types/tracing/langgraph/index.d.ts.map +1 -1
  302. package/build/types/tracing/langgraph/types.d.ts +5 -0
  303. package/build/types/tracing/langgraph/types.d.ts.map +1 -1
  304. package/build/types/tracing/openai/index.d.ts.map +1 -1
  305. package/build/types/tracing/openai/streaming.d.ts.map +1 -1
  306. package/build/types/tracing/openai/types.d.ts +5 -0
  307. package/build/types/tracing/openai/types.d.ts.map +1 -1
  308. package/build/types/tracing/openai/utils.d.ts +4 -49
  309. package/build/types/tracing/openai/utils.d.ts.map +1 -1
  310. package/build/types/tracing/sentryNonRecordingSpan.d.ts +12 -1
  311. package/build/types/tracing/sentryNonRecordingSpan.d.ts.map +1 -1
  312. package/build/types/tracing/sentrySpan.d.ts +10 -1
  313. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  314. package/build/types/tracing/spans/beforeSendSpan.d.ts +35 -0
  315. package/build/types/tracing/spans/beforeSendSpan.d.ts.map +1 -0
  316. package/build/types/tracing/spans/captureSpan.d.ts +26 -0
  317. package/build/types/tracing/spans/captureSpan.d.ts.map +1 -0
  318. package/build/types/tracing/spans/envelope.d.ts +8 -0
  319. package/build/types/tracing/spans/envelope.d.ts.map +1 -0
  320. package/build/types/tracing/spans/estimateSize.d.ts +12 -0
  321. package/build/types/tracing/spans/estimateSize.d.ts.map +1 -0
  322. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  323. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts.map +1 -0
  324. package/build/types/tracing/spans/spanBuffer.d.ts +60 -0
  325. package/build/types/tracing/spans/spanBuffer.d.ts.map +1 -0
  326. package/build/types/tracing/trace.d.ts.map +1 -1
  327. package/build/types/tracing/utils.d.ts.map +1 -1
  328. package/build/types/tracing/vercel-ai/constants.d.ts +2 -5
  329. package/build/types/tracing/vercel-ai/constants.d.ts.map +1 -1
  330. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  331. package/build/types/tracing/vercel-ai/utils.d.ts +1 -5
  332. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  333. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  334. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts.map +1 -1
  335. package/build/types/types-hoist/envelope.d.ts +22 -2
  336. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  337. package/build/types/types-hoist/integration.d.ts +8 -0
  338. package/build/types/types-hoist/integration.d.ts.map +1 -1
  339. package/build/types/types-hoist/link.d.ts +2 -2
  340. package/build/types/types-hoist/link.d.ts.map +1 -1
  341. package/build/types/types-hoist/options.d.ts +26 -2
  342. package/build/types/types-hoist/options.d.ts.map +1 -1
  343. package/build/types/types-hoist/span.d.ts +35 -0
  344. package/build/types/types-hoist/span.d.ts.map +1 -1
  345. package/build/types/types-hoist/view-hierarchy.d.ts +1 -0
  346. package/build/types/types-hoist/view-hierarchy.d.ts.map +1 -1
  347. package/build/types/utils/browser.d.ts +1 -1
  348. package/build/types/utils/browser.d.ts.map +1 -1
  349. package/build/types/utils/featureFlags.d.ts.map +1 -1
  350. package/build/types/utils/object.d.ts +10 -0
  351. package/build/types/utils/object.d.ts.map +1 -1
  352. package/build/types/utils/spanUtils.d.ts +27 -2
  353. package/build/types/utils/spanUtils.d.ts.map +1 -1
  354. package/build/types/utils/stacktrace.d.ts.map +1 -1
  355. package/build/types/utils/string.d.ts +2 -2
  356. package/build/types/utils/string.d.ts.map +1 -1
  357. package/build/types/utils/weakRef.d.ts +34 -0
  358. package/build/types/utils/weakRef.d.ts.map +1 -0
  359. package/build/types-ts3.8/attributes.d.ts +5 -0
  360. package/build/types-ts3.8/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  361. package/build/types-ts3.8/client.d.ts +35 -1
  362. package/build/types-ts3.8/fetch.d.ts +14 -10
  363. package/build/types-ts3.8/index.d.ts +16 -5
  364. package/build/types-ts3.8/integrations/express/index.d.ts +82 -0
  365. package/build/types-ts3.8/integrations/express/patch-layer.d.ts +32 -0
  366. package/build/types-ts3.8/integrations/express/request-layer-store.d.ts +32 -0
  367. package/build/types-ts3.8/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  368. package/build/types-ts3.8/integrations/express/types.d.ts +158 -0
  369. package/build/types-ts3.8/integrations/express/utils.d.ts +96 -0
  370. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -1
  371. package/build/types-ts3.8/integrations/mcp-server/handlers.d.ts +9 -4
  372. package/build/types-ts3.8/integrations/mcp-server/index.d.ts +2 -1
  373. package/build/types-ts3.8/integrations/mcp-server/types.d.ts +40 -7
  374. package/build/types-ts3.8/integrations/mcp-server/validation.d.ts +4 -1
  375. package/build/types-ts3.8/integrations/spanStreaming.d.ts +2 -0
  376. package/build/types-ts3.8/semanticAttributes.d.ts +23 -3
  377. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +4 -44
  378. package/build/types-ts3.8/tracing/ai/utils.d.ts +32 -2
  379. package/build/types-ts3.8/tracing/anthropic-ai/types.d.ts +5 -0
  380. package/build/types-ts3.8/tracing/anthropic-ai/utils.d.ts +1 -1
  381. package/build/types-ts3.8/tracing/google-genai/constants.d.ts +1 -3
  382. package/build/types-ts3.8/tracing/google-genai/types.d.ts +5 -0
  383. package/build/types-ts3.8/tracing/index.d.ts +1 -0
  384. package/build/types-ts3.8/tracing/langchain/embeddings.d.ts +27 -0
  385. package/build/types-ts3.8/tracing/langchain/index.d.ts +1 -0
  386. package/build/types-ts3.8/tracing/langchain/types.d.ts +5 -0
  387. package/build/types-ts3.8/tracing/langchain/utils.d.ts +2 -2
  388. package/build/types-ts3.8/tracing/langgraph/types.d.ts +5 -0
  389. package/build/types-ts3.8/tracing/openai/types.d.ts +5 -0
  390. package/build/types-ts3.8/tracing/openai/utils.d.ts +4 -49
  391. package/build/types-ts3.8/tracing/sentryNonRecordingSpan.d.ts +12 -1
  392. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  393. package/build/types-ts3.8/tracing/spans/beforeSendSpan.d.ts +35 -0
  394. package/build/types-ts3.8/tracing/spans/captureSpan.d.ts +26 -0
  395. package/build/types-ts3.8/tracing/spans/envelope.d.ts +8 -0
  396. package/build/types-ts3.8/tracing/spans/estimateSize.d.ts +12 -0
  397. package/build/types-ts3.8/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  398. package/build/types-ts3.8/tracing/spans/spanBuffer.d.ts +60 -0
  399. package/build/types-ts3.8/tracing/vercel-ai/constants.d.ts +2 -5
  400. package/build/types-ts3.8/tracing/vercel-ai/utils.d.ts +1 -5
  401. package/build/types-ts3.8/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  402. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  403. package/build/types-ts3.8/types-hoist/integration.d.ts +8 -0
  404. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  405. package/build/types-ts3.8/types-hoist/options.d.ts +26 -2
  406. package/build/types-ts3.8/types-hoist/span.d.ts +35 -0
  407. package/build/types-ts3.8/types-hoist/view-hierarchy.d.ts +1 -0
  408. package/build/types-ts3.8/utils/browser.d.ts +1 -1
  409. package/build/types-ts3.8/utils/object.d.ts +10 -0
  410. package/build/types-ts3.8/utils/spanUtils.d.ts +27 -2
  411. package/build/types-ts3.8/utils/string.d.ts +2 -2
  412. package/build/types-ts3.8/utils/weakRef.d.ts +34 -0
  413. package/package.json +1 -1
@@ -31,6 +31,8 @@ export { prepareEvent } from './utils/prepareEvent';
31
31
  export { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
32
32
  export { createCheckInEnvelope } from './checkin';
33
33
  export { hasSpansEnabled } from './utils/hasSpansEnabled';
34
+ export { withStreamedSpan } from './tracing/spans/beforeSendSpan';
35
+ export { isStreamedBeforeSendSpanCallback } from './tracing/spans/beforeSendSpan';
34
36
  export { isSentryRequestUrl } from './utils/isSentryRequestUrl';
35
37
  export { handleCallbackErrors } from './utils/handleCallbackErrors';
36
38
  export { parameterize, fmt } from './utils/parameterize';
@@ -38,7 +40,7 @@ export { HandleTunnelRequestOptions } from './utils/tunnel';
38
40
  export { handleTunnelRequest } from './utils/tunnel';
39
41
  export { addAutoIpAddressToSession } from './utils/ipAddress';
40
42
  export { addAutoIpAddressToUser } from './utils/ipAddress';
41
- export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, } from './utils/spanUtils';
43
+ export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanToStreamedSpanJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, INTERNAL_getSegmentSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, } from './utils/spanUtils';
42
44
  export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope';
43
45
  export { parseSampleRate } from './utils/parseSampleRate';
44
46
  export { applySdkMetadata } from './utils/sdkMetadata';
@@ -46,6 +48,9 @@ export { getTraceData } from './utils/traceData';
46
48
  export { shouldPropagateTraceForUrl } from './utils/tracePropagationTargets';
47
49
  export { getTraceMetaTags } from './utils/meta';
48
50
  export { debounce } from './utils/debounce';
51
+ export { makeWeakRef, derefWeakRef } from './utils/weakRef';
52
+ export { MaybeWeakRef } from './utils/weakRef';
53
+ export { shouldIgnoreSpan } from './utils/should-ignore-span';
49
54
  export { winterCGHeadersToDict, winterCGRequestToRequestData, httpRequestToRequestData, extractQueryParamsFromUrl, headersToDict, httpHeadersToSpanAttributes, } from './utils/request';
50
55
  export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants';
51
56
  export { addBreadcrumb } from './breadcrumbs';
@@ -56,6 +61,8 @@ export { linkedErrorsIntegration } from './integrations/linkederrors';
56
61
  export { moduleMetadataIntegration } from './integrations/moduleMetadata';
57
62
  export { requestDataIntegration } from './integrations/requestdata';
58
63
  export { captureConsoleIntegration } from './integrations/captureconsole';
64
+ export { patchExpressModule, setupExpressErrorHandler, expressErrorHandler } from './integrations/express/index';
65
+ export { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types';
59
66
  export { dedupeIntegration } from './integrations/dedupe';
60
67
  export { extraErrorDataIntegration } from './integrations/extraerrordata';
61
68
  export { rewriteFramesIntegration } from './integrations/rewriteframes';
@@ -68,7 +75,7 @@ export { featureFlagsIntegration, FeatureFlagsIntegration } from './integrations
68
75
  export { growthbookIntegration } from './integrations/featureFlags';
69
76
  export { conversationIdIntegration } from './integrations/conversationId';
70
77
  export { profiler } from './profiling';
71
- export { instrumentFetchRequest } from './fetch';
78
+ export { instrumentFetchRequest, _INTERNAL_getTracingHeadersForFetchRequest } from './fetch';
72
79
  export { trpcMiddleware } from './trpc';
73
80
  export { wrapMcpServerWithSentry } from './integrations/mcp-server';
74
81
  export { captureFeedback } from './feedback';
@@ -92,7 +99,7 @@ export { ANTHROPIC_AI_INTEGRATION_NAME } from './tracing/anthropic-ai/constants'
92
99
  export { instrumentGoogleGenAIClient } from './tracing/google-genai';
93
100
  export { GOOGLE_GENAI_INTEGRATION_NAME } from './tracing/google-genai/constants';
94
101
  export { GoogleGenAIResponse } from './tracing/google-genai/types';
95
- export { createLangChainCallbackHandler } from './tracing/langchain';
102
+ export { createLangChainCallbackHandler, instrumentLangChainEmbeddings } from './tracing/langchain';
96
103
  export { LANGCHAIN_INTEGRATION_NAME } from './tracing/langchain/constants';
97
104
  export { LangChainOptions, LangChainIntegration } from './tracing/langchain/types';
98
105
  export { instrumentStateGraphCompile, instrumentLangGraph } from './tracing/langgraph';
@@ -101,6 +108,9 @@ export { LangGraphOptions, LangGraphIntegration, CompiledGraph } from './tracing
101
108
  export { OpenAiClient, OpenAiOptions, InstrumentedMethod } from './tracing/openai/types';
102
109
  export { AnthropicAiClient, AnthropicAiOptions, AnthropicAiInstrumentedMethod, AnthropicAiResponse, } from './tracing/anthropic-ai/types';
103
110
  export { GoogleGenAIClient, GoogleGenAIChat, GoogleGenAIOptions, GoogleGenAIIstrumentedMethod, } from './tracing/google-genai/types';
111
+ export { SpanBuffer } from './tracing/spans/spanBuffer';
112
+ export { hasSpanStreamingEnabled } from './tracing/spans/hasSpanStreamingEnabled';
113
+ export { spanStreamingIntegration } from './integrations/spanStreaming';
104
114
  export { FeatureFlag } from './utils/featureFlags';
105
115
  export { _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_FLAG_BUFFER_SIZE, _INTERNAL_MAX_FLAGS_PER_SPAN, } from './utils/featureFlags';
106
116
  export { applyAggregateErrorsToEvent } from './utils/aggregate-errors';
@@ -160,7 +170,7 @@ export { Context, Contexts, DeviceContext, OsContext, AppContext, CultureContext
160
170
  export { DataCategory } from './types-hoist/datacategory';
161
171
  export { DsnComponents, DsnLike, DsnProtocol } from './types-hoist/dsn';
162
172
  export { DebugImage, DebugMeta } from './types-hoist/debugMeta';
163
- 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';
173
+ 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, StreamedSpanEnvelope, SpanItem, LogEnvelope, MetricEnvelope, } from './types-hoist/envelope';
164
174
  export { ExtendedError } from './types-hoist/error';
165
175
  export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types-hoist/event';
166
176
  export { EventProcessor } from './types-hoist/eventprocessor';
@@ -181,9 +191,10 @@ export { SdkInfo } from './types-hoist/sdkinfo';
181
191
  export { SdkMetadata } from './types-hoist/sdkmetadata';
182
192
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, SerializedSession, } from './types-hoist/session';
183
193
  export { SeverityLevel } from './types-hoist/severity';
184
- export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, } from './types-hoist/span';
194
+ export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, SerializedStreamedSpan, SerializedStreamedSpanContainer, StreamedSpanJSON, } from './types-hoist/span';
185
195
  export { SpanStatus } from './types-hoist/spanStatus';
186
196
  export { Log, LogSeverityLevel } from './types-hoist/log';
197
+ export { SpanLink } from './types-hoist/link';
187
198
  export { Metric, MetricType, SerializedMetric, SerializedMetricContainer, SerializedMetricAttributeValue, } from './types-hoist/metric';
188
199
  export { TimedEvent } from './types-hoist/timedEvent';
189
200
  export { StackFrame } from './types-hoist/stackframe';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ import { ExpressErrorMiddleware, ExpressHandlerOptions, ExpressIntegrationOptions, ExpressModuleExport } from './types';
30
+ /**
31
+ * This is a portable instrumentatiton function that works in any environment
32
+ * where Express can be loaded, without depending on OpenTelemetry.
33
+ *
34
+ * @example
35
+ * ```javascript
36
+ * import express from 'express';
37
+ * import * as Sentry from '@sentry/deno'; // or any SDK that extends core
38
+ *
39
+ * Sentry.patchExpressModule(express, () => ({}));
40
+ * ```
41
+ */
42
+ export declare function patchExpressModule(moduleExports: ExpressModuleExport, getOptions: () => ExpressIntegrationOptions): ExpressModuleExport;
43
+ /**
44
+ * @deprecated Pass the Express module export as the first argument and options getter as the second argument.
45
+ */
46
+ export declare function patchExpressModule(options: ExpressIntegrationOptions & {
47
+ express: ExpressModuleExport;
48
+ }): ExpressModuleExport;
49
+ /**
50
+ * An Express-compatible error handler, used by setupExpressErrorHandler
51
+ */
52
+ export declare function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware;
53
+ /**
54
+ * Add an Express error handler to capture errors to Sentry.
55
+ *
56
+ * The error handler must be before any other middleware and after all controllers.
57
+ *
58
+ * @param app The Express instances
59
+ * @param options {ExpressHandlerOptions} Configuration options for the handler
60
+ *
61
+ * @example
62
+ * ```javascript
63
+ * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>
64
+ * import * as express from 'express';
65
+ *
66
+ * Sentry.instrumentExpress(express);
67
+ *
68
+ * const app = express();
69
+ *
70
+ * // Add your routes, etc.
71
+ *
72
+ * // Add this after all routes,
73
+ * // but before any and other error-handling middlewares are defined
74
+ * Sentry.setupExpressErrorHandler(app);
75
+ *
76
+ * app.listen(3000);
77
+ * ```
78
+ */
79
+ export declare function setupExpressErrorHandler(app: {
80
+ use: (middleware: any) => unknown;
81
+ }, options?: ExpressHandlerOptions): void;
82
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ import { ExpressIntegrationOptions, ExpressLayer } from './types';
30
+ export type ExpressPatchLayerOptions = Pick<ExpressIntegrationOptions, 'onRouteResolved' | 'ignoreLayers' | 'ignoreLayersType'>;
31
+ export declare function patchLayer(getOptions: () => ExpressPatchLayerOptions, maybeLayer?: ExpressLayer, layerPath?: string): void;
32
+ //# sourceMappingURL=patch-layer.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ import { ExpressRequest } from './types';
30
+ export declare const storeLayer: (req: ExpressRequest, layer: string) => void;
31
+ export declare const getStoredLayers: (req: ExpressRequest) => string[];
32
+ //# sourceMappingURL=request-layer-store.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ /**
30
+ * Abstract this out because we call it in multiple places, and it's cheaper to
31
+ * only do one time for any given request.
32
+ */
33
+ import { ExpressRequest } from './types';
34
+ export declare function setSDKProcessingMetadata(request: ExpressRequest): void;
35
+ //# sourceMappingURL=set-sdk-processing-metadata.d.ts.map
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ import { RequestEventData } from '../../types-hoist/request';
30
+ import { SpanAttributes } from '../../types-hoist/span';
31
+ export declare const ATTR_EXPRESS_NAME = "express.name";
32
+ export declare const ATTR_HTTP_ROUTE = "http.route";
33
+ export declare const ATTR_EXPRESS_TYPE = "express.type";
34
+ export type ExpressExport = {
35
+ Router: ExpressRouterv5 | ExpressRouterv4;
36
+ application: ExpressApplication;
37
+ };
38
+ export type ExpressExportv5 = ExpressExport & {
39
+ Router: ExpressRouterv5;
40
+ };
41
+ export type ExpressExportv4 = ExpressExport & {
42
+ Router: ExpressRouterv4;
43
+ };
44
+ export type ExpressModuleExport = ExpressExport | {
45
+ default: ExpressExport;
46
+ };
47
+ export interface ExpressRequest extends RequestEventData {
48
+ originalUrl: string;
49
+ route: unknown;
50
+ res?: ExpressResponse;
51
+ }
52
+ export interface ExpressResponse {
53
+ once(ev: string, listener: Function): this;
54
+ removeListener(ev: string, listener?: Function): this;
55
+ emit(ev: string, ...data: unknown[]): this;
56
+ }
57
+ export interface NextFunction {
58
+ (err?: unknown): void;
59
+ /**
60
+ * "Break-out" of a router by calling {next('router')};
61
+ * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
62
+ */
63
+ (deferToNext: 'router'): void;
64
+ /**
65
+ * "Break-out" of a route by calling {next('route')};
66
+ * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}
67
+ */
68
+ (deferToNext: 'route'): void;
69
+ }
70
+ export type ExpressApplicationRequestHandler = (...handlers: any[]) => any;
71
+ export type ExpressRequestInfo<T = unknown> = {
72
+ /** An express request object */
73
+ request: T;
74
+ route: string;
75
+ layerType: ExpressLayerType;
76
+ };
77
+ export type ExpressLayerType = 'router' | 'middleware' | 'request_handler';
78
+ export declare const ExpressLayerType_ROUTER = "router";
79
+ export declare const ExpressLayerType_MIDDLEWARE = "middleware";
80
+ export declare const ExpressLayerType_REQUEST_HANDLER = "request_handler";
81
+ export type PathParams = string | RegExp | Array<string | RegExp>;
82
+ export type LayerPathSegment = string | RegExp | number;
83
+ export interface ExpressRoute {
84
+ path: string;
85
+ stack: ExpressLayer[];
86
+ }
87
+ export type ExpressRouterv4 = ExpressRouter;
88
+ export interface ExpressRouterv5 {
89
+ prototype: ExpressRouter;
90
+ }
91
+ export type ExpressLayer = {
92
+ handle: Function & Record<string, unknown> & {
93
+ stack?: ExpressLayer[];
94
+ };
95
+ name: string;
96
+ params: {
97
+ [key: string]: string;
98
+ };
99
+ path?: string;
100
+ regexp: RegExp;
101
+ route?: ExpressLayer;
102
+ };
103
+ export type ExpressRouter = {
104
+ params: {
105
+ [key: string]: string;
106
+ };
107
+ _params: string[];
108
+ caseSensitive: boolean;
109
+ mergeParams: boolean;
110
+ strict: boolean;
111
+ stack: ExpressLayer[];
112
+ route(prefix: PathParams): ExpressRoute;
113
+ use(...handlers: unknown[]): unknown;
114
+ };
115
+ export type IgnoreMatcher = string | RegExp | ((name: string) => boolean);
116
+ export type ExpressIntegrationOptions = {
117
+ /**
118
+ * @deprecated Pass the express module as the first argument, and an
119
+ * options getter as the second argument to patchExpressModule.
120
+ */
121
+ express?: ExpressModuleExport;
122
+ /** Ignore specific based on their name */
123
+ ignoreLayers?: IgnoreMatcher[];
124
+ /** Ignore specific layers based on their type */
125
+ ignoreLayersType?: ExpressLayerType[];
126
+ /**
127
+ * Optional callback invoked each time a layer resolves the matched HTTP route.
128
+ * Platform-specific integrations (e.g. Node.js) use this to propagate the
129
+ * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).
130
+ */
131
+ onRouteResolved?: (route: string | undefined) => void;
132
+ };
133
+ export type LayerMetadata = {
134
+ attributes: SpanAttributes;
135
+ name: string;
136
+ };
137
+ export interface ExpressApplication {
138
+ stack: ExpressLayer[];
139
+ use: ExpressApplicationRequestHandler;
140
+ }
141
+ export interface MiddlewareError extends Error {
142
+ status?: number | string;
143
+ statusCode?: number | string;
144
+ status_code?: number | string;
145
+ output?: {
146
+ statusCode?: number | string;
147
+ };
148
+ }
149
+ export type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;
150
+ export type ExpressErrorMiddleware = (error: MiddlewareError, req: ExpressRequest, res: ExpressResponse, next: (error: MiddlewareError) => void) => void;
151
+ export interface ExpressHandlerOptions {
152
+ /**
153
+ * Callback method deciding whether error should be captured and sent to Sentry
154
+ * @param error Captured middleware error
155
+ */
156
+ shouldHandleError?(this: void, error: MiddlewareError): boolean;
157
+ }
158
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Platform-portable Express tracing integration.
3
+ *
4
+ * @module
5
+ *
6
+ * This Sentry integration is a derivative work based on the OpenTelemetry
7
+ * Express instrumentation.
8
+ *
9
+ * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>
10
+ *
11
+ * Extended under the terms of the Apache 2.0 license linked below:
12
+ *
13
+ * ----
14
+ *
15
+ * Copyright The OpenTelemetry Authors
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * https://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ import { SpanAttributes } from '../../types-hoist/span';
30
+ import { ExpressExport, ExpressIntegrationOptions, ExpressLayer, ExpressLayerType, ExpressRequest, MiddlewareError, ExpressExportv5, ExpressExportv4 } from './types';
31
+ import { ATTR_EXPRESS_NAME, ATTR_EXPRESS_TYPE } from './types';
32
+ /**
33
+ * Converts a user-provided error value into an error and error message pair
34
+ *
35
+ * @param error - User-provided error value
36
+ * @returns Both an Error or string representation of the value and an error message
37
+ */
38
+ export declare const asErrorAndMessage: (error: unknown) => [
39
+ string | Error,
40
+ string
41
+ ];
42
+ /**
43
+ * Checks if a route contains parameter patterns (e.g., :id, :userId)
44
+ * which are valid even if they don't exactly match the original URL
45
+ */
46
+ export declare function isRoutePattern(route: string): boolean;
47
+ /**
48
+ * Parse express layer context to retrieve a name and attributes.
49
+ * @param route The route of the layer
50
+ * @param layer Express layer
51
+ * @param [layerPath] if present, the path on which the layer has been mounted
52
+ */
53
+ export declare const getLayerMetadata: (route: string, layer: ExpressLayer, layerPath?: string) => {
54
+ attributes: SpanAttributes & {
55
+ [ATTR_EXPRESS_NAME]: string;
56
+ [ATTR_EXPRESS_TYPE]: ExpressLayerType;
57
+ };
58
+ name: string;
59
+ };
60
+ /**
61
+ * Recursively search the router path from layer stack
62
+ * @param path The path to reconstruct
63
+ * @param layer The layer to reconstruct from
64
+ * @returns The reconstructed path
65
+ */
66
+ export declare const getRouterPath: (path: string, layer: ExpressLayer) => string;
67
+ /**
68
+ * Check whether the given request is ignored by configuration
69
+ * It will not re-throw exceptions from `list` provided by the client
70
+ * @param constant e.g URL of request
71
+ * @param [list] List of ignore patterns
72
+ * @param [onException] callback for doing something when an exception has
73
+ * occurred
74
+ */
75
+ export type ExpressIsLayerIgnoredOptions = Pick<ExpressIntegrationOptions, 'ignoreLayersType' | 'ignoreLayers'>;
76
+ export declare const isLayerIgnored: (name: string, type: ExpressLayerType, config?: ExpressIsLayerIgnoredOptions) => boolean;
77
+ /**
78
+ * Extracts the actual matched route from Express request for OpenTelemetry instrumentation.
79
+ * Returns the route that should be used as the http.route attribute.
80
+ *
81
+ * @param req - The Express request object with layers store
82
+ * @param constructedRoute - The constructed route from `getConstructedRoute`
83
+ * @returns The matched route string or undefined if no valid route is found
84
+ */
85
+ export declare function getActualMatchedRoute(req: ExpressRequest, constructedRoute: string): string | undefined;
86
+ export declare function getConstructedRoute(req: ExpressRequest): string;
87
+ export declare const getLayerPath: (args: unknown[]) => string | undefined;
88
+ export declare const isExpressWithRouterPrototype: (express: unknown) => express is ExpressExportv5;
89
+ export declare const isExpressWithoutRouterPrototype: (express: unknown) => express is ExpressExportv4;
90
+ export declare const hasDefaultProp: (express: unknown) => express is {
91
+ [k: string]: unknown;
92
+ default: ExpressExport;
93
+ };
94
+ /** Returns true if response code is internal server error */
95
+ export declare function defaultShouldHandleError(error: MiddlewareError): boolean;
96
+ //# sourceMappingURL=utils.d.ts.map
@@ -25,8 +25,9 @@ export declare function storeSpanForRequest(transport: MCPTransport, requestId:
25
25
  * @param requestId - Request identifier
26
26
  * @param result - Execution result for attribute extraction
27
27
  * @param options - Resolved MCP options
28
+ * @param hasError - Whether the JSON-RPC response contained an error
28
29
  */
29
- export declare function completeSpanWithResults(transport: MCPTransport, requestId: RequestId, result: unknown, options: ResolvedMcpOptions): void;
30
+ export declare function completeSpanWithResults(transport: MCPTransport, requestId: RequestId, result: unknown, options: ResolvedMcpOptions, hasError?: boolean): void;
30
31
  /**
31
32
  * Cleans up pending spans for a specific transport (when that transport closes)
32
33
  * @param transport - MCP transport instance
@@ -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