Skip to content

[Extensions] Use exception helper#4134

Merged
martincostello merged 2 commits into
open-telemetry:mainfrom
martincostello:use-range-helper
Apr 16, 2026
Merged

[Extensions] Use exception helper#4134
martincostello merged 2 commits into
open-telemetry:mainfrom
martincostello:use-range-helper

Conversation

@martincostello

Copy link
Copy Markdown
Member

Relates to #4127.

Changes

Use ArgumentOutOfRangeException.ThrowIfLessThanOrEqual on .NET.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Use `ArgumentOutOfRangeException.ThrowIfLessThanOrEqual` on .NET.
@martincostello
martincostello marked this pull request as ready for review April 16, 2026 12:20
@martincostello
martincostello requested a review from a team as a code owner April 16, 2026 12:20
Copilot AI review requested due to automatic review settings April 16, 2026 12:20
@github-actions github-actions Bot added the comp:extensions Things related to OpenTelemetry.Extensions label Apr 16, 2026
@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.85%. Comparing base (9d8a364) to head (31a713c).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4134      +/-   ##
==========================================
+ Coverage   72.77%   72.85%   +0.07%     
==========================================
  Files         469      461       -8     
  Lines       18272    18206      -66     
==========================================
- Hits        13298    13264      -34     
+ Misses       4974     4942      -32     
Flag Coverage Δ
unittests-Extensions 90.78% <100.00%> (+0.04%) ⬆️
unittests-Instrumentation.Cassandra ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nTelemetry.Extensions/Trace/RateLimitingSampler.cs 100.00% <100.00%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors RateLimitingSampler argument validation in OpenTelemetry.Extensions to use the built-in .NET exception helper API (ArgumentOutOfRangeException.ThrowIfLessThanOrEqual) when targeting modern .NET, while retaining the existing fallback for older TFMs.

Changes:

  • Use ArgumentOutOfRangeException.ThrowIfLessThanOrEqual under #if NET for maxTracesPerSecond validation.
  • Keep the existing if (...) throw ... path for non-NET targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martincostello
martincostello added this pull request to the merge queue Apr 16, 2026
Merged via the queue into open-telemetry:main with commit a29f306 Apr 16, 2026
78 checks passed
@martincostello
martincostello deleted the use-range-helper branch April 16, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:extensions Things related to OpenTelemetry.Extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants