Fix _dd.p.ksr scientific notation for very small sampling rates#3721
Fix _dd.p.ksr scientific notation for very small sampling rates#3721
Conversation
Very small sampling rates (e.g. 0.000001) were formatted using C's %.6g format which outputs scientific notation like "1e-06". This changes to explicit rounding at the integer level via floor(x * 1e6 + 0.5) and %.6f formatting to always produce decimal notation with up to 6 decimal digits, trailing zeros stripped (e.g. "0.000001"). Fixes APMAPI-1869 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
✨ Fix all issues with BitsAI or with Cursor
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3721 +/- ##
==========================================
+ Coverage 68.73% 68.74% +0.01%
==========================================
Files 166 166
Lines 19030 19030
Branches 1797 1797
==========================================
+ Hits 13080 13082 +2
+ Misses 5135 5132 -3
- Partials 815 816 +1
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test three boundary cases for small sampling rates: - 0.00000051 rounds up to 0.000001 - 0.000001 stays exactly 0.000001 - 0.0000001 rounds down to 0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Benchmarks [ tracer ]Benchmark execution time: 2026-03-25 16:29:33 Comparing candidate commit 67b8312 in PR branch Found 0 performance improvements and 8 performance regressions! Performance is the same for 184 metrics, 2 unstable metrics. scenario:ContextPropagationBench/benchInject64Bit
scenario:ContextPropagationBench/benchInject64Bit-opcache
scenario:MessagePackSerializationBench/benchMessagePackSerialization
scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache
scenario:SamplingRuleMatchingBench/benchGlobMatching2-opcache
scenario:SamplingRuleMatchingBench/benchGlobMatching3-opcache
scenario:SamplingRuleMatchingBench/benchRegexMatching1
scenario:SamplingRuleMatchingBench/benchRegexMatching2
|
Description
Fix
_dd.p.ksrspan tag formatting for very small sampling rates. Rates below 0.001 were formatted using C's%.6gformat which outputs scientific notation (e.g.0.000001→"1e-06"). Changed to explicit integer-level rounding viafloor(rate * 1e6 + 0.5)and%.6fformatting to always produce decimal notation with up to 6 decimal digits, trailing zeros stripped.Fixes APMAPI-1869
Related PRs:
Testing
tests/ext/priority_sampling/028-ksr-tag-formatting.phpttests/ext/priority_sampling/029-ksr-tag-small-rate-formatting.phptverifying:"0.000001"(decimal notation, not"1e-06")Reviewer checklist