Skip to content

[SDK] Skip downscaling empty exponential histogram buckets - #8064

Merged
martincostello merged 2 commits into
open-telemetry:mainfrom
Kielek:codex/fix-empty-histogram-downscaling
Oct 29, 2026
Merged

martincostello merged 2 commits into
open-telemetry:mainfrom
Kielek:codex/fix-empty-histogram-downscaling

Conversation

@Kielek

@Kielek Kielek commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Changes

Downscaling exponential histogram buckets after reset could throw
IndexOutOfRangeException because the retained storage was mistaken for a
nonempty bucket range. Return before consolidation when the bucket range is
empty, preserving the storage for subsequent recordings.

Add 12 regression cases covering reset and never-allocated buffers, multiple
scaling levels, both histogram sign directions, and subsequent recording.
Before the fix, eight cases failed with the reported exception and four controls
passed. All 12 cases pass after the fix on net11.0, net10.0, and net472.

Fixes to: #7911
Found by Codex internal scans

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, successful build/tests, etc.)
  • Tests added/updated
  • CHANGELOG.md file(s) updated for non-trivial changes
  • Changes in public API reviewed (if applicable)
  • AI usage disclosure:
    • No AI used
    • AI-assisted
    • Bulk AI-generated
  • I have the experience and knowledge necessary to understand, review, and validate all content in this PR1

Note

This PR description was generated with OpenAI Codex.

Footnotes

  1. Yes, I can answer maintainer questions about the content of this PR without using AI. ↩

Return before consolidating an empty bucket range, including allocated storage
retained after reset. Add regression coverage for buffer reuse and scaling both
histogram sign buffers after reset.

Discovered by Codex Security Cloud, finding commit:82bed21962488191a99815deefea29f7.
@Kielek
Kielek requested a review from a team as a code owner October 29, 2026 12:32
@github-actions github-actions Bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Oct 29, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-29 13:52 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Document the fix in the OpenTelemetry changelog and link upstream PR open-telemetry#8064.

Discovered by Codex Security Cloud, finding commit:82bed21962488191a99815deefea29f7.
@martincostello martincostello added this to the v1.21.0 milestone Oct 29, 2026
@Kielek
Kielek enabled auto-merge October 29, 2026 12:39
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.75%. Comparing base (77685e3) to head (cb18361).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8064   +/-   ##
=======================================
  Coverage   90.75%   90.75%           
=======================================
  Files         382      382           
  Lines       22574    22574           
  Branches     4177     4177           
=======================================
  Hits        20486    20486           
- Misses       1506     1507    +1     
+ Partials      582      581    -1     
Flag Coverage Δ
unittests-Project-Experimental 90.74% <100.00%> (-0.04%) ⬇️
unittests-Project-Stable 90.76% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/OpenTelemetry/Metrics/CircularBufferBuckets.cs 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@Kielek
Kielek added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@martincostello
martincostello added this pull request to the merge queue Oct 29, 2026
Merged via the queue into open-telemetry:main with commit d41d4d2 Oct 29, 2026
55 checks passed
This was referenced Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants