@sentry/core 10.31.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 (159) 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 +29 -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/sentrySpan.js +31 -0
  30. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  31. package/build/cjs/tracing/trace.js +1 -0
  32. package/build/cjs/tracing/trace.js.map +1 -1
  33. package/build/cjs/tracing/vercel-ai/index.js +1 -0
  34. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  35. package/build/cjs/utils/applyScopeDataToEvent.js +5 -0
  36. package/build/cjs/utils/applyScopeDataToEvent.js.map +1 -1
  37. package/build/cjs/utils/beforeSendSpan.js +36 -0
  38. package/build/cjs/utils/beforeSendSpan.js.map +1 -0
  39. package/build/cjs/utils/featureFlags.js +1 -0
  40. package/build/cjs/utils/featureFlags.js.map +1 -1
  41. package/build/cjs/utils/should-ignore-span.js +31 -9
  42. package/build/cjs/utils/should-ignore-span.js.map +1 -1
  43. package/build/cjs/utils/spanUtils.js +101 -2
  44. package/build/cjs/utils/spanUtils.js.map +1 -1
  45. package/build/cjs/utils/version.js +1 -1
  46. package/build/cjs/utils/version.js.map +1 -1
  47. package/build/esm/attributes.js +95 -0
  48. package/build/esm/attributes.js.map +1 -0
  49. package/build/esm/client.js +6 -1
  50. package/build/esm/client.js.map +1 -1
  51. package/build/esm/envelope.js +41 -8
  52. package/build/esm/envelope.js.map +1 -1
  53. package/build/esm/index.js +9 -3
  54. package/build/esm/index.js.map +1 -1
  55. package/build/esm/integrations/eventFilters.js +1 -1
  56. package/build/esm/integrations/eventFilters.js.map +1 -1
  57. package/build/esm/integrations/mcp-server/correlation.js +17 -3
  58. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  59. package/build/esm/integrations/mcp-server/sessionExtraction.js +43 -1
  60. package/build/esm/integrations/mcp-server/sessionExtraction.js.map +1 -1
  61. package/build/esm/integrations/mcp-server/transport.js +18 -4
  62. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  63. package/build/esm/integrations/requestdata.js +72 -6
  64. package/build/esm/integrations/requestdata.js.map +1 -1
  65. package/build/esm/integrations/serverSpanStreaming.js +49 -0
  66. package/build/esm/integrations/serverSpanStreaming.js.map +1 -0
  67. package/build/esm/package.json +1 -1
  68. package/build/esm/semanticAttributes.js +26 -1
  69. package/build/esm/semanticAttributes.js.map +1 -1
  70. package/build/esm/spans/captureSpan.js +105 -0
  71. package/build/esm/spans/captureSpan.js.map +1 -0
  72. package/build/esm/spans/spanBuffer.js +115 -0
  73. package/build/esm/spans/spanBuffer.js.map +1 -0
  74. package/build/esm/spans/spanFirstUtils.js +183 -0
  75. package/build/esm/spans/spanFirstUtils.js.map +1 -0
  76. package/build/esm/tracing/sentrySpan.js +32 -1
  77. package/build/esm/tracing/sentrySpan.js.map +1 -1
  78. package/build/esm/tracing/trace.js +1 -0
  79. package/build/esm/tracing/trace.js.map +1 -1
  80. package/build/esm/tracing/vercel-ai/index.js +1 -0
  81. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  82. package/build/esm/utils/applyScopeDataToEvent.js +5 -0
  83. package/build/esm/utils/applyScopeDataToEvent.js.map +1 -1
  84. package/build/esm/utils/beforeSendSpan.js +33 -0
  85. package/build/esm/utils/beforeSendSpan.js.map +1 -0
  86. package/build/esm/utils/featureFlags.js +1 -0
  87. package/build/esm/utils/featureFlags.js.map +1 -1
  88. package/build/esm/utils/should-ignore-span.js +31 -9
  89. package/build/esm/utils/should-ignore-span.js.map +1 -1
  90. package/build/esm/utils/spanUtils.js +97 -3
  91. package/build/esm/utils/spanUtils.js.map +1 -1
  92. package/build/esm/utils/version.js +1 -1
  93. package/build/esm/utils/version.js.map +1 -1
  94. package/build/types/attributes.d.ts +2 -2
  95. package/build/types/attributes.d.ts.map +1 -1
  96. package/build/types/client.d.ts +40 -2
  97. package/build/types/client.d.ts.map +1 -1
  98. package/build/types/envelope.d.ts +6 -1
  99. package/build/types/envelope.d.ts.map +1 -1
  100. package/build/types/index.d.ts +10 -4
  101. package/build/types/index.d.ts.map +1 -1
  102. package/build/types/integrations/mcp-server/correlation.d.ts +2 -2
  103. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  104. package/build/types/integrations/mcp-server/sessionExtraction.d.ts +13 -1
  105. package/build/types/integrations/mcp-server/sessionExtraction.d.ts.map +1 -1
  106. package/build/types/integrations/mcp-server/transport.d.ts.map +1 -1
  107. package/build/types/integrations/requestdata.d.ts.map +1 -1
  108. package/build/types/integrations/serverSpanStreaming.d.ts +8 -0
  109. package/build/types/integrations/serverSpanStreaming.d.ts.map +1 -0
  110. package/build/types/semanticAttributes.d.ts +21 -0
  111. package/build/types/semanticAttributes.d.ts.map +1 -1
  112. package/build/types/spans/captureSpan.d.ts +10 -0
  113. package/build/types/spans/captureSpan.d.ts.map +1 -0
  114. package/build/types/spans/spanBuffer.d.ts +31 -0
  115. package/build/types/spans/spanBuffer.d.ts.map +1 -0
  116. package/build/types/spans/spanFirstUtils.d.ts +20 -0
  117. package/build/types/spans/spanFirstUtils.d.ts.map +1 -0
  118. package/build/types/tracing/sentrySpan.d.ts +10 -1
  119. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  120. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  121. package/build/types/types-hoist/attributes.d.ts +19 -0
  122. package/build/types/types-hoist/attributes.d.ts.map +1 -0
  123. package/build/types/types-hoist/envelope.d.ts +22 -2
  124. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  125. package/build/types/types-hoist/link.d.ts +2 -2
  126. package/build/types/types-hoist/link.d.ts.map +1 -1
  127. package/build/types/types-hoist/options.d.ts +18 -2
  128. package/build/types/types-hoist/options.d.ts.map +1 -1
  129. package/build/types/types-hoist/span.d.ts +27 -0
  130. package/build/types/types-hoist/span.d.ts.map +1 -1
  131. package/build/types/utils/applyScopeDataToEvent.d.ts.map +1 -1
  132. package/build/types/utils/beforeSendSpan.d.ts +22 -0
  133. package/build/types/utils/beforeSendSpan.d.ts.map +1 -0
  134. package/build/types/utils/featureFlags.d.ts.map +1 -1
  135. package/build/types/utils/should-ignore-span.d.ts +3 -3
  136. package/build/types/utils/should-ignore-span.d.ts.map +1 -1
  137. package/build/types/utils/spanUtils.d.ts +26 -2
  138. package/build/types/utils/spanUtils.d.ts.map +1 -1
  139. package/build/types-ts3.8/attributes.d.ts +2 -2
  140. package/build/types-ts3.8/client.d.ts +40 -2
  141. package/build/types-ts3.8/envelope.d.ts +6 -1
  142. package/build/types-ts3.8/index.d.ts +10 -4
  143. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -2
  144. package/build/types-ts3.8/integrations/mcp-server/sessionExtraction.d.ts +13 -1
  145. package/build/types-ts3.8/integrations/serverSpanStreaming.d.ts +8 -0
  146. package/build/types-ts3.8/semanticAttributes.d.ts +21 -0
  147. package/build/types-ts3.8/spans/captureSpan.d.ts +10 -0
  148. package/build/types-ts3.8/spans/spanBuffer.d.ts +31 -0
  149. package/build/types-ts3.8/spans/spanFirstUtils.d.ts +20 -0
  150. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  151. package/build/types-ts3.8/types-hoist/attributes.d.ts +19 -0
  152. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  153. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  154. package/build/types-ts3.8/types-hoist/options.d.ts +18 -2
  155. package/build/types-ts3.8/types-hoist/span.d.ts +27 -0
  156. package/build/types-ts3.8/utils/beforeSendSpan.d.ts +22 -0
  157. package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
  158. package/build/types-ts3.8/utils/spanUtils.d.ts +26 -2
  159. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { TypedAttributes } from '../attributes';
1
2
  import type { SpanLink, SpanLinkJSON } from './link';
2
3
  import type { Measurements } from './measurement';
3
4
  import type { 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;
@@ -1 +1 @@
1
- {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../../src/types-hoist/span.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,KAAK,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;AACxC,KAAK,kBAAkB,GAAG,MAAM,CAAC;AACjC,KAAK,yBAAyB,GAAG,MAAM,CAAC;AACxC,KAAK,yBAAyB,GAAG,MAAM,CAAC;AACxC,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,GAAG,cAAc,IAAI,kBAAkB,EAAE,GACzC,GAAG,cAAc,IAAI,kBAAkB,IAAI,yBAAyB,EAAE,GACtE,GAAG,cAAc,IAAI,kBAAkB,IAAI,yBAAyB,IAAI,yBAAyB,EAAE,CAAC;AAGxG,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM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CAAC,IAAI,CAAC,GAAG,IAAI,CAEpD;AAED,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,IAAI,SAAS,aAAa,GAAG,aAAa,EACnE,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,GACxB,IAAI,CAUN"}
@@ -0,0 +1,22 @@
1
+ import type { ClientOptions, SpanV2CompatibleBeforeSendSpanCallback } from '../types-hoist/options';
2
+ import type { 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 @@
1
+ {"version":3,"file":"beforeSendSpan.d.ts","sourceRoot":"","sources":["../../../src/utils/beforeSendSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sCAAsC,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,GAAG,sCAAsC,CAIjH;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACxC,QAAQ,IAAI,sCAAsC,CAEpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../../../src/utils/featureFlags.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAIlD;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAI/C;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAcvE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,MAAmC,GAC3C,IAAI,CAON;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CA4BN;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,eAAe,GAAE,MAAqC,GACrD,IAAI,CAuBN"}
1
+ {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../../../src/utils/featureFlags.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAIlD;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAI/C;;GAEG;AAEH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAcvE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,MAAmC,GAC3C,IAAI,CAON;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CA4BN;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,eAAe,GAAE,MAAqC,GACrD,IAAI,CAuBN"}
@@ -1,12 +1,12 @@
1
1
  import type { ClientOptions } from '../types-hoist/options';
2
- import type { SpanJSON } from '../types-hoist/span';
2
+ import type { 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 +1 @@
1
- {"version":3,"file":"should-ignore-span.d.ts","sourceRoot":"","sources":["../../../src/utils/should-ignore-span.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQpD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC,EAC1C,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,GAClD,OAAO,CAgCT;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAe9E"}
1
+ {"version":3,"file":"should-ignore-span.d.ts","sourceRoot":"","sources":["../../../src/utils/should-ignore-span.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQhE;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAAC,EACpF,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,GAClD,OAAO,CAkDT;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAC,EAAE,EACvD,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAC,GACvD,IAAI,CAeN"}
@@ -1,6 +1,7 @@
1
+ import type { TypedAttributes } from '../attributes';
1
2
  import type { TraceContext } from '../types-hoist/context';
2
3
  import type { SpanLink, SpanLinkJSON } from '../types-hoist/link';
3
- import type { Span, SpanAttributes, SpanJSON, SpanTimeInput } from '../types-hoist/span';
4
+ import type { Span, SpanAttributes, SpanJSON, SpanTimeInput, SpanV2JSON } from '../types-hoist/span';
4
5
  import type { 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
  */
@@ -1 +1 @@
1
- {"version":3,"file":"spanUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/spanUtils.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAc,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAS5D,eAAO,MAAM,eAAe,IAAM,CAAC;AACnC,eAAO,MAAM,kBAAkB,IAAM,CAAC;AAItC;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CActE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAe3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAIpD;AAED;;GAEG;AACH,wBAAgB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AAyB,GAAG,IAAI,GAAG;IACtC,CAAC,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAazF;AAED,kDAAkD;AAClD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAI9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,EAAE,CAoB1E;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,gCAA0B,CAAC;AAEnD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAE7E;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,GAAG,SAAS,CAQhD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAU1C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAM7D"}
@@ -5,7 +5,7 @@ export type RawAttribute<T> = T extends {
5
5
  } | {
6
6
  unit: any;
7
7
  } ? AttributeObject : T;
8
- export type Attributes = Record<string, TypedAttributeValue>;
8
+ export type TypedAttributes = Record<string, TypedAttributeValue>;
9
9
  export type AttributeValueType = string | number | boolean | Array<string> | Array<number> | Array<boolean>;
10
10
  type AttributeTypeMap = {
11
11
  string: string;
@@ -30,7 +30,7 @@ export type AttributeObject = {
30
30
  value: unknown;
31
31
  unit?: AttributeUnit;
32
32
  };
33
- type AttributeUnit = DurationUnit | InformationUnit | FractionUnit;
33
+ export type AttributeUnit = DurationUnit | InformationUnit | FractionUnit;
34
34
  export type ValidatedAttributes<T> = {
35
35
  [K in keyof T]: T[K] extends {
36
36
  value: any;
@@ -1,5 +1,5 @@
1
1
  import { IntegrationIndex } from './integration';
2
- import { Scope } from './scope';
2
+ import { Scope, ScopeData } from './scope';
3
3
  import { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types-hoist/breadcrumb';
4
4
  import { CheckIn, MonitorConfig } from './types-hoist/checkin';
5
5
  import { EventDropReason, Outcome } from './types-hoist/clientreport';
@@ -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, SpanV2JSON, SpanV2JSONWithSegmentRef } from './types-hoist/span';
22
22
  import { StartSpanOptions } from './types-hoist/startSpanOptions';
23
23
  import { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
24
24
  /**
@@ -207,6 +207,30 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
207
207
  * @returns {() => void} A function that, when executed, removes the registered callback.
208
208
  */
209
209
  on(hook: 'spanEnd', callback: (span: Span) => void): () => void;
210
+ /**
211
+ * Register a callback for after a span is ended.
212
+ */
213
+ on(hook: 'afterSpanEnd', callback: (span: Span) => void): () => void;
214
+ /**
215
+ * Register a callback for after a segment span is ended.
216
+ */
217
+ on(hook: 'afterSegmentSpanEnd', callback: (span: Span) => void): () => void;
218
+ /**
219
+ * Register a callback for when the span JSON is ready to be enqueued into the span buffer.
220
+ */
221
+ on(hook: 'enqueueSpan', callback: (spanJSON: SpanV2JSONWithSegmentRef) => void): () => void;
222
+ /**
223
+ * Register a callback for when a span JSON is processed, to add some data to the span JSON.
224
+ */
225
+ on(hook: 'processSpan', callback: (spanJSON: SpanV2JSON, hint: {
226
+ readOnlySpan: Span;
227
+ }) => void): () => void;
228
+ /**
229
+ * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.
230
+ */
231
+ on(hook: 'processSegmentSpan', callback: (spanJSON: SpanV2JSON, hint: {
232
+ scopeData: ScopeData;
233
+ }) => void): () => void;
210
234
  /**
211
235
  * Register a callback for when an idle span is allowed to auto-finish.
212
236
  * @returns {() => void} A function that, when executed, removes the registered callback.
@@ -402,6 +426,20 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
402
426
  }): void;
403
427
  /** Fire a hook whenever a span ends. */
404
428
  emit(hook: 'spanEnd', span: Span): void;
429
+ /** Fire a hook after the `spanEnd` hook */
430
+ emit(hook: 'afterSpanEnd', span: Span): void;
431
+ /** Fire a hook after a span is processed, to add some attributes to the span JSON. */
432
+ emit(hook: 'processSpan', spanJSON: SpanV2JSON, hint: {
433
+ readOnlySpan: Span;
434
+ }): void;
435
+ /** Fire a hook after a span is processed, to add some attributes to the span JSON. */
436
+ emit(hook: 'processSegmentSpan', spanJSON: SpanV2JSON, hint: {
437
+ scopeData: ScopeData;
438
+ }): void;
439
+ /** Fire a hook after the `segmentSpanEnd` hook is fired. */
440
+ emit(hook: 'afterSegmentSpanEnd', span: Span): void;
441
+ /** Fire a hook after a span ready to be enqueued into the span buffer. */
442
+ emit(hook: 'enqueueSpan', spanJSON: SpanV2JSONWithSegmentRef): void;
405
443
  /**
406
444
  * Fire a hook indicating that an idle span is allowed to auto finish.
407
445
  */
@@ -2,11 +2,12 @@ import { Client } from './client';
2
2
  import { SentrySpan } from './tracing/sentrySpan';
3
3
  import { LegacyCSPReport } from './types-hoist/csp';
4
4
  import { DsnComponents } from './types-hoist/dsn';
5
- import { EventEnvelope, RawSecurityEnvelope, SessionEnvelope, SpanEnvelope } from './types-hoist/envelope';
5
+ import { DynamicSamplingContext, EventEnvelope, RawSecurityEnvelope, SessionEnvelope, SpanEnvelope, SpanV2Envelope } from './types-hoist/envelope';
6
6
  import { Event } from './types-hoist/event';
7
7
  import { SdkInfo } from './types-hoist/sdkinfo';
8
8
  import { SdkMetadata } from './types-hoist/sdkmetadata';
9
9
  import { Session, SessionAggregates } from './types-hoist/session';
10
+ import { SpanV2JSON } from './types-hoist/span';
10
11
  /**
11
12
  * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.
12
13
  * Merge with existing data if any.
@@ -29,6 +30,10 @@ export declare function createSpanEnvelope(spans: [
29
30
  SentrySpan,
30
31
  ...SentrySpan[]
31
32
  ], client?: Client): SpanEnvelope;
33
+ /**
34
+ * Creates a span v2 envelope
35
+ */
36
+ export declare function createSpanV2Envelope(serializedSpans: SpanV2JSON[], dsc: Partial<DynamicSamplingContext>, client: Client): SpanV2Envelope;
32
37
  /**
33
38
  * Create an Envelope from a CSP report.
34
39
  */
@@ -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';
@@ -35,7 +35,10 @@ export { handleCallbackErrors } from './utils/handleCallbackErrors';
35
35
  export { parameterize, fmt } from './utils/parameterize';
36
36
  export { addAutoIpAddressToSession } from './utils/ipAddress';
37
37
  export { addAutoIpAddressToUser } from './utils/ipAddress';
38
- 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';
39
42
  export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope';
40
43
  export { parseSampleRate } from './utils/parseSampleRate';
41
44
  export { applySdkMetadata } from './utils/sdkMetadata';
@@ -61,6 +64,7 @@ export { thirdPartyErrorFilterIntegration } from './integrations/third-party-err
61
64
  export { consoleIntegration } from './integrations/console';
62
65
  export { featureFlagsIntegration, FeatureFlagsIntegration } from './integrations/featureFlags';
63
66
  export { growthbookIntegration } from './integrations/featureFlags';
67
+ export { serverSpanStreamingIntegration } from './integrations/serverSpanStreaming';
64
68
  export { profiler } from './profiling';
65
69
  export { instrumentFetchRequest } from './fetch';
66
70
  export { trpcMiddleware } from './trpc';
@@ -145,6 +149,8 @@ export { flushIfServerless } from './utils/flushIfServerless';
145
149
  export { SDK_VERSION } from './utils/version';
146
150
  export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids';
147
151
  export { escapeStringForRegex } from './vendor/escapeStringForRegex';
152
+ export { isV2BeforeSendSpanCallback, withStreamSpan } from './utils/beforeSendSpan';
153
+ export { shouldIgnoreSpan, reparentChildSpans } from './utils/should-ignore-span';
148
154
  export { Attachment } from './types-hoist/attachment';
149
155
  export { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, XhrBreadcrumbData, FetchBreadcrumbHint, XhrBreadcrumbHint, } from './types-hoist/breadcrumb';
150
156
  export { ClientReport, Outcome, EventDropReason } from './types-hoist/clientreport';
@@ -152,7 +158,7 @@ export { Context, Contexts, DeviceContext, OsContext, AppContext, CultureContext
152
158
  export { DataCategory } from './types-hoist/datacategory';
153
159
  export { DsnComponents, DsnLike, DsnProtocol } from './types-hoist/dsn';
154
160
  export { DebugImage, DebugMeta } from './types-hoist/debugMeta';
155
- 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';
156
162
  export { ExtendedError } from './types-hoist/error';
157
163
  export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types-hoist/event';
158
164
  export { EventProcessor } from './types-hoist/eventprocessor';
@@ -173,7 +179,7 @@ export { SdkInfo } from './types-hoist/sdkinfo';
173
179
  export { SdkMetadata } from './types-hoist/sdkmetadata';
174
180
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, SerializedSession, } from './types-hoist/session';
175
181
  export { SeverityLevel } from './types-hoist/severity';
176
- 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';
177
183
  export { SpanStatus } from './types-hoist/spanStatus';
178
184
  export { Log, LogSeverityLevel } from './types-hoist/log';
179
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
@@ -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