11import * as http from 'http' ;
22import * as https from 'https' ;
3- import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , getSpanDescendants } from '@sentry/core' ;
3+ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , getSpanDescendants , startSpan } from '@sentry/core' ;
44import type { Hub } from '@sentry/core' ;
55import { getCurrentHub , getIsolationScope , setCurrentClient } from '@sentry/core' ;
66import { Transaction } from '@sentry/core' ;
@@ -55,7 +55,6 @@ describe('tracing', () => {
5555 } ) ;
5656
5757 expect ( transaction ) . toBeInstanceOf ( Transaction ) ;
58-
5958 // eslint-disable-next-line deprecation/deprecation
6059 getCurrentScope ( ) . setSpan ( transaction ) ;
6160
@@ -207,19 +206,20 @@ describe('tracing', () => {
207206
208207 const { traceId } = getCurrentScope ( ) . getPropagationContext ( ) ;
209208
210- const request = http . get ( 'http://dogs.are.great/' ) ;
209+ // Needs an outer span, or else we skip it
210+ const request = startSpan ( { name : 'outer' } , ( ) => http . get ( 'http://dogs.are.great/' ) ) ;
211211 const sentryTraceHeader = request . getHeader ( 'sentry-trace' ) as string ;
212212 const baggageHeader = request . getHeader ( 'baggage' ) as string ;
213213
214214 const parts = sentryTraceHeader . split ( '-' ) ;
215215
216- // Should not include sampling decision since we don't wanna influence the tracing decisions downstream
217- expect ( parts . length ) . toEqual ( 2 ) ;
216+ expect ( parts . length ) . toEqual ( 3 ) ;
218217 expect ( parts [ 0 ] ) . toEqual ( traceId ) ;
219218 expect ( parts [ 1 ] ) . toEqual ( expect . any ( String ) ) ;
219+ expect ( parts [ 2 ] ) . toEqual ( '1' ) ;
220220
221221 expect ( baggageHeader ) . toEqual (
222- `sentry-environment=production,sentry-release=1.0.0,sentry-public_key=dogsarebadatkeepingsecrets,sentry-trace_id=${ traceId } ` ,
222+ `sentry-environment=production,sentry-release=1.0.0,sentry-public_key=dogsarebadatkeepingsecrets,sentry-trace_id=${ traceId } ,sentry-sample_rate=1,sentry-transaction=outer,sentry-sampled=true ` ,
223223 ) ;
224224 } ) ;
225225
@@ -237,7 +237,8 @@ describe('tracing', () => {
237237 } ,
238238 } ) ;
239239
240- const request = http . get ( 'http://dogs.are.great/' ) ;
240+ // Needs an outer span, or else we skip it
241+ const request = startSpan ( { name : 'outer' } , ( ) => http . get ( 'http://dogs.are.great/' ) ) ;
241242 const sentryTraceHeader = request . getHeader ( 'sentry-trace' ) as string ;
242243 const baggageHeader = request . getHeader ( 'baggage' ) as string ;
243244
0 commit comments