Skip to content

Commit c4c2c18

Browse files
committed
clean up DSC and sampled value logic
1 parent 546b5c7 commit c4c2c18

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,13 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
298298
const scope = getCurrentScope();
299299
const oldPropagationContext = scope.getPropagationContext();
300300

301+
const newDsc = oldPropagationContext.dsc || getDynamicSamplingContextFromSpan(span);
302+
const newDscSampled = newDsc.sampled === 'true' ? true : newDsc.sampled === 'false' ? false : undefined;
303+
301304
const newPropagationContext = {
302305
...oldPropagationContext,
303-
sampled: oldPropagationContext.sampled !== undefined ? oldPropagationContext.sampled : spanIsSampled(span),
304-
dsc: oldPropagationContext.dsc || getDynamicSamplingContextFromSpan(span),
306+
sampled: newDscSampled,
307+
dsc: newDsc,
305308
};
306309

307310
scope.setPropagationContext(newPropagationContext);

0 commit comments

Comments
 (0)