1
- import type { PropagationContext , Scope , TraceContext } from '@sentry/types' ;
1
+ import type { Scope , TraceContext } from '@sentry/types' ;
2
2
import type { Client } from '@sentry/types' ;
3
3
import { dropUndefinedKeys , generateSentryTraceHeader , getGlobalSingleton } from '@sentry/utils' ;
4
4
import { getAsyncContextStrategy } from './asyncContext' ;
@@ -124,12 +124,8 @@ export function getClient<C extends Client>(): C | undefined {
124
124
/**
125
125
* Get a trace context for the currently active scopes.
126
126
*/
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 ( ) ;
133
129
134
130
const { traceId, spanId, parentSpanId } = propagationContext ;
135
131
@@ -145,24 +141,7 @@ export function getTraceContextFromScopes(
145
141
/**
146
142
* Get a sentry-trace header value for the currently active scopes.
147
143
*/
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 ( ) ;
154
146
return generateSentryTraceHeader ( traceId , spanId , sampled ) ;
155
147
}
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