(scope: Scope, customParentSpan: Span | null | undefined)
| 600 | } |
| 601 | |
| 602 | function getParentSpan(scope: Scope, customParentSpan: Span | null | undefined): SentrySpan | undefined { |
| 603 | // always use the passed in span directly |
| 604 | if (customParentSpan) { |
| 605 | return customParentSpan as SentrySpan; |
| 606 | } |
| 607 | |
| 608 | // This is different from `undefined` as it means the user explicitly wants no parent span |
| 609 | if (customParentSpan === null) { |
| 610 | return undefined; |
| 611 | } |
| 612 | |
| 613 | const span = _getSpanForScope(scope) as SentrySpan | undefined; |
| 614 | |
| 615 | if (!span) { |
| 616 | return undefined; |
| 617 | } |
| 618 | |
| 619 | const client = getClient(); |
| 620 | const options: Partial<ClientOptions> = client ? client.getOptions() : {}; |
| 621 | if (options.parentSpanIsAlwaysRootSpan) { |
| 622 | return getRootSpan(span) as SentrySpan; |
| 623 | } |
| 624 | |
| 625 | return span; |
| 626 | } |
| 627 | |
| 628 | function getActiveSpanWrapper<T>(parentSpan: Span | undefined | null): (callback: () => T) => T { |
| 629 | return parentSpan !== undefined |
no test coverage detected