66} from '@sentry/core' ;
77import { getHttpRequestData , WINDOW } from '../helpers' ;
88
9+ // Treeshakable guard to remove all code related to tracing
10+ declare const __SENTRY_TRACING__ : boolean | undefined ;
11+
912/**
1013 * Collects information about HTTP request headers and
1114 * attaches them to the event.
@@ -20,19 +23,21 @@ export const httpContextIntegration = defineIntegration(() => {
2023 return ;
2124 }
2225
23- if ( client . getOptions ( ) . traceLifecycle === 'stream' ) {
24- client . on ( 'processSpan' , spanJSON => {
25- if ( spanJSON . is_segment ) {
26- const { url, headers } = getHttpRequestData ( ) ;
26+ if ( typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__ ) {
27+ if ( client . getOptions ( ) . traceLifecycle === 'stream' ) {
28+ client . on ( 'processSpan' , spanJSON => {
29+ if ( spanJSON . is_segment ) {
30+ const { url, headers } = getHttpRequestData ( ) ;
2731
28- const attributeHeaders = httpHeadersToSpanAttributes ( headers ) ;
32+ const attributeHeaders = httpHeadersToSpanAttributes ( headers ) ;
2933
30- safeSetSpanJSONAttributes ( spanJSON , {
31- [ SEMANTIC_ATTRIBUTE_URL_FULL ] : url ,
32- ...attributeHeaders ,
33- } ) ;
34- }
35- } ) ;
34+ safeSetSpanJSONAttributes ( spanJSON , {
35+ [ SEMANTIC_ATTRIBUTE_URL_FULL ] : url ,
36+ ...attributeHeaders ,
37+ } ) ;
38+ }
39+ } ) ;
40+ }
3641 }
3742 } ,
3843 preprocessEvent ( event ) {
0 commit comments