fix(admin): Clean up sample rate display when rates match#110832
fix(admin): Clean up sample rate display when rates match#110832priscilawebdev merged 9 commits intomasterfrom
Conversation
When effective and desired sample rates are equal, show just the rate (e.g. "100%") instead of the redundant "100.00% instead of 100.00% (~0.00%)". Also drops unnecessary ".00" suffix for whole numbers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apply formatRate to all rate values in the comparison string, dropping unnecessary ".00" suffixes (e.g. "54% instead of 60%" not "54.00% instead of 60.00%"). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use toFixed(2) with regex strip instead of modulo check, which is unreliable with floating point (e.g. 0.14 * 100 = 14.000000000000002). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies trailing zeros are preserved (e.g. 50.10% not 50.1%). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Replace exact floating-point comparison (diffSampleRate === 0) with formatted string comparison to handle near-equal rates like 0.600001 vs 0.6 that both display as "60%". Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Extract the nested ternary into a getSampleRateValue function with early returns for improved readability. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
|
This PR shows something like |
Thanks for the feedback! The decimal removal was intentional... when the value is a whole number (e.g. 100% vs 100.00%), I felt dropping the .00 made it cleaner and easier to scan. That said, I understand the preference for consistency, so I'm happy to add the decimals back. |
Always display two decimal places for sample rates instead of stripping trailing zeros from whole numbers. This keeps the formatting uniform across all values (e.g. 100.00% not 100%). Co-Authored-By: Claude Opus 4.6 <noreply@example.com>

When effective and desired sample rates match, the admin "Sample Rate (24h)" field
showed a redundant string like
100.00% instead of 100.00% (~0.00%). Now it showsthe rate cleanly (e.g.
100.00%). All rates consistently display two decimal places.formatRatehelper andgetSampleRateValuefor cleaner display logic0.600001 ≈ 0.6)Closes https://linear.app/getsentry/issue/TET-2088/add-special-handling-for-100percent-ds-sample-rate-in-admin