Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(tracing): Only add user_id to DSC if sendDefaultPii is true #5344

Merged
merged 4 commits into from Jul 4, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jun 30, 2022

This PR adds the check if sendDefaultPii is set to true before adding the user_id when populating DSC.
Additionally, the PR adds some tests to check for the changed behaviour.

resolves #5343

@Lms24 Lms24 changed the title Lms dsc userid send default pii @Lms24 ref(tracing): Only add user_id to DSC if sendDefaultPii is true Jun 30, 2022
@Lms24 Lms24 changed the title @Lms24 ref(tracing): Only add user_id to DSC if sendDefaultPii is true ref(tracing): Only add user_id to DSC if sendDefaultPii is true Jun 30, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 30, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.34 KB (+0.02% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 59.86 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.94 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 52.78 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.71 KB (0%)
@sentry/browser - Webpack (minified) 64.16 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.73 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.91 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.69 KB (+0.08% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.95 KB (+0.03% 🔺)

@Lms24 Lms24 force-pushed the lms-dsc-userid-sendDefaultPii branch 2 times, most recently from 37ba42c to c873b1c Compare July 1, 2022 12:38
@Lms24 Lms24 changed the title ref(tracing): Only add user_id to DSC if sendDefaultPii is true ref(tracing): Only add user_id to DSC if sendDefaultPii is true Jul 1, 2022
@Lms24 Lms24 marked this pull request as ready for review July 1, 2022 12:44
@Lms24 Lms24 requested review from AbhiPrasad and lforst July 1, 2022 12:44
@Lms24 Lms24 force-pushed the lms-dsc-userid-sendDefaultPii branch from c873b1c to 841e236 Compare July 1, 2022 12:59
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change-to-test ratio in this PR is just... *chef's kiss* 🤌

Comment on lines 19 to 27
function createTransactionOnScope(sendDefaultPii: boolean = true) {
const options = getDefaultNodeClientOptions({
dsn: 'https://dogsarebadatkeepingsecrets@squirrelchasers.ingest.sentry.io/12312012',
tracesSampleRate: 1.0,
integrations: [new HttpIntegration({ tracing: true })],
release: '1.0.0',
environment: 'production',
sendDefaultPii,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good idea; that seems like a more sustainable solution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Member

@lforst lforst Jul 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I 100% agree

Lms24 added 2 commits July 4, 2022 09:36
takes now an options argument instead of just the sendDefaultPii flag
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding my suggestion :D

@Lms24 Lms24 merged commit d52374e into master Jul 4, 2022
@Lms24 Lms24 deleted the lms-dsc-userid-sendDefaultPii branch July 4, 2022 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DSC] Adding user_id to DSC should depend on sendDefaultPii flag
2 participants