Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/tracing/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ function _startRootSpan(
name,
parentSampled: finalParentSampled,
attributes: finalAttributes,
normalizedRequest: isolationScope.getScopeData().sdkProcessingMetadata.normalizedRequest,
parentSampleRate: parseSampleRate(currentPropagationContext.dsc?.sample_rate),
},
currentPropagationContext.sampleRand,
Expand Down
14 changes: 14 additions & 0 deletions packages/core/test/lib/tracing/trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,20 @@ describe('startSpan', () => {
inheritOrSampleWith: expect.any(Function),
});
});

it('passes normalizedRequest from the isolation scope to the sampling context', () => {
const options = getDefaultTestClientOptions({ tracesSampler });
client = new TestClient(options);
setCurrentClient(client);
client.init();

const normalizedRequest = { url: '/test?query=123', method: 'GET', query_string: 'query=123' };
getIsolationScope().setSDKProcessingMetadata({ normalizedRequest });

startSpan({ name: 'outer' }, () => {});

expect(tracesSampler).toHaveBeenLastCalledWith(expect.objectContaining({ normalizedRequest }));
});
});

it('includes the scope at the time the span was started when finished', async () => {
Expand Down
Loading