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): Simplify sample_rate serialization for DSC #5475

Merged
merged 3 commits into from Jul 28, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jul 27, 2022

This PR changes our formatting logic of the sample_rate value when the dynamic sampling context (DSC) is populated. Instead of using Number.toLocaleString with a bunch of options (which theoretically is supported by all browsers; but it turns out that IE11 doesn't support the fullwide locale we use), we now simply convert the number toString to do the job. Given that Relay now supports parsing the sample_rate from JSON format, we can drop our previous formatting logic.

Deleted a test that's IMO no longer necessary, covering the conversion of exponential to decimal notation.

Fixes #5466

@github-actions
Copy link
Contributor

github-actions bot commented Jul 27, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.36 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 59.92 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.93 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 52.79 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.69 KB (0%)
@sentry/browser - Webpack (minified) 64.13 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.71 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.11 KB (-0.11% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.76 KB (-0.18% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.01 KB (-0.2% 🔽)

@Lms24 Lms24 self-assigned this Jul 27, 2022
@Lms24 Lms24 added this to the Dynamic Sampling Context milestone Jul 27, 2022
rate !== undefined
? rate.toLocaleString('fullwide', { useGrouping: false, maximumFractionDigits: 16 })
: undefined;
const sample_rate = rate !== undefined ? JSON.stringify(rate) : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Do we even need the extra JSON.stringify call? Won't just doing sample_rate: rate below be enough?

Copy link
Member Author

@Lms24 Lms24 Jul 28, 2022

Choose a reason for hiding this comment

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

Good point. We can simplify it further to that but I think we still have to convert it toString (if I understand this test correctly).

@Lms24 Lms24 changed the title ref(tracing): Switch to JSON format when serializing the sample_rate for DSC ref(tracing): Simplify sample_rate serialization for DSC Jul 28, 2022
@Lms24 Lms24 marked this pull request as ready for review July 28, 2022 11:10
@Lms24 Lms24 requested a review from AbhiPrasad July 28, 2022 11:11
@Lms24 Lms24 merged commit 6fb4c0d into master Jul 28, 2022
@Lms24 Lms24 deleted the lms-dsc-sampleRate-json branch July 28, 2022 14:05
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.

Exception "Locale 'fullwide' is not well-formed" under Internet Explorer 11
2 participants