-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description
sentry-javascript/packages/core/src/tracing/utils.ts
Lines 5 to 29 in 38a499a
| const SCOPE_ON_START_SPAN_FIELD = '_sentryScope'; | |
| const ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope'; | |
| type SpanWithScopes = Span & { | |
| [SCOPE_ON_START_SPAN_FIELD]?: Scope; | |
| [ISOLATION_SCOPE_ON_START_SPAN_FIELD]?: Scope; | |
| }; | |
| /** Store the scope & isolation scope for a span, which can the be used when it is finished. */ | |
| export function setCapturedScopesOnSpan(span: Span | undefined, scope: Scope, isolationScope: Scope): void { | |
| if (span) { | |
| addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope); | |
| addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope); | |
| } | |
| } | |
| /** | |
| * Grabs the scope and isolation scope off a span that were active when the span was started. | |
| */ | |
| export function getCapturedScopesOnSpan(span: Span): { scope?: Scope; isolationScope?: Scope } { | |
| return { | |
| scope: (span as SpanWithScopes)[SCOPE_ON_START_SPAN_FIELD], | |
| isolationScope: (span as SpanWithScopes)[ISOLATION_SCOPE_ON_START_SPAN_FIELD], | |
| }; | |
| } |