@sentry/core 10.37.0 → 10.39.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/build/cjs/attributes.js.map +1 -1
  2. package/build/cjs/client.js +22 -12
  3. package/build/cjs/client.js.map +1 -1
  4. package/build/cjs/envelope.js +41 -7
  5. package/build/cjs/envelope.js.map +1 -1
  6. package/build/cjs/index.js +131 -79
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/cjs/integration.js +12 -0
  9. package/build/cjs/integration.js.map +1 -1
  10. package/build/cjs/integrations/captureconsole.js +2 -2
  11. package/build/cjs/integrations/captureconsole.js.map +1 -1
  12. package/build/cjs/integrations/eventFilters.js +1 -1
  13. package/build/cjs/integrations/eventFilters.js.map +1 -1
  14. package/build/cjs/integrations/mcp-server/correlation.js +54 -10
  15. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  16. package/build/cjs/integrations/mcp-server/errorCapture.js +2 -2
  17. package/build/cjs/integrations/mcp-server/errorCapture.js.map +1 -1
  18. package/build/cjs/integrations/mcp-server/sessionManagement.js +50 -16
  19. package/build/cjs/integrations/mcp-server/sessionManagement.js.map +1 -1
  20. package/build/cjs/integrations/requestdata.js +72 -6
  21. package/build/cjs/integrations/requestdata.js.map +1 -1
  22. package/build/cjs/integrations/spanStreaming.js +54 -0
  23. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  24. package/build/cjs/integrations/supabase.js +4 -4
  25. package/build/cjs/integrations/supabase.js.map +1 -1
  26. package/build/cjs/metrics/public-api.js +3 -3
  27. package/build/cjs/metrics/public-api.js.map +1 -1
  28. package/build/cjs/scope.js +1 -1
  29. package/build/cjs/scope.js.map +1 -1
  30. package/build/cjs/semanticAttributes.js +84 -0
  31. package/build/cjs/semanticAttributes.js.map +1 -1
  32. package/build/cjs/spans/captureSpan.js +104 -0
  33. package/build/cjs/spans/captureSpan.js.map +1 -0
  34. package/build/cjs/spans/spanBuffer.js +121 -0
  35. package/build/cjs/spans/spanBuffer.js.map +1 -0
  36. package/build/cjs/spans/spanFirstUtils.js +186 -0
  37. package/build/cjs/spans/spanFirstUtils.js.map +1 -0
  38. package/build/cjs/tracing/ai/gen-ai-attributes.js +6 -0
  39. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  40. package/build/cjs/tracing/anthropic-ai/index.js +3 -3
  41. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  42. package/build/cjs/tracing/anthropic-ai/streaming.js +3 -3
  43. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  44. package/build/cjs/tracing/anthropic-ai/utils.js +2 -2
  45. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  46. package/build/cjs/tracing/google-genai/index.js +3 -3
  47. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  48. package/build/cjs/tracing/google-genai/streaming.js +2 -2
  49. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  50. package/build/cjs/tracing/langchain/index.js +4 -4
  51. package/build/cjs/tracing/langchain/index.js.map +1 -1
  52. package/build/cjs/tracing/langgraph/index.js +3 -3
  53. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  54. package/build/cjs/tracing/openai/index.js +136 -53
  55. package/build/cjs/tracing/openai/index.js.map +1 -1
  56. package/build/cjs/tracing/openai/streaming.js +2 -2
  57. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  58. package/build/cjs/tracing/sentrySpan.js +32 -0
  59. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  60. package/build/cjs/tracing/trace.js +1 -0
  61. package/build/cjs/tracing/trace.js.map +1 -1
  62. package/build/cjs/tracing/vercel-ai/constants.js +4 -0
  63. package/build/cjs/tracing/vercel-ai/constants.js.map +1 -1
  64. package/build/cjs/tracing/vercel-ai/index.js +14 -0
  65. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  66. package/build/cjs/tracing/vercel-ai/utils.js +71 -22
  67. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  68. package/build/cjs/transports/base.js +18 -2
  69. package/build/cjs/transports/base.js.map +1 -1
  70. package/build/cjs/transports/offline.js +16 -17
  71. package/build/cjs/transports/offline.js.map +1 -1
  72. package/build/cjs/trpc.js +3 -3
  73. package/build/cjs/trpc.js.map +1 -1
  74. package/build/cjs/utils/aggregate-errors.js +13 -5
  75. package/build/cjs/utils/aggregate-errors.js.map +1 -1
  76. package/build/cjs/utils/beforeSendSpan.js +36 -0
  77. package/build/cjs/utils/beforeSendSpan.js.map +1 -0
  78. package/build/cjs/utils/envToBool.js +32 -0
  79. package/build/cjs/utils/envToBool.js.map +1 -0
  80. package/build/cjs/utils/exports.js +7 -7
  81. package/build/cjs/utils/exports.js.map +1 -1
  82. package/build/cjs/utils/featureFlags.js +1 -0
  83. package/build/cjs/utils/featureFlags.js.map +1 -1
  84. package/build/cjs/utils/flushIfServerless.js +2 -2
  85. package/build/cjs/utils/flushIfServerless.js.map +1 -1
  86. package/build/cjs/utils/hasSpanStreamingEnabled.js +21 -0
  87. package/build/cjs/utils/hasSpanStreamingEnabled.js.map +1 -0
  88. package/build/cjs/utils/prepareEvent.js +6 -1
  89. package/build/cjs/utils/prepareEvent.js.map +1 -1
  90. package/build/cjs/utils/promisebuffer.js +5 -3
  91. package/build/cjs/utils/promisebuffer.js.map +1 -1
  92. package/build/cjs/utils/scopeData.js +4 -0
  93. package/build/cjs/utils/scopeData.js.map +1 -1
  94. package/build/cjs/utils/sdkMetadata.js +7 -11
  95. package/build/cjs/utils/sdkMetadata.js.map +1 -1
  96. package/build/cjs/utils/should-ignore-span.js +31 -9
  97. package/build/cjs/utils/should-ignore-span.js.map +1 -1
  98. package/build/cjs/utils/spanUtils.js +90 -2
  99. package/build/cjs/utils/spanUtils.js.map +1 -1
  100. package/build/cjs/utils/timer.js +20 -0
  101. package/build/cjs/utils/timer.js.map +1 -0
  102. package/build/cjs/utils/traceData.js +2 -2
  103. package/build/cjs/utils/traceData.js.map +1 -1
  104. package/build/cjs/utils/tracePropagationTargets.js +38 -0
  105. package/build/cjs/utils/tracePropagationTargets.js.map +1 -0
  106. package/build/cjs/utils/version.js +1 -1
  107. package/build/cjs/utils/version.js.map +1 -1
  108. package/build/esm/attributes.js.map +1 -1
  109. package/build/esm/client.js +18 -8
  110. package/build/esm/client.js.map +1 -1
  111. package/build/esm/envelope.js +41 -8
  112. package/build/esm/envelope.js.map +1 -1
  113. package/build/esm/exports.js +2 -2
  114. package/build/esm/feedback.js +1 -1
  115. package/build/esm/index.js +12 -3
  116. package/build/esm/index.js.map +1 -1
  117. package/build/esm/integration.js +12 -1
  118. package/build/esm/integration.js.map +1 -1
  119. package/build/esm/integrations/eventFilters.js +1 -1
  120. package/build/esm/integrations/eventFilters.js.map +1 -1
  121. package/build/esm/integrations/mcp-server/correlation.js +54 -10
  122. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  123. package/build/esm/integrations/mcp-server/sessionManagement.js +50 -16
  124. package/build/esm/integrations/mcp-server/sessionManagement.js.map +1 -1
  125. package/build/esm/integrations/moduleMetadata.js +1 -1
  126. package/build/esm/integrations/requestdata.js +72 -6
  127. package/build/esm/integrations/requestdata.js.map +1 -1
  128. package/build/esm/integrations/spanStreaming.js +52 -0
  129. package/build/esm/integrations/spanStreaming.js.map +1 -0
  130. package/build/esm/integrations/third-party-errors-filter.js +1 -1
  131. package/build/esm/logs/internal.js +1 -1
  132. package/build/esm/metrics/public-api.js +3 -3
  133. package/build/esm/metrics/public-api.js.map +1 -1
  134. package/build/esm/package.json +1 -1
  135. package/build/esm/scope.js +1 -1
  136. package/build/esm/scope.js.map +1 -1
  137. package/build/esm/semanticAttributes.js +57 -1
  138. package/build/esm/semanticAttributes.js.map +1 -1
  139. package/build/esm/spans/captureSpan.js +102 -0
  140. package/build/esm/spans/captureSpan.js.map +1 -0
  141. package/build/esm/spans/spanBuffer.js +119 -0
  142. package/build/esm/spans/spanBuffer.js.map +1 -0
  143. package/build/esm/spans/spanFirstUtils.js +182 -0
  144. package/build/esm/spans/spanFirstUtils.js.map +1 -0
  145. package/build/esm/tracing/ai/gen-ai-attributes.js +6 -1
  146. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  147. package/build/esm/tracing/measurement.js +1 -1
  148. package/build/esm/tracing/openai/index.js +134 -51
  149. package/build/esm/tracing/openai/index.js.map +1 -1
  150. package/build/esm/tracing/sentrySpan.js +33 -1
  151. package/build/esm/tracing/sentrySpan.js.map +1 -1
  152. package/build/esm/tracing/trace.js +4 -3
  153. package/build/esm/tracing/trace.js.map +1 -1
  154. package/build/esm/tracing/vercel-ai/constants.js +4 -1
  155. package/build/esm/tracing/vercel-ai/constants.js.map +1 -1
  156. package/build/esm/tracing/vercel-ai/index.js +15 -1
  157. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  158. package/build/esm/tracing/vercel-ai/utils.js +73 -24
  159. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  160. package/build/esm/transports/base.js +18 -2
  161. package/build/esm/transports/base.js.map +1 -1
  162. package/build/esm/transports/offline.js +16 -17
  163. package/build/esm/transports/offline.js.map +1 -1
  164. package/build/esm/utils/aggregate-errors.js +13 -5
  165. package/build/esm/utils/aggregate-errors.js.map +1 -1
  166. package/build/esm/utils/beforeSendSpan.js +33 -0
  167. package/build/esm/utils/beforeSendSpan.js.map +1 -0
  168. package/build/esm/utils/envToBool.js +28 -0
  169. package/build/esm/utils/envToBool.js.map +1 -0
  170. package/build/esm/utils/exports.js +7 -7
  171. package/build/esm/utils/exports.js.map +1 -1
  172. package/build/esm/utils/featureFlags.js +1 -0
  173. package/build/esm/utils/featureFlags.js.map +1 -1
  174. package/build/esm/utils/flushIfServerless.js.map +1 -1
  175. package/build/esm/utils/hasSpanStreamingEnabled.js +19 -0
  176. package/build/esm/utils/hasSpanStreamingEnabled.js.map +1 -0
  177. package/build/esm/utils/prepareEvent.js +6 -1
  178. package/build/esm/utils/prepareEvent.js.map +1 -1
  179. package/build/esm/utils/promisebuffer.js +5 -3
  180. package/build/esm/utils/promisebuffer.js.map +1 -1
  181. package/build/esm/utils/scopeData.js +4 -0
  182. package/build/esm/utils/scopeData.js.map +1 -1
  183. package/build/esm/utils/sdkMetadata.js +7 -11
  184. package/build/esm/utils/sdkMetadata.js.map +1 -1
  185. package/build/esm/utils/should-ignore-span.js +31 -9
  186. package/build/esm/utils/should-ignore-span.js.map +1 -1
  187. package/build/esm/utils/spanUtils.js +87 -3
  188. package/build/esm/utils/spanUtils.js.map +1 -1
  189. package/build/esm/utils/timer.js +18 -0
  190. package/build/esm/utils/timer.js.map +1 -0
  191. package/build/esm/utils/tracePropagationTargets.js +36 -0
  192. package/build/esm/utils/tracePropagationTargets.js.map +1 -0
  193. package/build/esm/utils/version.js +1 -1
  194. package/build/esm/utils/version.js.map +1 -1
  195. package/build/types/attributes.d.ts +1 -1
  196. package/build/types/attributes.d.ts.map +1 -1
  197. package/build/types/client.d.ts +40 -2
  198. package/build/types/client.d.ts.map +1 -1
  199. package/build/types/envelope.d.ts +6 -1
  200. package/build/types/envelope.d.ts.map +1 -1
  201. package/build/types/index.d.ts +13 -4
  202. package/build/types/index.d.ts.map +1 -1
  203. package/build/types/integration.d.ts +4 -0
  204. package/build/types/integration.d.ts.map +1 -1
  205. package/build/types/integrations/mcp-server/correlation.d.ts +6 -2
  206. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  207. package/build/types/integrations/mcp-server/sessionManagement.d.ts +8 -2
  208. package/build/types/integrations/mcp-server/sessionManagement.d.ts.map +1 -1
  209. package/build/types/integrations/requestdata.d.ts.map +1 -1
  210. package/build/types/integrations/spanStreaming.d.ts +11 -0
  211. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  212. package/build/types/metrics/public-api.d.ts +3 -3
  213. package/build/types/semanticAttributes.d.ts +38 -0
  214. package/build/types/semanticAttributes.d.ts.map +1 -1
  215. package/build/types/spans/captureSpan.d.ts +10 -0
  216. package/build/types/spans/captureSpan.d.ts.map +1 -0
  217. package/build/types/spans/spanBuffer.d.ts +35 -0
  218. package/build/types/spans/spanBuffer.d.ts.map +1 -0
  219. package/build/types/spans/spanFirstUtils.d.ts +20 -0
  220. package/build/types/spans/spanFirstUtils.d.ts.map +1 -0
  221. package/build/types/tracing/ai/gen-ai-attributes.d.ts +4 -0
  222. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  223. package/build/types/tracing/openai/index.d.ts.map +1 -1
  224. package/build/types/tracing/sentrySpan.d.ts +10 -1
  225. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  226. package/build/types/tracing/vercel-ai/constants.d.ts +1 -0
  227. package/build/types/tracing/vercel-ai/constants.d.ts.map +1 -1
  228. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  229. package/build/types/tracing/vercel-ai/utils.d.ts +2 -2
  230. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  231. package/build/types/transports/base.d.ts.map +1 -1
  232. package/build/types/transports/offline.d.ts.map +1 -1
  233. package/build/types/types-hoist/attributes.d.ts +19 -0
  234. package/build/types/types-hoist/attributes.d.ts.map +1 -0
  235. package/build/types/types-hoist/envelope.d.ts +22 -2
  236. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  237. package/build/types/types-hoist/feedback/index.d.ts.map +1 -1
  238. package/build/types/types-hoist/integration.d.ts +7 -0
  239. package/build/types/types-hoist/integration.d.ts.map +1 -1
  240. package/build/types/types-hoist/link.d.ts +2 -2
  241. package/build/types/types-hoist/link.d.ts.map +1 -1
  242. package/build/types/types-hoist/options.d.ts +18 -2
  243. package/build/types/types-hoist/options.d.ts.map +1 -1
  244. package/build/types/types-hoist/span.d.ts +27 -0
  245. package/build/types/types-hoist/span.d.ts.map +1 -1
  246. package/build/types/utils/beforeSendSpan.d.ts +22 -0
  247. package/build/types/utils/beforeSendSpan.d.ts.map +1 -0
  248. package/build/types/utils/envToBool.d.ts +13 -0
  249. package/build/types/utils/envToBool.d.ts.map +1 -0
  250. package/build/types/utils/featureFlags.d.ts.map +1 -1
  251. package/build/types/utils/flushIfServerless.d.ts.map +1 -1
  252. package/build/types/utils/hasSpanStreamingEnabled.d.ts +9 -0
  253. package/build/types/utils/hasSpanStreamingEnabled.d.ts.map +1 -0
  254. package/build/types/utils/prepareEvent.d.ts.map +1 -1
  255. package/build/types/utils/promisebuffer.d.ts.map +1 -1
  256. package/build/types/utils/scopeData.d.ts.map +1 -1
  257. package/build/types/utils/sdkMetadata.d.ts.map +1 -1
  258. package/build/types/utils/should-ignore-span.d.ts +3 -3
  259. package/build/types/utils/should-ignore-span.d.ts.map +1 -1
  260. package/build/types/utils/spanUtils.d.ts +22 -2
  261. package/build/types/utils/spanUtils.d.ts.map +1 -1
  262. package/build/types/utils/timer.d.ts +11 -0
  263. package/build/types/utils/timer.d.ts.map +1 -0
  264. package/build/types/utils/tracePropagationTargets.d.ts +9 -0
  265. package/build/types/utils/tracePropagationTargets.d.ts.map +1 -0
  266. package/build/types-ts3.8/attributes.d.ts +1 -1
  267. package/build/types-ts3.8/client.d.ts +40 -2
  268. package/build/types-ts3.8/envelope.d.ts +6 -1
  269. package/build/types-ts3.8/index.d.ts +13 -4
  270. package/build/types-ts3.8/integration.d.ts +4 -0
  271. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +6 -2
  272. package/build/types-ts3.8/integrations/mcp-server/sessionManagement.d.ts +8 -2
  273. package/build/types-ts3.8/integrations/spanStreaming.d.ts +11 -0
  274. package/build/types-ts3.8/metrics/public-api.d.ts +3 -3
  275. package/build/types-ts3.8/semanticAttributes.d.ts +38 -0
  276. package/build/types-ts3.8/spans/captureSpan.d.ts +10 -0
  277. package/build/types-ts3.8/spans/spanBuffer.d.ts +35 -0
  278. package/build/types-ts3.8/spans/spanFirstUtils.d.ts +20 -0
  279. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +4 -0
  280. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  281. package/build/types-ts3.8/tracing/vercel-ai/constants.d.ts +1 -0
  282. package/build/types-ts3.8/tracing/vercel-ai/utils.d.ts +2 -2
  283. package/build/types-ts3.8/types-hoist/attributes.d.ts +19 -0
  284. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  285. package/build/types-ts3.8/types-hoist/integration.d.ts +7 -0
  286. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  287. package/build/types-ts3.8/types-hoist/options.d.ts +18 -2
  288. package/build/types-ts3.8/types-hoist/span.d.ts +27 -0
  289. package/build/types-ts3.8/utils/beforeSendSpan.d.ts +22 -0
  290. package/build/types-ts3.8/utils/envToBool.d.ts +13 -0
  291. package/build/types-ts3.8/utils/hasSpanStreamingEnabled.d.ts +9 -0
  292. package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
  293. package/build/types-ts3.8/utils/spanUtils.d.ts +22 -2
  294. package/build/types-ts3.8/utils/timer.d.ts +11 -0
  295. package/build/types-ts3.8/utils/tracePropagationTargets.d.ts +9 -0
  296. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { Log } from './log';
6
6
  import { Metric } from './metric';
7
7
  import { TracesSamplerSamplingContext } from './samplingcontext';
8
8
  import { SdkMetadata } from './sdkmetadata';
9
- import { SpanJSON } from './span';
9
+ import { SpanJSON, SpanV2JSON } from './span';
10
10
  import { StackLineParser, StackParser } from './stacktrace';
11
11
  import { TracePropagationTargets } from './tracing';
12
12
  import { BaseTransportOptions, Transport } from './transport';
@@ -450,6 +450,15 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
450
450
  * @default false
451
451
  */
452
452
  strictTraceContinuation?: boolean;
453
+ /**
454
+ * [Experimental] The trace lifecycle, determining whether spans are sent statically when the entire local span tree is complete, or
455
+ * in batches, following interval- and action-based triggers.
456
+ *
457
+ * @experimental this option is currently still experimental and its type, name, or entire presence is subject to break and change at any time.
458
+ *
459
+ * @default 'static'
460
+ */
461
+ traceLifecycle?: 'static' | 'stream';
453
462
  /**
454
463
  * The organization ID for your Sentry project.
455
464
  *
@@ -526,7 +535,7 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
526
535
  *
527
536
  * @returns The modified span payload that will be sent.
528
537
  */
529
- beforeSendSpan?: (span: SpanJSON) => SpanJSON;
538
+ beforeSendSpan?: ((span: SpanJSON) => SpanJSON) | SpanV2CompatibleBeforeSendSpanCallback;
530
539
  /**
531
540
  * An event-processing callback for transaction events, guaranteed to be invoked after all other event
532
541
  * processors. This allows an event to be modified or dropped before it's sent.
@@ -552,6 +561,13 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
552
561
  */
553
562
  beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
554
563
  }
564
+ /**
565
+ * A callback that is known to be compatible with actually receiving and returning a span v2 JSON object.
566
+ * Only useful in conjunction with the {@link CoreOptions.traceLifecycle} option.
567
+ */
568
+ export type SpanV2CompatibleBeforeSendSpanCallback = ((span: SpanV2JSON) => SpanV2JSON) & {
569
+ _v2: true;
570
+ };
555
571
  /** Base configuration options for every SDK. */
556
572
  export interface CoreOptions<TO extends BaseTransportOptions = BaseTransportOptions> extends Pick<Partial<ClientOptions<TO>>, Exclude<keyof Partial<ClientOptions<TO>>, 'integrations' | 'transport' | 'stackParser'>> {
557
573
  /**
@@ -1,3 +1,4 @@
1
+ import { Attributes } from '../attributes';
1
2
  import { SpanLink, SpanLinkJSON } from './link';
2
3
  import { Measurements } from './measurement';
3
4
  import { HrTime } from './opentelemetry';
@@ -17,6 +18,32 @@ export type SpanAttributes = Partial<{
17
18
  }> & Record<string, SpanAttributeValue | undefined>;
18
19
  /** This type is aligned with the OpenTelemetry TimeInput type. */
19
20
  export type SpanTimeInput = HrTime | number | Date;
21
+ /**
22
+ * JSON representation of a v2 span, as it should be sent to Sentry.
23
+ */
24
+ export interface SpanV2JSON {
25
+ trace_id: string;
26
+ parent_span_id?: string;
27
+ span_id: string;
28
+ name: string;
29
+ start_timestamp: number;
30
+ end_timestamp: number;
31
+ status: 'ok' | 'error';
32
+ is_segment: boolean;
33
+ attributes?: Attributes;
34
+ links?: SpanLinkJSON<Attributes>[];
35
+ }
36
+ /**
37
+ * A SpanV2JSON with an attached reference to the segment span.
38
+ * This reference is used to compute dynamic sampling context before sending.
39
+ * The reference MUST be removed before sending the span envelope.
40
+ */
41
+ export interface SpanV2JSONWithSegmentRef extends SpanV2JSON {
42
+ _segmentSpan: Span;
43
+ }
44
+ export type SerializedSpanContainer = {
45
+ items: Array<SpanV2JSON>;
46
+ };
20
47
  /** A JSON representation of a span. */
21
48
  export interface SpanJSON {
22
49
  data: SpanAttributes;
@@ -0,0 +1,22 @@
1
+ import { ClientOptions, SpanV2CompatibleBeforeSendSpanCallback } from '../types-hoist/options';
2
+ import { SpanV2JSON } from '../types-hoist/span';
3
+ /**
4
+ * A wrapper to use the new span format in your `beforeSendSpan` callback.
5
+ *
6
+ * @example
7
+ *
8
+ * Sentry.init({
9
+ * beforeSendSpan: withStreamSpan((span) => {
10
+ * return span;
11
+ * }),
12
+ * });
13
+ *
14
+ * @param callback
15
+ * @returns
16
+ */
17
+ export declare function withStreamSpan(callback: (span: SpanV2JSON) => SpanV2JSON): SpanV2CompatibleBeforeSendSpanCallback;
18
+ /**
19
+ * Typesafe check to identify the expected span json format of the `beforeSendSpan` callback.
20
+ */
21
+ export declare function isV2BeforeSendSpanCallback(callback: ClientOptions['beforeSendSpan']): callback is SpanV2CompatibleBeforeSendSpanCallback;
22
+ //# sourceMappingURL=beforeSendSpan.d.ts.map
@@ -0,0 +1,13 @@
1
+ export declare const FALSY_ENV_VALUES: Set<string>;
2
+ export declare const TRUTHY_ENV_VALUES: Set<string>;
3
+ export type StrictBoolCast = {
4
+ strict: true;
5
+ };
6
+ export type LooseBoolCast = {
7
+ strict?: false;
8
+ };
9
+ export type BoolCastOptions = StrictBoolCast | LooseBoolCast;
10
+ export declare function envToBool(value: unknown, options?: LooseBoolCast): boolean;
11
+ export declare function envToBool(value: unknown, options: StrictBoolCast): boolean | null;
12
+ export declare function envToBool(value: unknown, options?: BoolCastOptions): boolean | null;
13
+ //# sourceMappingURL=envToBool.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Client } from '../client';
2
+ /**
3
+ * Determines if the SDK is configured for span streaming.
4
+ * Span streaming is enabled when `traceLifecycle` is set to `stream`.
5
+ * (In Browser, users must add `spanStreamingIntegration` as well but it
6
+ * already checks itself and configures `traceLifecycle` appropriately)
7
+ */
8
+ export declare function hasSpanStreamingEnabled(maybeClient?: Client | undefined): boolean;
9
+ //# sourceMappingURL=hasSpanStreamingEnabled.d.ts.map
@@ -1,12 +1,12 @@
1
1
  import { ClientOptions } from '../types-hoist/options';
2
- import { SpanJSON } from '../types-hoist/span';
2
+ import { SpanJSON, SpanV2JSON } from '../types-hoist/span';
3
3
  /**
4
4
  * Check if a span should be ignored based on the ignoreSpans configuration.
5
5
  */
6
- export declare function shouldIgnoreSpan(span: Pick<SpanJSON, 'description' | 'op'>, ignoreSpans: Required<ClientOptions>['ignoreSpans']): boolean;
6
+ export declare function shouldIgnoreSpan(span: Pick<SpanJSON, 'description' | 'op'> | Pick<SpanV2JSON, 'name' | 'attributes'>, ignoreSpans: Required<ClientOptions>['ignoreSpans']): boolean;
7
7
  /**
8
8
  * Takes a list of spans, and a span that was dropped, and re-parents the child spans of the dropped span to the parent of the dropped span, if possible.
9
9
  * This mutates the spans array in place!
10
10
  */
11
- export declare function reparentChildSpans(spans: SpanJSON[], dropSpan: SpanJSON): void;
11
+ export declare function reparentChildSpans(spans: Pick<SpanV2JSON, 'parent_span_id' | 'span_id'>[], dropSpan: Pick<SpanV2JSON, 'parent_span_id' | 'span_id'>): void;
12
12
  //# sourceMappingURL=should-ignore-span.d.ts.map
@@ -1,6 +1,7 @@
1
+ import { Attributes } from '../attributes';
1
2
  import { TraceContext } from '../types-hoist/context';
2
3
  import { SpanLink, SpanLinkJSON } from '../types-hoist/link';
3
- import { Span, SpanAttributes, SpanJSON, SpanTimeInput } from '../types-hoist/span';
4
+ import { Span, SpanAttributes, SpanJSON, SpanTimeInput, SpanV2JSON } from '../types-hoist/span';
4
5
  import { SpanStatus } from '../types-hoist/spanStatus';
5
6
  export declare const TRACE_FLAG_NONE = 0;
6
7
  export declare const TRACE_FLAG_SAMPLED = 1;
@@ -28,6 +29,12 @@ export declare function spanToTraceparentHeader(span: Span): string;
28
29
  * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.
29
30
  */
30
31
  export declare function convertSpanLinksForEnvelope(links?: SpanLink[]): SpanLinkJSON[] | undefined;
32
+ /**
33
+ *
34
+ * @param links
35
+ * @returns
36
+ */
37
+ export declare function getV2SpanLinks(links?: SpanLink[]): SpanLinkJSON<Attributes>[] | undefined;
31
38
  /**
32
39
  * Convert a span time input into a timestamp in seconds.
33
40
  */
@@ -36,6 +43,11 @@ export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined)
36
43
  * Convert a span to a JSON representation.
37
44
  */
38
45
  export declare function spanToJSON(span: Span): SpanJSON;
46
+ /**
47
+ * Convert a span to a SpanV2JSON representation.
48
+ * @returns
49
+ */
50
+ export declare function spanToV2JSON(span: Span): SpanV2JSON;
39
51
  /** Exported only for tests. */
40
52
  export interface OpenTelemetrySdkTraceBaseSpan extends Span {
41
53
  attributes: SpanAttributes;
@@ -55,6 +67,10 @@ export interface OpenTelemetrySdkTraceBaseSpan extends Span {
55
67
  export declare function spanIsSampled(span: Span): boolean;
56
68
  /** Get the status message to use for a JSON representation of a span. */
57
69
  export declare function getStatusMessage(status: SpanStatus | undefined): string | undefined;
70
+ /**
71
+ * Convert the various statuses to the ones expected by Sentry ('ok' is default)
72
+ */
73
+ export declare function getV2StatusMessage(status: SpanStatus | undefined): 'ok' | 'error';
58
74
  declare const CHILD_SPANS_FIELD = "_sentryChildSpans";
59
75
  declare const ROOT_SPAN_FIELD = "_sentryRootSpan";
60
76
  type SpanWithPotentialChildren = Span & {
@@ -74,7 +90,11 @@ export declare function getSpanDescendants(span: SpanWithPotentialChildren): Spa
74
90
  /**
75
91
  * Returns the root span of a given span.
76
92
  */
77
- export declare function getRootSpan(span: SpanWithPotentialChildren): Span;
93
+ export declare const getRootSpan: typeof INTERNAL_getSegmentSpan;
94
+ /**
95
+ * Returns the segment span of a given span.
96
+ */
97
+ export declare function INTERNAL_getSegmentSpan(span: SpanWithPotentialChildren): Span;
78
98
  /**
79
99
  * Returns the currently active span.
80
100
  */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Calls `unref` on a timer, if the method is available on @param timer.
3
+ *
4
+ * `unref()` is used to allow processes to exit immediately, even if the timer
5
+ * is still running and hasn't resolved yet.
6
+ *
7
+ * Use this in places where code can run on browser or server, since browsers
8
+ * do not support `unref`.
9
+ */
10
+ export declare function safeUnref(timer: ReturnType<typeof setTimeout>): ReturnType<typeof setTimeout>;
11
+ //# sourceMappingURL=timer.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { CoreOptions as Options } from '../types-hoist/options';
2
+ import { LRUMap } from './lru';
3
+ /**
4
+ * Check if a given URL should be propagated to or not.
5
+ * If no url is defined, or no trace propagation targets are defined, this will always return `true`.
6
+ * You can also optionally provide a decision map, to cache decisions and avoid repeated regex lookups.
7
+ */
8
+ export declare function shouldPropagateTraceForUrl(url: string | undefined, tracePropagationTargets: Options['tracePropagationTargets'], decisionMap?: LRUMap<string, boolean>): boolean;
9
+ //# sourceMappingURL=tracePropagationTargets.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/core",
3
- "version": "10.37.0",
3
+ "version": "10.39.0-alpha.0",
4
4
  "description": "Base implementation for all Sentry JavaScript SDKs",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",