@@ -34,7 +34,6 @@ import { getScopesFromContext, setScopesOnContext } from './utils/contextData';
34
34
import { getDynamicSamplingContextFromSpan } from './utils/dynamicSamplingContext' ;
35
35
import { getSamplingDecision } from './utils/getSamplingDecision' ;
36
36
import { setIsSetup } from './utils/setupCheck' ;
37
- import { getAndCleanRequestUrlFromPropagationCarrier } from './utils/storeRequestUrlForPropagation' ;
38
37
39
38
/** Get the Sentry propagation context from a span context. */
40
39
export function getPropagationContextFromSpan ( span : Span ) : PropagationContext {
@@ -87,7 +86,7 @@ export class SentryPropagator extends W3CBaggagePropagator {
87
86
}
88
87
89
88
const activeSpan = trace . getSpan ( context ) ;
90
- const url = getCurrentURL ( carrier as { __requestUrl ?: string } , activeSpan ) ;
89
+ const url = activeSpan && getCurrentURL ( activeSpan ) ;
91
90
92
91
const tracePropagationTargets = getClient ( ) ?. getOptions ( ) ?. tracePropagationTargets ;
93
92
if (
@@ -328,25 +327,18 @@ function getExistingBaggage(carrier: unknown): string | undefined {
328
327
* So we use the following logic:
329
328
* 1. If we have an active span, we check if it has a URL attribute.
330
329
* 2. Else, if the active span has no URL attribute (e.g. it is unsampled), we check a special trace state (which we set in our sampler).
331
- * 3. Finally, we look at a special header on the carrier, which we set in the http integration.
332
330
*/
333
- function getCurrentURL ( carrier : Record < string , unknown > , span : Span | undefined ) : string | undefined {
334
- // This may be set in the http integration
335
- // We call this first to ensure the carrier is always cleaned, but we only use it if we don't have any url on the span
336
- const urlFromCarrier = getAndCleanRequestUrlFromPropagationCarrier ( carrier ) ;
337
-
338
- if ( span ) {
339
- const urlAttribute = spanToJSON ( span ) . data ?. [ SemanticAttributes . HTTP_URL ] ;
340
- if ( urlAttribute ) {
341
- return urlAttribute ;
342
- }
331
+ function getCurrentURL ( span : Span ) : string | undefined {
332
+ const urlAttribute = spanToJSON ( span ) . data ?. [ SemanticAttributes . HTTP_URL ] ;
333
+ if ( urlAttribute ) {
334
+ return urlAttribute ;
335
+ }
343
336
344
- // Also look at the traceState, which we may set in the sampler even for unsampled spans
345
- const urlTraceState = span . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_URL ) ;
346
- if ( urlTraceState ) {
347
- return urlTraceState ;
348
- }
337
+ // Also look at the traceState, which we may set in the sampler even for unsampled spans
338
+ const urlTraceState = span . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_URL ) ;
339
+ if ( urlTraceState ) {
340
+ return urlTraceState ;
349
341
}
350
342
351
- return urlFromCarrier ;
343
+ return undefined ;
352
344
}
0 commit comments