|
| 1 | +import type { SpanLink, SpanLinkJSON } from './link'; |
1 | 2 | import type { Measurements } from './measurement';
|
2 | 3 | import type { HrTime } from './opentelemetry';
|
3 | 4 | import type { SpanStatus } from './spanStatus';
|
@@ -50,6 +51,7 @@ export interface SpanJSON {
|
50 | 51 | measurements?: Measurements;
|
51 | 52 | is_segment?: boolean;
|
52 | 53 | segment_id?: string;
|
| 54 | + links?: SpanLinkJSON[]; |
53 | 55 | }
|
54 | 56 |
|
55 | 57 | // These are aligned with OpenTelemetry trace flags
|
@@ -249,14 +251,19 @@ export interface Span {
|
249 | 251 | addEvent(name: string, attributesOrStartTime?: SpanAttributes | SpanTimeInput, startTime?: SpanTimeInput): this;
|
250 | 252 |
|
251 | 253 | /**
|
252 |
| - * NOT USED IN SENTRY, only added for compliance with OTEL Span interface |
| 254 | + * Associates this span with a related span. Links can reference spans from the same or different trace |
| 255 | + * and are typically used for batch operations, cross-trace scenarios, or scatter/gather patterns. |
| 256 | + * |
| 257 | + * Prefer setting links during span creation when possible to support sampling decisions. |
| 258 | + * @param link - The link containing the context of the span to link to and optional attributes |
253 | 259 | */
|
254 |
| - addLink(link: unknown): this; |
| 260 | + addLink(link: SpanLink): this; |
255 | 261 |
|
256 | 262 | /**
|
257 |
| - * NOT USED IN SENTRY, only added for compliance with OTEL Span interface |
| 263 | + * Associates this span with multiple related spans. See {@link addLink} for more details. |
| 264 | + * @param links - Array of links to associate with this span |
258 | 265 | */
|
259 |
| - addLinks(links: unknown): this; |
| 266 | + addLinks(links: SpanLink[]): this; |
260 | 267 |
|
261 | 268 | /**
|
262 | 269 | * NOT USED IN SENTRY, only added for compliance with OTEL Span interface
|
|
0 commit comments