1- import type { PropagationContext , Scope , TraceContext } from '@sentry/types' ;
1+ import type { Scope , TraceContext } from '@sentry/types' ;
22import type { Client } from '@sentry/types' ;
33import { dropUndefinedKeys , generateSentryTraceHeader , getGlobalSingleton } from '@sentry/utils' ;
44import { getAsyncContextStrategy } from './asyncContext' ;
@@ -124,12 +124,8 @@ export function getClient<C extends Client>(): C | undefined {
124124/**
125125 * Get a trace context for the currently active scopes.
126126 */
127- export function getTraceContextFromScopes (
128- scope = getCurrentScope ( ) ,
129- isolationScope = getIsolationScope ( ) ,
130- globalScope = getGlobalScope ( ) ,
131- ) : TraceContext {
132- const propagationContext = mergePropagationContexts ( scope , isolationScope , globalScope ) ;
127+ export function getTraceContextFromScope ( scope : Scope ) : TraceContext {
128+ const propagationContext = scope . getPropagationContext ( ) ;
133129
134130 const { traceId, spanId, parentSpanId } = propagationContext ;
135131
@@ -145,24 +141,7 @@ export function getTraceContextFromScopes(
145141/**
146142 * Get a sentry-trace header value for the currently active scopes.
147143 */
148- export function scopesToTraceHeader (
149- scope = getCurrentScope ( ) ,
150- isolationScope = getIsolationScope ( ) ,
151- globalScope = getGlobalScope ( ) ,
152- ) : string {
153- const { traceId, sampled, spanId } = mergePropagationContexts ( scope , isolationScope , globalScope ) ;
144+ export function scopesToTraceHeader ( scope : Scope ) : string {
145+ const { traceId, sampled, spanId } = scope . getPropagationContext ( ) ;
154146 return generateSentryTraceHeader ( traceId , spanId , sampled ) ;
155147}
156-
157- /** Get a merged propagationContext for the current scopes. */
158- export function mergePropagationContexts (
159- scope = getCurrentScope ( ) ,
160- isolationScope = getIsolationScope ( ) ,
161- globalScope = getGlobalScope ( ) ,
162- ) : PropagationContext {
163- return {
164- ...globalScope . getPropagationContext ( ) ,
165- ...isolationScope . getPropagationContext ( ) ,
166- ...scope . getPropagationContext ( ) ,
167- } ;
168- }
0 commit comments