@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
@@ -1,6 +1,7 @@
1
1
  import { ReportDialogOptions } from './report-dialog';
2
2
  import { DsnComponents, DsnLike } from './types-hoist/dsn';
3
3
  import { SdkInfo } from './types-hoist/sdkinfo';
4
+ export declare const SENTRY_API_VERSION = "7";
4
5
  /**
5
6
  * Returns the envelope endpoint URL with auth in the query string.
6
7
  *
@@ -1,6 +1,6 @@
1
1
  import { Scope } from '../scope';
2
2
  import { getTraceData } from '../utils/traceData';
3
- import { continueTrace, startInactiveSpan, startSpan, startSpanManual, suppressTracing, withActiveSpan } from './../tracing/trace';
3
+ import { continueTrace, startInactiveSpan, startNewTrace, startSpan, startSpanManual, suppressTracing, withActiveSpan } from './../tracing/trace';
4
4
  import { getActiveSpan } from './../utils/spanUtils';
5
5
  /**
6
6
  * @private Private API with no semver guarantees!
@@ -52,5 +52,7 @@ export interface AsyncContextStrategy {
52
52
  * and `<meta name="baggage">` HTML tags.
53
53
  */
54
54
  continueTrace?: typeof continueTrace;
55
+ /** Start a new trace, ensuring all spans in the callback share the same traceId. */
56
+ startNewTrace?: typeof startNewTrace;
55
57
  }
56
58
  //# sourceMappingURL=types.d.ts.map
@@ -66,5 +66,10 @@ export declare function attributeValueToTypedAttributeValue(rawValue: unknown, u
66
66
  * @returns The serialized attributes.
67
67
  */
68
68
  export declare function serializeAttributes<T>(attributes: RawAttributes<T> | undefined, fallback?: boolean | 'skip-undefined'): Attributes;
69
+ /**
70
+ * Estimates the serialized byte size of {@link Attributes},
71
+ * with a couple of heuristics for performance.
72
+ */
73
+ export declare function estimateTypedAttributesSizeInBytes(attributes: Attributes | undefined): number;
69
74
  export {};
70
75
  //# sourceMappingURL=attributes.d.ts.map
@@ -18,7 +18,7 @@ import { RequestEventData } from './types-hoist/request';
18
18
  import { SdkMetadata } from './types-hoist/sdkmetadata';
19
19
  import { Session, SessionAggregates } from './types-hoist/session';
20
20
  import { SeverityLevel } from './types-hoist/severity';
21
- import { Span, SpanAttributes, SpanContextData } from './types-hoist/span';
21
+ import { Span, SpanAttributes, SpanContextData, StreamedSpanJSON } from './types-hoist/span';
22
22
  import { StartSpanOptions } from './types-hoist/startSpanOptions';
23
23
  import { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
24
24
  import { PromiseBuffer } from './utils/promisebuffer';
@@ -210,6 +210,24 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
210
210
  * @returns {() => void} A function that, when executed, removes the registered callback.
211
211
  */
212
212
  on(hook: 'spanEnd', callback: (span: Span) => void): () => void;
213
+ /**
214
+ * Register a callback for after a span is ended and the `spanEnd` hook has run.
215
+ * NOTE: The span cannot be mutated anymore in this callback.
216
+ */
217
+ on(hook: 'afterSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;
218
+ /**
219
+ * Register a callback for after a segment span is ended and the `segmentSpanEnd` hook has run.
220
+ * NOTE: The segment span cannot be mutated anymore in this callback.
221
+ */
222
+ on(hook: 'afterSegmentSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;
223
+ /**
224
+ * Register a callback for when a span JSON is processed, to add some data to the span JSON.
225
+ */
226
+ on(hook: 'processSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;
227
+ /**
228
+ * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.
229
+ */
230
+ on(hook: 'processSegmentSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;
213
231
  /**
214
232
  * Register a callback for when an idle span is allowed to auto-finish.
215
233
  * @returns {() => void} A function that, when executed, removes the registered callback.
@@ -405,6 +423,22 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
405
423
  }): void;
406
424
  /** Fire a hook whenever a span ends. */
407
425
  emit(hook: 'spanEnd', span: Span): void;
426
+ /**
427
+ * Fire a hook event after a span ends and the `spanEnd` hook has run.
428
+ */
429
+ emit(hook: 'afterSpanEnd', immutableSpan: Readonly<Span>): void;
430
+ /**
431
+ * Fire a hook event after a segment span ends and the `spanEnd` hook has run.
432
+ */
433
+ emit(hook: 'afterSegmentSpanEnd', immutableSegmentSpan: Readonly<Span>): void;
434
+ /**
435
+ * Fire a hook event when a span JSON is processed, to add some data to the span JSON.
436
+ */
437
+ emit(hook: 'processSpan', streamedSpanJSON: StreamedSpanJSON): void;
438
+ /**
439
+ * Fire a hook event for when a segment span JSON is processed, to add some data to the segment span JSON.
440
+ */
441
+ emit(hook: 'processSegmentSpan', streamedSpanJSON: StreamedSpanJSON): void;
408
442
  /**
409
443
  * Fire a hook indicating that an idle span is allowed to auto finish.
410
444
  */
@@ -1,6 +1,26 @@
1
1
  import { Client } from './client';
2
2
  import { Scope } from './scope';
3
3
  import { TraceContext } from './types-hoist/context';
4
+ /**
5
+ * Register an external propagation context provider function.
6
+ * When registered, trace context will be read from the external source (e.g. OpenTelemetry)
7
+ * instead of from the Sentry scope's propagation context.
8
+ */
9
+ export declare function registerExternalPropagationContext(fn: () => {
10
+ traceId: string;
11
+ spanId: string;
12
+ } | undefined): void;
13
+ /**
14
+ * Get the external propagation context, if a provider has been registered.
15
+ */
16
+ export declare function getExternalPropagationContext(): {
17
+ traceId: string;
18
+ spanId: string;
19
+ } | undefined;
20
+ /**
21
+ * Check if an external propagation context provider has been registered.
22
+ */
23
+ export declare function hasExternalPropagationContext(): boolean;
4
24
  /**
5
25
  * Get the currently active scope.
6
26
  */
@@ -8,7 +8,7 @@ export * from './tracing';
8
8
  export * from './semanticAttributes';
9
9
  export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope';
10
10
  export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports';
11
- export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, } from './currentScopes';
11
+ export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, registerExternalPropagationContext, getExternalPropagationContext, hasExternalPropagationContext, } from './currentScopes';
12
12
  export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes';
13
13
  export { setAsyncContextStrategy } from './asyncContext';
14
14
  export { getGlobalSingleton, getMainCarrier } from './carrier';
@@ -16,7 +16,7 @@ export { makeSession, closeSession, updateSession } from './session';
16
16
  export { Scope } from './scope';
17
17
  export { CaptureContext, ScopeContext, ScopeData } from './scope';
18
18
  export { notifyEventProcessors } from './eventProcessors';
19
- export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api';
19
+ export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint, SENTRY_API_VERSION } from './api';
20
20
  export { Client } from './client';
21
21
  export { ServerRuntimeClient } from './server-runtime-client';
22
22
  export { initAndBind, setCurrentClient } from './sdk';
@@ -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,7 @@ 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 { shouldIgnoreSpan } from './utils/should-ignore-span';
49
52
  export { winterCGHeadersToDict, winterCGRequestToRequestData, httpRequestToRequestData, extractQueryParamsFromUrl, headersToDict, httpHeadersToSpanAttributes, } from './utils/request';
50
53
  export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants';
51
54
  export { addBreadcrumb } from './breadcrumbs';
@@ -56,6 +59,8 @@ export { linkedErrorsIntegration } from './integrations/linkederrors';
56
59
  export { moduleMetadataIntegration } from './integrations/moduleMetadata';
57
60
  export { requestDataIntegration } from './integrations/requestdata';
58
61
  export { captureConsoleIntegration } from './integrations/captureconsole';
62
+ export { patchExpressModule, setupExpressErrorHandler, expressErrorHandler } from './integrations/express/index';
63
+ export { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types';
59
64
  export { dedupeIntegration } from './integrations/dedupe';
60
65
  export { extraErrorDataIntegration } from './integrations/extraerrordata';
61
66
  export { rewriteFramesIntegration } from './integrations/rewriteframes';
@@ -92,7 +97,7 @@ export { ANTHROPIC_AI_INTEGRATION_NAME } from './tracing/anthropic-ai/constants'
92
97
  export { instrumentGoogleGenAIClient } from './tracing/google-genai';
93
98
  export { GOOGLE_GENAI_INTEGRATION_NAME } from './tracing/google-genai/constants';
94
99
  export { GoogleGenAIResponse } from './tracing/google-genai/types';
95
- export { createLangChainCallbackHandler } from './tracing/langchain';
100
+ export { createLangChainCallbackHandler, instrumentLangChainEmbeddings } from './tracing/langchain';
96
101
  export { LANGCHAIN_INTEGRATION_NAME } from './tracing/langchain/constants';
97
102
  export { LangChainOptions, LangChainIntegration } from './tracing/langchain/types';
98
103
  export { instrumentStateGraphCompile, instrumentLangGraph } from './tracing/langgraph';
@@ -101,6 +106,9 @@ export { LangGraphOptions, LangGraphIntegration, CompiledGraph } from './tracing
101
106
  export { OpenAiClient, OpenAiOptions, InstrumentedMethod } from './tracing/openai/types';
102
107
  export { AnthropicAiClient, AnthropicAiOptions, AnthropicAiInstrumentedMethod, AnthropicAiResponse, } from './tracing/anthropic-ai/types';
103
108
  export { GoogleGenAIClient, GoogleGenAIChat, GoogleGenAIOptions, GoogleGenAIIstrumentedMethod, } from './tracing/google-genai/types';
109
+ export { SpanBuffer } from './tracing/spans/spanBuffer';
110
+ export { hasSpanStreamingEnabled } from './tracing/spans/hasSpanStreamingEnabled';
111
+ export { spanStreamingIntegration } from './integrations/spanStreaming';
104
112
  export { FeatureFlag } from './utils/featureFlags';
105
113
  export { _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_FLAG_BUFFER_SIZE, _INTERNAL_MAX_FLAGS_PER_SPAN, } from './utils/featureFlags';
106
114
  export { applyAggregateErrorsToEvent } from './utils/aggregate-errors';
@@ -160,7 +168,7 @@ export { Context, Contexts, DeviceContext, OsContext, AppContext, CultureContext
160
168
  export { DataCategory } from './types-hoist/datacategory';
161
169
  export { DsnComponents, DsnLike, DsnProtocol } from './types-hoist/dsn';
162
170
  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';
171
+ 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
172
  export { ExtendedError } from './types-hoist/error';
165
173
  export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types-hoist/event';
166
174
  export { EventProcessor } from './types-hoist/eventprocessor';
@@ -181,7 +189,7 @@ export { SdkInfo } from './types-hoist/sdkinfo';
181
189
  export { SdkMetadata } from './types-hoist/sdkmetadata';
182
190
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, SerializedSession, } from './types-hoist/session';
183
191
  export { SeverityLevel } from './types-hoist/severity';
184
- export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, } from './types-hoist/span';
192
+ export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, SerializedStreamedSpan, SerializedStreamedSpanContainer, StreamedSpanJSON, } from './types-hoist/span';
185
193
  export { SpanStatus } from './types-hoist/spanStatus';
186
194
  export { Log, LogSeverityLevel } from './types-hoist/log';
187
195
  export { Metric, MetricType, SerializedMetric, SerializedMetricContainer, SerializedMetricAttributeValue, } from './types-hoist/metric';
@@ -208,4 +216,5 @@ export { LegacyCSPReport } from './types-hoist/csp';
208
216
  export { SerializedLog, SerializedLogContainer } from './types-hoist/log';
209
217
  export { BuildTimeOptionsBase, UnstableVitePluginOptions, UnstableRollupPluginOptions, UnstableWebpackPluginOptions, } from './build-time-plugins/buildTimeOptionsBase';
210
218
  export { withRandomSafeContext as _INTERNAL_withRandomSafeContext, RandomSafeContextRunner as _INTERNAL_RandomSafeContextRunner, safeMathRandom as _INTERNAL_safeMathRandom, safeDateNow as _INTERNAL_safeDateNow } from './utils/randomSafeContext';
219
+ export { safeUnref as _INTERNAL_safeUnref } from './utils/timer';
211
220
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,75 @@
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, ExpressExport, ExpressHandlerOptions, ExpressIntegrationOptions } 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
+ export declare const patchExpressModule: (options: ExpressIntegrationOptions) => ExpressExport;
42
+ /**
43
+ * An Express-compatible error handler, used by setupExpressErrorHandler
44
+ */
45
+ export declare function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware;
46
+ /**
47
+ * Add an Express error handler to capture errors to Sentry.
48
+ *
49
+ * The error handler must be before any other middleware and after all controllers.
50
+ *
51
+ * @param app The Express instances
52
+ * @param options {ExpressHandlerOptions} Configuration options for the handler
53
+ *
54
+ * @example
55
+ * ```javascript
56
+ * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>
57
+ * import * as express from 'express';
58
+ *
59
+ * Sentry.instrumentExpress(express);
60
+ *
61
+ * const app = express();
62
+ *
63
+ * // Add your routes, etc.
64
+ *
65
+ * // Add this after all routes,
66
+ * // but before any and other error-handling middlewares are defined
67
+ * Sentry.setupExpressErrorHandler(app);
68
+ *
69
+ * app.listen(3000);
70
+ * ```
71
+ */
72
+ export declare function setupExpressErrorHandler(app: {
73
+ use: (middleware: any) => unknown;
74
+ }, options?: ExpressHandlerOptions): void;
75
+ //# 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(options: 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,154 @@
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
+ express: ExpressModuleExport;
118
+ /** Ignore specific based on their name */
119
+ ignoreLayers?: IgnoreMatcher[];
120
+ /** Ignore specific layers based on their type */
121
+ ignoreLayersType?: ExpressLayerType[];
122
+ /**
123
+ * Optional callback invoked each time a layer resolves the matched HTTP route.
124
+ * Platform-specific integrations (e.g. Node.js) use this to propagate the
125
+ * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).
126
+ */
127
+ onRouteResolved?: (route: string | undefined) => void;
128
+ };
129
+ export type LayerMetadata = {
130
+ attributes: SpanAttributes;
131
+ name: string;
132
+ };
133
+ export interface ExpressApplication {
134
+ stack: ExpressLayer[];
135
+ use: ExpressApplicationRequestHandler;
136
+ }
137
+ export interface MiddlewareError extends Error {
138
+ status?: number | string;
139
+ statusCode?: number | string;
140
+ status_code?: number | string;
141
+ output?: {
142
+ statusCode?: number | string;
143
+ };
144
+ }
145
+ export type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;
146
+ export type ExpressErrorMiddleware = (error: MiddlewareError, req: ExpressRequest, res: ExpressResponse, next: (error: MiddlewareError) => void) => void;
147
+ export interface ExpressHandlerOptions {
148
+ /**
149
+ * Callback method deciding whether error should be captured and sent to Sentry
150
+ * @param error Captured middleware error
151
+ */
152
+ shouldHandleError?(this: void, error: MiddlewareError): boolean;
153
+ }
154
+ //# 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