(span: SpanWithPotentialChildren, childSpan: Span)
| 370 | * Adds an opaque child span reference to a span. |
| 371 | */ |
| 372 | export function addChildSpanToSpan(span: SpanWithPotentialChildren, childSpan: Span): void { |
| 373 | // We store the root span reference on the child span |
| 374 | // We need this for `getRootSpan()` to work |
| 375 | const rootSpan = span[ROOT_SPAN_FIELD] || span; |
| 376 | addNonEnumerableProperty(childSpan as SpanWithPotentialChildren, ROOT_SPAN_FIELD, rootSpan); |
| 377 | |
| 378 | // We store a list of child spans on the parent span |
| 379 | // We need this for `getSpanDescendants()` to work |
| 380 | if (span[CHILD_SPANS_FIELD]) { |
| 381 | span[CHILD_SPANS_FIELD].add(childSpan); |
| 382 | } else { |
| 383 | addNonEnumerableProperty(span, CHILD_SPANS_FIELD, new Set([childSpan])); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | /** This is only used internally by Idle Spans. */ |
| 388 | export function removeChildSpanFromSpan(span: SpanWithPotentialChildren, childSpan: Span): void { |
no test coverage detected