Repository navigation
[SDK] Fix delta double sums retaining values from earlier intervals - #7963
Merged
martincostello merged 5 commits intoOct 16, 2026
Merged
Conversation
Reset synchronous double sums atomically at each delta snapshot so a large or non-finite measurement cannot corrupt later intervals. Use bitwise double comparisons when checking for pending data so idle NaN points can be reclaimed. Add regressions for double and float counters, tagged and untagged series, and synchronous and observable counter/gauge reclaim. Discovered by Anthropic's OSS Scanner, as bug ANT-2026-85YPFOW4.
Pull request dashboard statusMerged · refreshed 2026-10-16 15:25 UTC Status above doesn't look right?
|
Merge upstream main at 953708d before completing the changelog for PR open-telemetry#7963. Discovered by Anthropic's OSS Scanner, as bug ANT-2026-85YPFOW4.
Complete the SDK changelog after merging upstream main, with the real fix PR link open-telemetry#7963. Discovered by Anthropic's OSS Scanner, as bug ANT-2026-85YPFOW4.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The behavioral fixes still need the repository-required SDK changelog entry.
1 open finding
What changed in this PR
Fixes SDK delta floating-point counters so earlier measurements do not contaminate later intervals.
Changes:
- Atomically resets synchronous delta sums while preserving observable-counter subtraction.
- Uses bitwise comparisons for pending-data and reclamation checks.
- Adds 12 regression cases covering interval isolation and idle-point reclamation.
| File | Description |
|---|---|
| test/OpenTelemetry.Tests/Metrics/DoubleDeltaAggregationTests.cs | Adds counter and reclamation regressions. |
| src/OpenTelemetry/Metrics/MetricPoint/MetricPoint.cs | Resets delta sums and corrects pending-data comparisons. |
| src/OpenTelemetry/Internal/InterlockedHelper.cs | Exposes the existing bitwise double comparison internally. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7963 +/- ##
=======================================
Coverage 92.37% 92.37%
=======================================
Files 364 364
Lines 21090 21093 +3
=======================================
+ Hits 19482 19485 +3
Misses 1608 1608
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Kielek
marked this pull request as ready for review
October 16, 2026 12:32
martincostello
approved these changes
Oct 16, 2026
matt-hensley
approved these changes
Oct 16, 2026
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This fix addresses a ANT-2026-85YPFOW4 finding from Anthropic's OSS Scanner.
Project enrollment: anthropics/oss-scanner#117.
Changes
Delta
Counter<double>andCounter<float>exports currently subtract twoprocess-lifetime sums. After one
NaN, infinity, or large finite measurement,later intervals can export
NaN, zero, or an inaccurate sum even when all newmeasurements are ordinary. Reset the synchronous sum atomically at each delta
snapshot so each interval contains only its own measurements.
Use bitwise equality for pending-data checks on double sums and gauges so an
unchanged
NaNdoes not keep an idle point active or prevent reclamation.Observable counters retain their cumulative-input subtraction semantics.
Add 12 regression cases covering both numeric counter types, tagged and untagged
series, finite precision loss, and synchronous/observable counter/gauge
reclamation. All 12 fail on the unchanged baseline and pass after the fix on
net10.0, net9.0, net8.0, and net472. The full affected SDK Release test suite
passes all four frameworks: 6,458 passed, eight existing skips, zero failures.
Standalone solution-build and relative-path formatting results are recorded in
the local handoff. Source sanity passes on a canonical LF source snapshot with
the changes overlaid.
No public API changes.
Merge requirement checklist
CHANGELOG.mdfile(s) updated for non-trivial changesNote
This PR description was generated with OpenAI Codex.
Footnotes
Yes, I can answer maintainer questions about the content of this PR without using AI. ↩