MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / _setSpanForScope

Function _setSpanForScope

packages/core/src/utils/spanOnScope.ts:16–24  ·  view source on GitHub ↗
(scope: Scope, span: Span | undefined)

Source from the content-addressed store, hash-verified

14 * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
15 */
16export function _setSpanForScope(scope: Scope, span: Span | undefined): void {
17 if (span) {
18 // Use WeakRef to avoid circular reference with span holding scope
19 addNonEnumerableProperty(scope as ScopeWithMaybeSpan, SCOPE_SPAN_FIELD, makeWeakRef(span));
20 } else {
21 // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
22 delete (scope as ScopeWithMaybeSpan)[SCOPE_SPAN_FIELD];
23 }
24}
25
26/**
27 * Get the active span for a given scope.

Callers 10

trace.test.tsFile · 0.90
cloneMethod · 0.90
clearMethod · 0.90
onIdleSpanEndedFunction · 0.90
_startIdleSpanFunction · 0.90
startSpanFunction · 0.90
startSpanManualFunction · 0.90
continueTraceFunction · 0.90
withActiveSpanFunction · 0.90

Calls 2

addNonEnumerablePropertyFunction · 0.90
makeWeakRefFunction · 0.90

Tested by

no test coverage detected