ref(tracing): Only add user_id to DSC if sendDefaultPii is true#5344
Conversation
size-limit report 📦
|
37ba42c to
c873b1c
Compare
user_id to DSC if sendDefaultPii is true
revert unintended yarn script deletion
c873b1c to
841e236
Compare
lforst
left a comment
There was a problem hiding this comment.
Change-to-test ratio in this PR is just... *chef's kiss* 🤌
| function createTransactionOnScope(sendDefaultPii: boolean = true) { | ||
| const options = getDefaultNodeClientOptions({ | ||
| dsn: 'https://[email protected]/12312012', | ||
| tracesSampleRate: 1.0, | ||
| integrations: [new HttpIntegration({ tracing: true })], | ||
| release: '1.0.0', | ||
| environment: 'production', | ||
| sendDefaultPii, | ||
| }); |
There was a problem hiding this comment.
(optional) We could refactor this a bit so that createTransactionOnScope takes node client options as an argument which override a default (default being what's there now).
There was a problem hiding this comment.
Yes, good idea; that seems like a more sustainable solution
| it('does not add the user_id to the baggage header if sendDefaultPii is set to false', async () => { | ||
| nock('http://dogs.are.great').get('/').reply(200); | ||
|
|
||
| createTransactionOnScope(false); |
There was a problem hiding this comment.
Just seeing this in tests is so glorius. Sentry.startTransaction() should really just instantly put a transaction on the scope... I hope we get to that some day.
takes now an options argument instead of just the sendDefaultPii flag
lforst
left a comment
There was a problem hiding this comment.
Thanks for adding my suggestion :D
This PR adds the check if
sendDefaultPiiis set totruebefore adding theuser_idwhen populating DSC.Additionally, the PR adds some tests to check for the changed behaviour.
resolves #5343