Skip to content

Remove addNonEnumerableProperty from packages/core/src/tracing/utils.ts #15810

Closed as not planned
@AbhiPrasad

Description

@AbhiPrasad

Description

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],
};
}

Metadata

Metadata

Assignees

Labels

Package: coreIssues related to the Sentry Core SDK

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions