@sentry/core 10.30.0 → 10.32.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 (194) hide show
  1. package/build/cjs/attributes.js +98 -0
  2. package/build/cjs/attributes.js.map +1 -0
  3. package/build/cjs/client.js +11 -6
  4. package/build/cjs/client.js.map +1 -1
  5. package/build/cjs/envelope.js +41 -7
  6. package/build/cjs/envelope.js.map +1 -1
  7. package/build/cjs/index.js +30 -0
  8. package/build/cjs/index.js.map +1 -1
  9. package/build/cjs/integrations/eventFilters.js +1 -1
  10. package/build/cjs/integrations/eventFilters.js.map +1 -1
  11. package/build/cjs/integrations/mcp-server/correlation.js +17 -3
  12. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  13. package/build/cjs/integrations/mcp-server/sessionExtraction.js +44 -0
  14. package/build/cjs/integrations/mcp-server/sessionExtraction.js.map +1 -1
  15. package/build/cjs/integrations/mcp-server/transport.js +17 -3
  16. package/build/cjs/integrations/mcp-server/transport.js.map +1 -1
  17. package/build/cjs/integrations/requestdata.js +72 -6
  18. package/build/cjs/integrations/requestdata.js.map +1 -1
  19. package/build/cjs/integrations/serverSpanStreaming.js +51 -0
  20. package/build/cjs/integrations/serverSpanStreaming.js.map +1 -0
  21. package/build/cjs/semanticAttributes.js +36 -0
  22. package/build/cjs/semanticAttributes.js.map +1 -1
  23. package/build/cjs/spans/captureSpan.js +107 -0
  24. package/build/cjs/spans/captureSpan.js.map +1 -0
  25. package/build/cjs/spans/spanBuffer.js +117 -0
  26. package/build/cjs/spans/spanBuffer.js.map +1 -0
  27. package/build/cjs/spans/spanFirstUtils.js +187 -0
  28. package/build/cjs/spans/spanFirstUtils.js.map +1 -0
  29. package/build/cjs/tracing/ai/messageTruncation.js +120 -11
  30. package/build/cjs/tracing/ai/messageTruncation.js.map +1 -1
  31. package/build/cjs/tracing/google-genai/index.js +31 -14
  32. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  33. package/build/cjs/tracing/google-genai/utils.js +24 -5
  34. package/build/cjs/tracing/google-genai/utils.js.map +1 -1
  35. package/build/cjs/tracing/sentrySpan.js +31 -0
  36. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  37. package/build/cjs/tracing/trace.js +1 -0
  38. package/build/cjs/tracing/trace.js.map +1 -1
  39. package/build/cjs/tracing/vercel-ai/index.js +4 -5
  40. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  41. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js +0 -10
  42. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  43. package/build/cjs/utils/applyScopeDataToEvent.js +5 -0
  44. package/build/cjs/utils/applyScopeDataToEvent.js.map +1 -1
  45. package/build/cjs/utils/beforeSendSpan.js +36 -0
  46. package/build/cjs/utils/beforeSendSpan.js.map +1 -0
  47. package/build/cjs/utils/featureFlags.js +1 -0
  48. package/build/cjs/utils/featureFlags.js.map +1 -1
  49. package/build/cjs/utils/request.js +75 -12
  50. package/build/cjs/utils/request.js.map +1 -1
  51. package/build/cjs/utils/should-ignore-span.js +31 -9
  52. package/build/cjs/utils/should-ignore-span.js.map +1 -1
  53. package/build/cjs/utils/spanUtils.js +101 -2
  54. package/build/cjs/utils/spanUtils.js.map +1 -1
  55. package/build/cjs/utils/traceData.js +1 -4
  56. package/build/cjs/utils/traceData.js.map +1 -1
  57. package/build/cjs/utils/version.js +1 -1
  58. package/build/cjs/utils/version.js.map +1 -1
  59. package/build/esm/attributes.js +95 -0
  60. package/build/esm/attributes.js.map +1 -0
  61. package/build/esm/client.js +6 -1
  62. package/build/esm/client.js.map +1 -1
  63. package/build/esm/envelope.js +41 -8
  64. package/build/esm/envelope.js.map +1 -1
  65. package/build/esm/index.js +10 -4
  66. package/build/esm/index.js.map +1 -1
  67. package/build/esm/integrations/eventFilters.js +1 -1
  68. package/build/esm/integrations/eventFilters.js.map +1 -1
  69. package/build/esm/integrations/mcp-server/correlation.js +17 -3
  70. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  71. package/build/esm/integrations/mcp-server/sessionExtraction.js +43 -1
  72. package/build/esm/integrations/mcp-server/sessionExtraction.js.map +1 -1
  73. package/build/esm/integrations/mcp-server/transport.js +18 -4
  74. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  75. package/build/esm/integrations/requestdata.js +72 -6
  76. package/build/esm/integrations/requestdata.js.map +1 -1
  77. package/build/esm/integrations/serverSpanStreaming.js +49 -0
  78. package/build/esm/integrations/serverSpanStreaming.js.map +1 -0
  79. package/build/esm/package.json +1 -1
  80. package/build/esm/semanticAttributes.js +26 -1
  81. package/build/esm/semanticAttributes.js.map +1 -1
  82. package/build/esm/spans/captureSpan.js +105 -0
  83. package/build/esm/spans/captureSpan.js.map +1 -0
  84. package/build/esm/spans/spanBuffer.js +115 -0
  85. package/build/esm/spans/spanBuffer.js.map +1 -0
  86. package/build/esm/spans/spanFirstUtils.js +183 -0
  87. package/build/esm/spans/spanFirstUtils.js.map +1 -0
  88. package/build/esm/tracing/ai/messageTruncation.js +121 -11
  89. package/build/esm/tracing/ai/messageTruncation.js.map +1 -1
  90. package/build/esm/tracing/google-genai/index.js +34 -17
  91. package/build/esm/tracing/google-genai/index.js.map +1 -1
  92. package/build/esm/tracing/google-genai/utils.js +24 -6
  93. package/build/esm/tracing/google-genai/utils.js.map +1 -1
  94. package/build/esm/tracing/sentrySpan.js +32 -1
  95. package/build/esm/tracing/sentrySpan.js.map +1 -1
  96. package/build/esm/tracing/trace.js +1 -0
  97. package/build/esm/tracing/trace.js.map +1 -1
  98. package/build/esm/tracing/vercel-ai/index.js +5 -6
  99. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  100. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js +1 -10
  101. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  102. package/build/esm/utils/applyScopeDataToEvent.js +5 -0
  103. package/build/esm/utils/applyScopeDataToEvent.js.map +1 -1
  104. package/build/esm/utils/beforeSendSpan.js +33 -0
  105. package/build/esm/utils/beforeSendSpan.js.map +1 -0
  106. package/build/esm/utils/featureFlags.js +1 -0
  107. package/build/esm/utils/featureFlags.js.map +1 -1
  108. package/build/esm/utils/request.js +76 -13
  109. package/build/esm/utils/request.js.map +1 -1
  110. package/build/esm/utils/should-ignore-span.js +31 -9
  111. package/build/esm/utils/should-ignore-span.js.map +1 -1
  112. package/build/esm/utils/spanUtils.js +97 -3
  113. package/build/esm/utils/spanUtils.js.map +1 -1
  114. package/build/esm/utils/traceData.js +1 -4
  115. package/build/esm/utils/traceData.js.map +1 -1
  116. package/build/esm/utils/version.js +1 -1
  117. package/build/esm/utils/version.js.map +1 -1
  118. package/build/types/attributes.d.ts +2 -2
  119. package/build/types/attributes.d.ts.map +1 -1
  120. package/build/types/client.d.ts +40 -2
  121. package/build/types/client.d.ts.map +1 -1
  122. package/build/types/envelope.d.ts +6 -1
  123. package/build/types/envelope.d.ts.map +1 -1
  124. package/build/types/index.d.ts +12 -5
  125. package/build/types/index.d.ts.map +1 -1
  126. package/build/types/integrations/mcp-server/correlation.d.ts +2 -2
  127. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  128. package/build/types/integrations/mcp-server/sessionExtraction.d.ts +13 -1
  129. package/build/types/integrations/mcp-server/sessionExtraction.d.ts.map +1 -1
  130. package/build/types/integrations/mcp-server/transport.d.ts.map +1 -1
  131. package/build/types/integrations/requestdata.d.ts.map +1 -1
  132. package/build/types/integrations/serverSpanStreaming.d.ts +8 -0
  133. package/build/types/integrations/serverSpanStreaming.d.ts.map +1 -0
  134. package/build/types/semanticAttributes.d.ts +21 -0
  135. package/build/types/semanticAttributes.d.ts.map +1 -1
  136. package/build/types/spans/captureSpan.d.ts +10 -0
  137. package/build/types/spans/captureSpan.d.ts.map +1 -0
  138. package/build/types/spans/spanBuffer.d.ts +31 -0
  139. package/build/types/spans/spanBuffer.d.ts.map +1 -0
  140. package/build/types/spans/spanFirstUtils.d.ts +20 -0
  141. package/build/types/spans/spanFirstUtils.d.ts.map +1 -0
  142. package/build/types/tracing/ai/messageTruncation.d.ts +0 -20
  143. package/build/types/tracing/ai/messageTruncation.d.ts.map +1 -1
  144. package/build/types/tracing/google-genai/index.d.ts.map +1 -1
  145. package/build/types/tracing/google-genai/utils.d.ts +25 -0
  146. package/build/types/tracing/google-genai/utils.d.ts.map +1 -1
  147. package/build/types/tracing/sentrySpan.d.ts +10 -1
  148. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  149. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  150. package/build/types/types-hoist/attributes.d.ts +19 -0
  151. package/build/types/types-hoist/attributes.d.ts.map +1 -0
  152. package/build/types/types-hoist/envelope.d.ts +22 -2
  153. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  154. package/build/types/types-hoist/link.d.ts +2 -2
  155. package/build/types/types-hoist/link.d.ts.map +1 -1
  156. package/build/types/types-hoist/options.d.ts +31 -2
  157. package/build/types/types-hoist/options.d.ts.map +1 -1
  158. package/build/types/types-hoist/span.d.ts +27 -0
  159. package/build/types/types-hoist/span.d.ts.map +1 -1
  160. package/build/types/utils/applyScopeDataToEvent.d.ts.map +1 -1
  161. package/build/types/utils/beforeSendSpan.d.ts +22 -0
  162. package/build/types/utils/beforeSendSpan.d.ts.map +1 -0
  163. package/build/types/utils/featureFlags.d.ts.map +1 -1
  164. package/build/types/utils/request.d.ts +1 -1
  165. package/build/types/utils/request.d.ts.map +1 -1
  166. package/build/types/utils/should-ignore-span.d.ts +3 -3
  167. package/build/types/utils/should-ignore-span.d.ts.map +1 -1
  168. package/build/types/utils/spanUtils.d.ts +26 -2
  169. package/build/types/utils/spanUtils.d.ts.map +1 -1
  170. package/build/types/utils/traceData.d.ts.map +1 -1
  171. package/build/types-ts3.8/attributes.d.ts +2 -2
  172. package/build/types-ts3.8/client.d.ts +40 -2
  173. package/build/types-ts3.8/envelope.d.ts +6 -1
  174. package/build/types-ts3.8/index.d.ts +12 -5
  175. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -2
  176. package/build/types-ts3.8/integrations/mcp-server/sessionExtraction.d.ts +13 -1
  177. package/build/types-ts3.8/integrations/serverSpanStreaming.d.ts +8 -0
  178. package/build/types-ts3.8/semanticAttributes.d.ts +21 -0
  179. package/build/types-ts3.8/spans/captureSpan.d.ts +10 -0
  180. package/build/types-ts3.8/spans/spanBuffer.d.ts +31 -0
  181. package/build/types-ts3.8/spans/spanFirstUtils.d.ts +20 -0
  182. package/build/types-ts3.8/tracing/ai/messageTruncation.d.ts +0 -20
  183. package/build/types-ts3.8/tracing/google-genai/utils.d.ts +25 -0
  184. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  185. package/build/types-ts3.8/types-hoist/attributes.d.ts +19 -0
  186. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  187. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  188. package/build/types-ts3.8/types-hoist/options.d.ts +31 -2
  189. package/build/types-ts3.8/types-hoist/span.d.ts +27 -0
  190. package/build/types-ts3.8/utils/beforeSendSpan.d.ts +22 -0
  191. package/build/types-ts3.8/utils/request.d.ts +1 -1
  192. package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
  193. package/build/types-ts3.8/utils/spanUtils.d.ts +26 -2
  194. package/package.json +1 -1
@@ -6,7 +6,7 @@ export { ServerRuntimeClientOptions } from './server-runtime-client';
6
6
  export { IntegrationIndex } from './integration';
7
7
  export * from './tracing';
8
8
  export * from './semanticAttributes';
9
- export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope';
9
+ export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope, createSpanV2Envelope } from './envelope';
10
10
  export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports';
11
11
  export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getTraceContextFromScope, } from './currentScopes';
12
12
  export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes';
@@ -27,6 +27,7 @@ export { getIntegrationsToSetup, addIntegration, defineIntegration, installedInt
27
27
  export { _INTERNAL_skipAiProviderWrapping, _INTERNAL_shouldSkipAiProviderWrapping, _INTERNAL_clearAiProviderSkips, } from './utils/ai/providerSkip';
28
28
  export { applyScopeDataToEvent, mergeScopeData } from './utils/applyScopeDataToEvent';
29
29
  export { prepareEvent } from './utils/prepareEvent';
30
+ export { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
30
31
  export { createCheckInEnvelope } from './checkin';
31
32
  export { hasSpansEnabled } from './utils/hasSpansEnabled';
32
33
  export { isSentryRequestUrl } from './utils/isSentryRequestUrl';
@@ -34,7 +35,10 @@ export { handleCallbackErrors } from './utils/handleCallbackErrors';
34
35
  export { parameterize, fmt } from './utils/parameterize';
35
36
  export { addAutoIpAddressToSession } from './utils/ipAddress';
36
37
  export { addAutoIpAddressToUser } from './utils/ipAddress';
37
- export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, } from './utils/spanUtils';
38
+ export { convertSpanLinksForEnvelope, spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, INTERNAL_getSegmentSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, spanToV2JSON, showSpanDropWarning, } from './utils/spanUtils';
39
+ export { captureSpan } from './spans/captureSpan';
40
+ export { safeSetSpanJSONAttributes } from './spans/spanFirstUtils';
41
+ export { SpanBuffer, SpanBufferOptions } from './spans/spanBuffer';
38
42
  export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope';
39
43
  export { parseSampleRate } from './utils/parseSampleRate';
40
44
  export { applySdkMetadata } from './utils/sdkMetadata';
@@ -60,6 +64,7 @@ export { thirdPartyErrorFilterIntegration } from './integrations/third-party-err
60
64
  export { consoleIntegration } from './integrations/console';
61
65
  export { featureFlagsIntegration, FeatureFlagsIntegration } from './integrations/featureFlags';
62
66
  export { growthbookIntegration } from './integrations/featureFlags';
67
+ export { serverSpanStreamingIntegration } from './integrations/serverSpanStreaming';
63
68
  export { profiler } from './profiling';
64
69
  export { instrumentFetchRequest } from './fetch';
65
70
  export { trpcMiddleware } from './trpc';
@@ -126,7 +131,7 @@ export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, trunca
126
131
  export { isNativeFunction, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsHistory, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver, } from './utils/supports';
127
132
  export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils/syncpromise';
128
133
  export { browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds } from './utils/time';
129
- export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, shouldContinueTrace, } from './utils/tracing';
134
+ export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, shouldContinueTrace, generateTraceparentHeader, } from './utils/tracing';
130
135
  export { getSDKSource, isBrowserBundle } from './utils/env';
131
136
  export { SdkSource } from './utils/env';
132
137
  export { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, createSpanEnvelopeItem, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope, } from './utils/envelope';
@@ -144,6 +149,8 @@ export { flushIfServerless } from './utils/flushIfServerless';
144
149
  export { SDK_VERSION } from './utils/version';
145
150
  export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids';
146
151
  export { escapeStringForRegex } from './vendor/escapeStringForRegex';
152
+ export { isV2BeforeSendSpanCallback, withStreamSpan } from './utils/beforeSendSpan';
153
+ export { shouldIgnoreSpan, reparentChildSpans } from './utils/should-ignore-span';
147
154
  export { Attachment } from './types-hoist/attachment';
148
155
  export { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, XhrBreadcrumbData, FetchBreadcrumbHint, XhrBreadcrumbHint, } from './types-hoist/breadcrumb';
149
156
  export { ClientReport, Outcome, EventDropReason } from './types-hoist/clientreport';
@@ -151,7 +158,7 @@ export { Context, Contexts, DeviceContext, OsContext, AppContext, CultureContext
151
158
  export { DataCategory } from './types-hoist/datacategory';
152
159
  export { DsnComponents, DsnLike, DsnProtocol } from './types-hoist/dsn';
153
160
  export { DebugImage, DebugMeta } from './types-hoist/debugMeta';
154
- 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';
161
+ export { AttachmentItem, BaseEnvelopeHeaders, BaseEnvelopeItemHeaders, ClientReportEnvelope, ClientReportItem, DynamicSamplingContext, Envelope, EnvelopeItemType, EnvelopeItem, EventEnvelope, EventEnvelopeHeaders, EventItem, ReplayEnvelope, FeedbackItem, SessionEnvelope, SessionItem, UserFeedbackItem, CheckInItem, CheckInEnvelope, RawSecurityEnvelope, RawSecurityItem, ProfileItem, ProfileChunkEnvelope, ProfileChunkItem, SpanEnvelope, SpanV2Envelope, SpanItem, LogEnvelope, MetricEnvelope, } from './types-hoist/envelope';
155
162
  export { ExtendedError } from './types-hoist/error';
156
163
  export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types-hoist/event';
157
164
  export { EventProcessor } from './types-hoist/eventprocessor';
@@ -172,7 +179,7 @@ export { SdkInfo } from './types-hoist/sdkinfo';
172
179
  export { SdkMetadata } from './types-hoist/sdkmetadata';
173
180
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, SerializedSession, } from './types-hoist/session';
174
181
  export { SeverityLevel } from './types-hoist/severity';
175
- export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, } from './types-hoist/span';
182
+ export { Span, SentrySpanArguments, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, SpanV2JSON, SpanV2JSONWithSegmentRef, } from './types-hoist/span';
176
183
  export { SpanStatus } from './types-hoist/spanStatus';
177
184
  export { Log, LogSeverityLevel } from './types-hoist/log';
178
185
  export { Metric, MetricType, SerializedMetric, SerializedMetricContainer, SerializedMetricAttributeValue, } from './types-hoist/metric';
@@ -16,10 +16,10 @@ import { MCPTransport, RequestId } from './types';
16
16
  */
17
17
  export declare function storeSpanForRequest(transport: MCPTransport, requestId: RequestId, span: Span, method: string): void;
18
18
  /**
19
- * Completes span with tool results and cleans up correlation
19
+ * Completes span with results and cleans up correlation
20
20
  * @param transport - MCP transport instance
21
21
  * @param requestId - Request identifier
22
- * @param result - Tool execution result for attribute extraction
22
+ * @param result - Execution result for attribute extraction
23
23
  */
24
24
  export declare function completeSpanWithResults(transport: MCPTransport, requestId: RequestId, result: unknown): void;
25
25
  /**
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Handles extraction of client/server info and session data from MCP messages.
5
5
  */
6
- import { ExtraHandlerData, JsonRpcRequest, MCPTransport, SessionData } from './types';
6
+ import { ExtraHandlerData, JsonRpcRequest, MCPTransport, PartyInfo, SessionData } from './types';
7
7
  /**
8
8
  * Extracts session data from "initialize" requests
9
9
  * @param request - JSON-RPC "initialize" request containing client info and protocol version
@@ -22,12 +22,24 @@ export declare function extractSessionDataFromInitializeResponse(result: unknown
22
22
  * @returns Client attributes for span instrumentation
23
23
  */
24
24
  export declare function getClientAttributes(transport: MCPTransport): Record<string, string>;
25
+ /**
26
+ * Build client attributes from PartyInfo directly
27
+ * @param clientInfo - Client party info
28
+ * @returns Client attributes for span instrumentation
29
+ */
30
+ export declare function buildClientAttributesFromInfo(clientInfo?: PartyInfo): Record<string, string>;
25
31
  /**
26
32
  * Build server attributes from stored server info
27
33
  * @param transport - MCP transport instance
28
34
  * @returns Server attributes for span instrumentation
29
35
  */
30
36
  export declare function getServerAttributes(transport: MCPTransport): Record<string, string>;
37
+ /**
38
+ * Build server attributes from PartyInfo directly
39
+ * @param serverInfo - Server party info
40
+ * @returns Server attributes for span instrumentation
41
+ */
42
+ export declare function buildServerAttributesFromInfo(serverInfo?: PartyInfo): Record<string, string>;
31
43
  /**
32
44
  * Extracts client connection info from extra handler data
33
45
  * @param extra - Extra handler data containing connection info
@@ -0,0 +1,8 @@
1
+ export interface ServerSpanStreamingOptions {
2
+ /** Max spans per envelope batch (default: 1000) */
3
+ maxSpanLimit?: number;
4
+ /** Flush interval in ms (default: 5000) */
5
+ flushInterval?: number;
6
+ }
7
+ export declare const serverSpanStreamingIntegration: (options?: ServerSpanStreamingOptions | undefined) => import("../types-hoist/integration").Integration;
8
+ //# sourceMappingURL=serverSpanStreaming.d.ts.map
@@ -51,6 +51,7 @@ export declare const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size";
51
51
  /** TODO: Remove these once we update to latest semantic conventions */
52
52
  export declare const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = "http.request.method";
53
53
  export declare const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full";
54
+ export declare const SEMANTIC_ATTRIBUTE_URL_QUERY = "url.query";
54
55
  /**
55
56
  * A span link attribute to mark the link as a special span link.
56
57
  *
@@ -62,4 +63,24 @@ export declare const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full";
62
63
  * @see https://develop.sentry.dev/sdk/telemetry/traces/span-links/#link-types
63
64
  */
64
65
  export declare const SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = "sentry.link.type";
66
+ /** The release version of the application */
67
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = "sentry.release";
68
+ /** The environment name (e.g., "production", "staging", "development") */
69
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = "sentry.environment";
70
+ /** The segment name (e.g., "GET /users") */
71
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = "sentry.segment.name";
72
+ /** The id of the segment that this span belongs to. */
73
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = "sentry.segment.id";
74
+ /** The user ID (gated by sendDefaultPii) */
75
+ export declare const SEMANTIC_ATTRIBUTE_USER_ID = "user.id";
76
+ /** The user email (gated by sendDefaultPii) */
77
+ export declare const SEMANTIC_ATTRIBUTE_USER_EMAIL = "user.email";
78
+ /** The user IP address (gated by sendDefaultPii) */
79
+ export declare const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = "user.ip_address";
80
+ /** The user username (gated by sendDefaultPii) */
81
+ export declare const SEMANTIC_ATTRIBUTE_USER_USERNAME = "user.name";
82
+ /** The name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") */
83
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = "sentry.sdk.name";
84
+ /** The version of the Sentry SDK */
85
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = "sentry.sdk.version";
65
86
  //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Client } from '../client';
2
+ import { Span } from '../types-hoist/span';
3
+ /**
4
+ * Captures a span and returns a JSON representation to be enqueued for sending.
5
+ *
6
+ * IMPORTANT: This function converts the span to JSON immediately to avoid writing
7
+ * to an already-ended OTel span instance (which is blocked by the OTel Span class).
8
+ */
9
+ export declare function captureSpan(span: Span, client?: Client<import("..").ClientOptions<import("..").BaseTransportOptions>> | undefined): void;
10
+ //# sourceMappingURL=captureSpan.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { Client } from '../client';
2
+ import { SpanV2JSONWithSegmentRef } from '../types-hoist/span';
3
+ export interface SpanBufferOptions {
4
+ /** Max spans per trace before auto-flush (default: 1000) */
5
+ maxSpanLimit?: number;
6
+ /** Flush interval in ms (default: 5000) */
7
+ flushInterval?: number;
8
+ }
9
+ /**
10
+ * A buffer for span JSON objects that flushes them to Sentry in Span v2 envelopes.
11
+ * Handles interval-based flushing, size thresholds, and graceful shutdown.
12
+ */
13
+ export declare class SpanBuffer {
14
+ private _spanTreeMap;
15
+ private _flushIntervalId;
16
+ private _client;
17
+ private _maxSpanLimit;
18
+ private _flushInterval;
19
+ constructor(client: Client, options?: SpanBufferOptions);
20
+ /**
21
+ * Add a span to the buffer.
22
+ */
23
+ addSpan(spanJSON: SpanV2JSONWithSegmentRef): void;
24
+ /**
25
+ * Flush all buffered traces.
26
+ */
27
+ flush(): void;
28
+ private _flushTrace;
29
+ private _debounceFlushInterval;
30
+ }
31
+ //# sourceMappingURL=spanBuffer.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { RawAttributes } from '../attributes';
2
+ import { Contexts } from '../types-hoist/context';
3
+ import { SpanV2JSON } from '../types-hoist/span';
4
+ /**
5
+ * Only set a span JSON attribute if it is not already set.
6
+ * This is used to safely set attributes on JSON objects without mutating already-ended span instances.
7
+ */
8
+ export declare function safeSetSpanJSONAttributes(spanJSON: SpanV2JSON, newAttributes: RawAttributes<Record<string, unknown>>): void;
9
+ /**
10
+ * Apply a user-provided beforeSendSpan callback to a span JSON.
11
+ */
12
+ export declare function applyBeforeSendSpanCallback(span: SpanV2JSON, beforeSendSpan: (span: SpanV2JSON) => SpanV2JSON): SpanV2JSON;
13
+ /**
14
+ * Converts a context object to a set of attributes.
15
+ * Only includes attributes that are primitives (for now).
16
+ * @param contexts - The context object to convert.
17
+ * @returns The attributes object.
18
+ */
19
+ export declare function contextsToAttributes(contexts: Contexts): RawAttributes<Record<string, unknown>>;
20
+ //# sourceMappingURL=spanFirstUtils.d.ts.map
@@ -3,26 +3,6 @@
3
3
  * Messages exceeding this limit will be truncated.
4
4
  */
5
5
  export declare const DEFAULT_GEN_AI_MESSAGES_BYTE_LIMIT = 20000;
6
- /**
7
- * Truncate an array of messages to fit within a byte limit.
8
- *
9
- * Strategy:
10
- * - Keeps the newest messages (from the end of the array)
11
- * - Uses O(n) algorithm: precompute sizes once, then find largest suffix under budget
12
- * - If no complete messages fit, attempts to truncate the newest single message
13
- *
14
- * @param messages - Array of messages to truncate
15
- * @param maxBytes - Maximum total byte limit for all messages
16
- * @returns Truncated array of messages
17
- *
18
- * @example
19
- * ```ts
20
- * const messages = [msg1, msg2, msg3, msg4]; // newest is msg4
21
- * const truncated = truncateMessagesByBytes(messages, 10000);
22
- * // Returns [msg3, msg4] if they fit, or [msg4] if only it fits, etc.
23
- * ```
24
- */
25
- export declare function truncateMessagesByBytes(messages: unknown[], maxBytes: number): unknown[];
26
6
  /**
27
7
  * Truncate GenAI messages using the default byte limit.
28
8
  *
@@ -7,4 +7,29 @@ export declare function shouldInstrument(methodPath: string): methodPath is Goog
7
7
  * Check if a method is a streaming method
8
8
  */
9
9
  export declare function isStreamingMethod(methodPath: string): boolean;
10
+ export type ContentListUnion = Content | Content[] | PartListUnion;
11
+ export type ContentUnion = Content | PartUnion[] | PartUnion;
12
+ export type Content = {
13
+ parts?: Part[];
14
+ role?: string;
15
+ };
16
+ export type PartUnion = Part | string;
17
+ export type Part = Record<string, unknown> & {
18
+ inlineData?: {
19
+ data?: string;
20
+ displayName?: string;
21
+ mimeType?: string;
22
+ };
23
+ text?: string;
24
+ };
25
+ export type PartListUnion = PartUnion[] | PartUnion;
26
+ export type Message = Record<string, unknown> & {
27
+ role: string;
28
+ content?: PartListUnion;
29
+ parts?: PartListUnion;
30
+ };
31
+ /**
32
+ *
33
+ */
34
+ export declare function contentUnionToMessages(content: ContentListUnion, role?: string): Message[];
10
35
  //# sourceMappingURL=utils.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { SpanLink } from '../types-hoist/link';
2
- import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput } from '../types-hoist/span';
2
+ import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput, SpanV2JSON } from '../types-hoist/span';
3
3
  import { SpanStatus } from '../types-hoist/spanStatus';
4
4
  import { TimedEvent } from '../types-hoist/timedEvent';
5
5
  /**
@@ -77,6 +77,15 @@ export declare class SentrySpan implements Span {
77
77
  * use `spanToJSON(span)` instead.
78
78
  */
79
79
  getSpanJSON(): SpanJSON;
80
+ /**
81
+ * Get SpanV2JSON representation of this span.
82
+ *
83
+ * @hidden
84
+ * @internal This method is purely for internal purposes and should not be used outside
85
+ * of SDK code. If you need to get a JSON representation of a span,
86
+ * use `spanToV2JSON(span)` instead.
87
+ */
88
+ getSpanV2JSON(): SpanV2JSON;
80
89
  /** @inheritdoc */
81
90
  isRecording(): boolean;
82
91
  /**
@@ -0,0 +1,19 @@
1
+ import { AttributeUnit } from '../attributes';
2
+ export type SerializedAttributes = Record<string, SerializedAttribute>;
3
+ export type SerializedAttribute = ({
4
+ type: 'string';
5
+ value: string;
6
+ } | {
7
+ type: 'integer';
8
+ value: number;
9
+ } | {
10
+ type: 'double';
11
+ value: number;
12
+ } | {
13
+ type: 'boolean';
14
+ value: boolean;
15
+ }) & {
16
+ unit?: AttributeUnit;
17
+ };
18
+ export type SerializedAttributeType = 'string' | 'integer' | 'double' | 'boolean';
19
+ //# sourceMappingURL=attributes.d.ts.map
@@ -11,7 +11,7 @@ import { Profile, ProfileChunk } from './profiling';
11
11
  import { ReplayEvent, ReplayRecordingData } from './replay';
12
12
  import { SdkInfo } from './sdkinfo';
13
13
  import { SerializedSession, SessionAggregates } from './session';
14
- import { SpanJSON } from './span';
14
+ import { SerializedSpanContainer, SpanJSON } from './span';
15
15
  export type DynamicSamplingContext = {
16
16
  trace_id: string;
17
17
  public_key: DsnComponents['publicKey'];
@@ -87,6 +87,21 @@ type ProfileChunkItemHeaders = {
87
87
  type SpanItemHeaders = {
88
88
  type: 'span';
89
89
  };
90
+ type SpanContainerItemHeaders = {
91
+ /**
92
+ * Same as v1 span item type but this envelope is distinguished by {@link SpanContainerItemHeaders.content_type}.
93
+ */
94
+ type: 'span';
95
+ /**
96
+ * The number of span items in the container. This must be the same as the number of span items in the payload.
97
+ */
98
+ item_count: number;
99
+ /**
100
+ * The content type of the span items. This must be `application/vnd.sentry.items.span.v2+json`.
101
+ * (the presence of this field also distinguishes the span item from the v1 span item)
102
+ */
103
+ content_type: 'application/vnd.sentry.items.span.v2+json';
104
+ };
90
105
  type LogContainerItemHeaders = {
91
106
  type: 'log';
92
107
  /**
@@ -120,6 +135,7 @@ export type FeedbackItem = BaseEnvelopeItem<FeedbackItemHeaders, FeedbackEvent>;
120
135
  export type ProfileItem = BaseEnvelopeItem<ProfileItemHeaders, Profile>;
121
136
  export type ProfileChunkItem = BaseEnvelopeItem<ProfileChunkItemHeaders, ProfileChunk>;
122
137
  export type SpanItem = BaseEnvelopeItem<SpanItemHeaders, Partial<SpanJSON>>;
138
+ export type SpanContainerItem = BaseEnvelopeItem<SpanContainerItemHeaders, SerializedSpanContainer>;
123
139
  export type LogContainerItem = BaseEnvelopeItem<LogContainerItemHeaders, SerializedLogContainer>;
124
140
  export type MetricContainerItem = BaseEnvelopeItem<MetricContainerItemHeaders, SerializedMetricContainer>;
125
141
  export type RawSecurityItem = BaseEnvelopeItem<RawSecurityHeaders, LegacyCSPReport>;
@@ -139,6 +155,9 @@ type ReplayEnvelopeHeaders = BaseEnvelopeHeaders;
139
155
  type SpanEnvelopeHeaders = BaseEnvelopeHeaders & {
140
156
  trace?: DynamicSamplingContext;
141
157
  };
158
+ type SpanV2EnvelopeHeaders = BaseEnvelopeHeaders & {
159
+ trace?: DynamicSamplingContext;
160
+ };
142
161
  type LogEnvelopeHeaders = BaseEnvelopeHeaders;
143
162
  type MetricEnvelopeHeaders = BaseEnvelopeHeaders;
144
163
  export type EventEnvelope = BaseEnvelope<EventEnvelopeHeaders, EventItem | AttachmentItem | UserFeedbackItem | FeedbackItem | ProfileItem>;
@@ -153,11 +172,12 @@ export type ReplayEnvelope = [
153
172
  ];
154
173
  export type CheckInEnvelope = BaseEnvelope<CheckInEnvelopeHeaders, CheckInItem>;
155
174
  export type SpanEnvelope = BaseEnvelope<SpanEnvelopeHeaders, SpanItem>;
175
+ export type SpanV2Envelope = BaseEnvelope<SpanV2EnvelopeHeaders, SpanContainerItem>;
156
176
  export type ProfileChunkEnvelope = BaseEnvelope<BaseEnvelopeHeaders, ProfileChunkItem>;
157
177
  export type RawSecurityEnvelope = BaseEnvelope<BaseEnvelopeHeaders, RawSecurityItem>;
158
178
  export type LogEnvelope = BaseEnvelope<LogEnvelopeHeaders, LogContainerItem>;
159
179
  export type MetricEnvelope = BaseEnvelope<MetricEnvelopeHeaders, MetricContainerItem>;
160
- export type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope | ProfileChunkEnvelope | ReplayEnvelope | CheckInEnvelope | SpanEnvelope | RawSecurityEnvelope | LogEnvelope | MetricEnvelope;
180
+ export type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope | ProfileChunkEnvelope | ReplayEnvelope | CheckInEnvelope | SpanEnvelope | SpanV2Envelope | RawSecurityEnvelope | LogEnvelope | MetricEnvelope;
161
181
  export type EnvelopeItem = Envelope[1][number];
162
182
  export {};
163
183
  //# sourceMappingURL=envelope.d.ts.map
@@ -19,11 +19,11 @@ export interface SpanLink {
19
19
  * Link interface for the event envelope item. It's a flattened representation of `SpanLink`.
20
20
  * Can include additional fields defined by OTel.
21
21
  */
22
- export interface SpanLinkJSON extends Record<string, unknown> {
22
+ export interface SpanLinkJSON<TAttributes = SpanLinkAttributes> extends Record<string, unknown> {
23
23
  span_id: string;
24
24
  trace_id: string;
25
25
  sampled?: boolean;
26
- attributes?: SpanLinkAttributes;
26
+ attributes?: TAttributes;
27
27
  }
28
28
  export {};
29
29
  //# sourceMappingURL=link.d.ts.map
@@ -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';
@@ -331,6 +331,19 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
331
331
  * - Tracing headers will be attached because the request URL matches the string `'https://external-api.com'`.
332
332
  */
333
333
  tracePropagationTargets?: TracePropagationTargets;
334
+ /**
335
+ * If set to `true`, the SDK propagates the W3C `traceparent` header to any outgoing requests,
336
+ * in addition to the `sentry-trace` and `baggage` headers. Use the {@link CoreOptions.tracePropagationTargets}
337
+ * option to control to which outgoing requests the header will be attached.
338
+ *
339
+ * **Important:** If you set this option to `true`, make sure that you configured your servers'
340
+ * CORS settings to allow the `traceparent` header. Otherwise, requests might get blocked.
341
+ *
342
+ * @see https://www.w3.org/TR/trace-context/
343
+ *
344
+ * @default false
345
+ */
346
+ propagateTraceparent?: boolean;
334
347
  /**
335
348
  * If set to `true`, the SDK will only continue a trace if the `organization ID` of the incoming trace found in the
336
349
  * `baggage` header matches the `organization ID` of the current Sentry client.
@@ -343,6 +356,15 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
343
356
  * @default false
344
357
  */
345
358
  strictTraceContinuation?: boolean;
359
+ /**
360
+ * [Experimental] The trace lifecycle, determining whether spans are sent statically when the entire local span tree is complete, or
361
+ * in batches, following interval- and action-based triggers.
362
+ *
363
+ * @experimental this option is currently still experimental and its type, name, or entire presence is subject to break and change at any time.
364
+ *
365
+ * @default 'static'
366
+ */
367
+ traceLifecycle?: 'static' | 'stream';
346
368
  /**
347
369
  * The organization ID for your Sentry project.
348
370
  *
@@ -419,7 +441,7 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
419
441
  *
420
442
  * @returns The modified span payload that will be sent.
421
443
  */
422
- beforeSendSpan?: (span: SpanJSON) => SpanJSON;
444
+ beforeSendSpan?: ((span: SpanJSON) => SpanJSON) | SpanV2CompatibleBeforeSendSpanCallback;
423
445
  /**
424
446
  * An event-processing callback for transaction events, guaranteed to be invoked after all other event
425
447
  * processors. This allows an event to be modified or dropped before it's sent.
@@ -445,6 +467,13 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
445
467
  */
446
468
  beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
447
469
  }
470
+ /**
471
+ * A callback that is known to be compatible with actually receiving and returning a span v2 JSON object.
472
+ * Only useful in conjunction with the {@link CoreOptions.traceLifecycle} option.
473
+ */
474
+ export type SpanV2CompatibleBeforeSendSpanCallback = ((span: SpanV2JSON) => SpanV2JSON) & {
475
+ _v2: true;
476
+ };
448
477
  /** Base configuration options for every SDK. */
449
478
  export interface CoreOptions<TO extends BaseTransportOptions = BaseTransportOptions> extends Pick<Partial<ClientOptions<TO>>, Exclude<keyof Partial<ClientOptions<TO>>, 'integrations' | 'transport' | 'stackParser'>> {
450
479
  /**
@@ -1,3 +1,4 @@
1
+ import { TypedAttributes } 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?: TypedAttributes;
34
+ links?: SpanLinkJSON<TypedAttributes>[];
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
@@ -37,7 +37,7 @@ export declare function httpRequestToRequestData(request: {
37
37
  *
38
38
  * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/http/#http-request-header
39
39
  */
40
- export declare function httpHeadersToSpanAttributes(headers: Record<string, string | string[] | undefined>): Record<string, string>;
40
+ export declare function httpHeadersToSpanAttributes(headers: Record<string, string | string[] | undefined>, sendDefaultPii?: boolean): Record<string, string>;
41
41
  /** Extract the query params from an URL. */
42
42
  export declare function extractQueryParamsFromUrl(url: string): string | undefined;
43
43
  //# sourceMappingURL=request.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 { TypedAttributes } 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<TypedAttributes>[] | 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,14 @@ 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';
74
+ /**
75
+ * Convert the attributes to the ones expected by Sentry, including the type annotation
76
+ */
77
+ export declare function getV2Attributes(attributes: SpanAttributes): TypedAttributes;
58
78
  declare const CHILD_SPANS_FIELD = "_sentryChildSpans";
59
79
  declare const ROOT_SPAN_FIELD = "_sentryRootSpan";
60
80
  type SpanWithPotentialChildren = Span & {
@@ -74,7 +94,11 @@ export declare function getSpanDescendants(span: SpanWithPotentialChildren): Spa
74
94
  /**
75
95
  * Returns the root span of a given span.
76
96
  */
77
- export declare function getRootSpan(span: SpanWithPotentialChildren): Span;
97
+ export declare const getRootSpan: typeof INTERNAL_getSegmentSpan;
98
+ /**
99
+ * Returns the segment span of a given span.
100
+ */
101
+ export declare function INTERNAL_getSegmentSpan(span: SpanWithPotentialChildren): Span;
78
102
  /**
79
103
  * Returns the currently active span.
80
104
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/core",
3
- "version": "10.30.0",
3
+ "version": "10.32.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",