1
1
import type {
2
2
MeasurementUnit ,
3
3
Primitive ,
4
- Scope ,
5
4
Span ,
6
5
SpanAttributes ,
7
6
SpanJSON ,
@@ -24,6 +23,7 @@ import type { MetricType } from '../metrics/types';
24
23
import { SEMANTIC_ATTRIBUTE_SENTRY_OP , SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes' ;
25
24
import type { SentrySpan } from '../tracing/sentrySpan' ;
26
25
import { SPAN_STATUS_OK , SPAN_STATUS_UNSET } from '../tracing/spanstatus' ;
26
+ import { _getSpanForScope } from './spanOnScope' ;
27
27
28
28
// These are aligned with OpenTelemetry trace flags
29
29
export const TRACE_FLAG_NONE = 0x0 ;
@@ -244,33 +244,6 @@ export function getRootSpan(span: SpanWithPotentialChildren): Span {
244
244
return span [ ROOT_SPAN_FIELD ] || span ;
245
245
}
246
246
247
- const SCOPE_SPAN_FIELD = '_sentrySpan' ;
248
-
249
- type ScopeWithMaybeSpan = Scope & {
250
- [ SCOPE_SPAN_FIELD ] ?: Span ;
251
- } ;
252
-
253
- /**
254
- * Set the active span for a given scope.
255
- * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
256
- */
257
- export function _setSpanForScope ( scope : Scope , span : Span | undefined ) : void {
258
- if ( span ) {
259
- addNonEnumerableProperty ( scope as ScopeWithMaybeSpan , SCOPE_SPAN_FIELD , span ) ;
260
- } else {
261
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
262
- delete ( scope as ScopeWithMaybeSpan ) [ SCOPE_SPAN_FIELD ] ;
263
- }
264
- }
265
-
266
- /**
267
- * Get the active span for a given scope.
268
- * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
269
- */
270
- export function _getSpanForScope ( scope : ScopeWithMaybeSpan ) : Span | undefined {
271
- return scope [ SCOPE_SPAN_FIELD ] ;
272
- }
273
-
274
247
/**
275
248
* Returns the currently active span.
276
249
*/
0 commit comments