Skip to content

Commit d5bab06

Browse files
committed
swap linkTraces arguments, adjust comment
1 parent 9a81cd0 commit d5bab06

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
425425
});
426426

427427
if (linkPreviousTrace !== 'off') {
428-
linkTraces({ linkPreviousTrace, consistentTraceSampling }, client);
428+
linkTraces(client, { linkPreviousTrace, consistentTraceSampling });
429429
}
430430

431431
if (WINDOW.location) {

packages/browser/src/tracing/linkedTraces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = 'sentry.previous_trace';
4848
* @param client - Sentry client
4949
*/
5050
export function linkTraces(
51+
client: Client,
5152
{
5253
linkPreviousTrace,
5354
consistentTraceSampling,
5455
}: {
5556
linkPreviousTrace: 'session-storage' | 'in-memory';
5657
consistentTraceSampling: boolean;
5758
},
58-
client: Client,
5959
): void {
6060
const useSessionStorage = linkPreviousTrace === 'session-storage';
6161

@@ -79,7 +79,7 @@ export function linkTraces(
7979
/*
8080
When users opt into `consistentTraceSampling`, we need to ensure that we propagate
8181
the previous trace's sample rate and rand to the current trace. This is necessary because otherwise, span
82-
metric extrapolation is inaccurate, as we'd propagate a too high sample rate for the subsequent traces.
82+
metric extrapolation is inaccurate, as we'd propagate too high of a sample rate for the subsequent traces.
8383
8484
So therefore, we pretend that the previous trace was the parent trace of the newly started trace. To do that,
8585
we mutate the propagation context of the current trace and set the sample rate and sample rand of the previous trace.

packages/browser/test/tracing/linkedTraces.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('linkTraces', () => {
3535
});
3636

3737
beforeEach(() => {
38-
linkTraces({ linkPreviousTrace: 'in-memory', consistentTraceSampling: false }, client);
38+
linkTraces(client, { linkPreviousTrace: 'in-memory', consistentTraceSampling: false });
3939
});
4040

4141
it("doesn't add a link if the passed span is not the root span", () => {
@@ -131,7 +131,7 @@ describe('linkTraces', () => {
131131
const clientOnSpy = vi.spyOn(client, 'on');
132132

133133
beforeEach(() => {
134-
linkTraces({ linkPreviousTrace: 'in-memory', consistentTraceSampling: true }, client);
134+
linkTraces(client, { linkPreviousTrace: 'in-memory', consistentTraceSampling: true });
135135
});
136136

137137
it('registers a beforeSampling handler', () => {

0 commit comments

Comments
 (0)