Skip to content

[SDK] Range check the rule based predicate double precision - #4462

Merged
dbarker merged 3 commits into
open-telemetry:mainfrom
ayush-that:rule-based-predicate-precision
Aug 21, 2026
Merged

dbarker merged 3 commits into
open-telemetry:mainfrom
ayush-that:rule-based-predicate-precision

Conversation

@ayush-that

Copy link
Copy Markdown
Contributor

Follow-up to #4366:

nit - this type should be std::uint32_t and ranged checked before use. Okay for followup PR.

Changes

double_precision becomes std::uint32_t, capped at std::numeric_limits<double>::max_digits10 (17) in ValueMatcher, where it reaches snprintf. No two doubles differ past 17 significant digits, and kValueBufferSize is already sized on that assumption. Precisions 0 through 17 format exactly as before.

I am not adding a CHANGELOG.md entry because double_precision only ever existed in #4366, which is still under [Unreleased], so no release exposed the int.

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@ayush-that
ayush-that requested a review from a team as a code owner August 20, 2026 19:24
@codecov

codecov Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.63%. Comparing base (b603742) to head (4267eb8).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4462      +/-   ##
==========================================
+ Coverage   82.62%   82.63%   +0.02%     
==========================================
  Files         512      512              
  Lines       20138    20139       +1     
==========================================
+ Hits        16637    16640       +3     
+ Misses       3501     3499       -2     
Files with missing lines Coverage Δ
sdk/src/trace/samplers/rule_based_predicate.cc 97.90% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Thank you!

@dbarker
dbarker merged commit 68a575f into open-telemetry:main Aug 21, 2026
75 checks passed
@ayush-that
ayush-that deleted the rule-based-predicate-precision branch August 21, 2026 15:17
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.

2 participants