Skip to content

Commit 7ed50ed

Browse files
authored
fix: Defer tracing decision to downstream SDKs when using SDK without performance (#8839)
1 parent 06caf0d commit 7ed50ed

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

packages/core/src/scope.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,5 @@ function generatePropagationContext(): PropagationContext {
636636
return {
637637
traceId: uuid4(),
638638
spanId: uuid4().substring(16),
639-
sampled: false,
640639
};
641640
}

packages/hub/test/scope.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Scope', () => {
2020
expect(scope._propagationContext).toEqual({
2121
traceId: expect.any(String),
2222
spanId: expect.any(String),
23-
sampled: false,
23+
sampled: undefined,
2424
dsc: undefined,
2525
parentSpanId: undefined,
2626
});
@@ -442,7 +442,7 @@ describe('Scope', () => {
442442
expect(scope._propagationContext).toEqual({
443443
traceId: expect.any(String),
444444
spanId: expect.any(String),
445-
sampled: false,
445+
sampled: undefined,
446446
});
447447
// @ts-expect-error accessing private property
448448
expect(scope._propagationContext).not.toEqual(oldPropagationContext);

packages/node/test/integrations/http.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,11 @@ describe('tracing', () => {
208208
const baggageHeader = request.getHeader('baggage') as string;
209209

210210
const parts = sentryTraceHeader.split('-');
211-
expect(parts.length).toEqual(3);
211+
212+
// Should not include sampling decision since we don't wanna influence the tracing decisions downstream
213+
expect(parts.length).toEqual(2);
212214
expect(parts[0]).toEqual(traceId);
213215
expect(parts[1]).toEqual(expect.any(String));
214-
expect(parts[2]).toEqual('0');
215216

216217
expect(baggageHeader).toEqual(
217218
`sentry-environment=production,sentry-release=1.0.0,sentry-user_segment=segmentA,sentry-public_key=dogsarebadatkeepingsecrets,sentry-trace_id=${traceId}`,

packages/tracing-internal/src/browser/browsertracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export class BrowserTracing implements Integration {
364364
traceId: idleTransaction.traceId,
365365
spanId: idleTransaction.spanId,
366366
parentSpanId: idleTransaction.parentSpanId,
367-
sampled: !!idleTransaction.sampled,
367+
sampled: idleTransaction.sampled,
368368
});
369369
}
370370

packages/types/src/tracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type TracePropagationTargets = (string | RegExp)[];
55
export interface PropagationContext {
66
traceId: string;
77
spanId: string;
8-
sampled: boolean;
8+
sampled?: boolean;
99
parentSpanId?: string;
1010
dsc?: DynamicSamplingContext;
1111
}

packages/utils/src/tracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function tracingContextFromHeaders(
6161
const propagationContext: PropagationContext = {
6262
traceId: traceId || uuid4(),
6363
spanId: uuid4().substring(16),
64-
sampled: parentSampled === undefined ? false : parentSampled,
64+
sampled: parentSampled,
6565
};
6666

6767
if (parentSpanId) {

0 commit comments

Comments
 (0)