@@ -129,32 +129,32 @@ function getSampleRandFromTraceparentAndDsc(
129129}
130130
131131/**
132- * Determines whether a new trace should be continued based on the provided client and baggage org ID.
132+ * Determines whether a new trace should be continued based on the provided baggage org ID and the client's `strictTraceContinuation` option .
133133 * If the trace should not be continued, a new trace will be started.
134134 *
135135 * The result is dependent on the `strictTraceContinuation` option in the client.
136136 * See https://develop.sentry.dev/sdk/telemetry/traces/#stricttracecontinuation
137137 */
138- export function shouldContinueTrace ( client : Client | undefined , baggageOrgId ?: string ) : boolean {
138+ export function shouldContinueTrace ( client : Client , baggageOrgId ?: string ) : boolean {
139139 const sdkOptionOrgId = deriveOrgIdFromClient ( client ) ;
140140
141- // Case: baggage orgID and SDK orgID don't match - always start new trace
141+ // Case: baggage orgID and Client orgID don't match - always start new trace
142142 if ( baggageOrgId && sdkOptionOrgId && baggageOrgId !== sdkOptionOrgId ) {
143143 debug . log (
144144 `Starting a new trace because org IDs don't match (incoming baggage: ${ baggageOrgId } , SDK options: ${ sdkOptionOrgId } )` ,
145145 ) ;
146146 return false ;
147147 }
148148
149- const strictTraceContinuation = client ? .getOptions ( ) ?. strictTraceContinuation || false ; // default for `strictTraceContinuation` is `false`
149+ const strictTraceContinuation = client . getOptions ( ) ?. strictTraceContinuation || false ; // default for `strictTraceContinuation` is `false`
150150
151151 if ( strictTraceContinuation ) {
152152 // With strict continuation enabled, start new trace if:
153- // - Baggage has orgID, but SDK doesn't have one
154- // - SDK has orgID, but baggage doesn't have one
153+ // - Baggage has orgID, but Client doesn't have one
154+ // - Client has orgID, but baggage doesn't have one
155155 if ( ( baggageOrgId && ! sdkOptionOrgId ) || ( ! baggageOrgId && sdkOptionOrgId ) ) {
156156 debug . log (
157- `Starting a new trace because strict trace continuation is enabled and one org ID is missing (incoming baggage: ${ baggageOrgId } , SDK options: ${ sdkOptionOrgId } )` ,
157+ `Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${ baggageOrgId } , SDK options: ${ sdkOptionOrgId } )` ,
158158 ) ;
159159 return false ;
160160 }
0 commit comments