Skip to content

[OpenTelemetry] Release suppression for unrecorded activities - #7966

Merged
martincostello merged 4 commits into
open-telemetry:mainfrom
martincostello:ANT-2026-25IQGHJF
Oct 16, 2026
Merged

martincostello merged 4 commits into
open-telemetry:mainfrom
martincostello:ANT-2026-25IQGHJF

Conversation

@martincostello

@martincostello martincostello commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-25IQGHJF.

Changes

Fix a SuppressInstrumentationScope.Enter() reference count never being released when the Activity it was entered for is not recorded.

The ActivityStarted/ActivityStopped callbacks installed by TracerProviderSdk returned early when Activity.IsAllDataRequested was false, before calling SuppressInstrumentationScope.DecrementIfTriggered(), which is the only place the count taken by Enter() is released. With the default ParentBased(AlwaysOn) sampler, an unsampled remote parent produces an unrecorded activity. Code that called Enter() for that activity left its execution context suppressed permanently, so all later spans and logs in that context were dropped.

The reference count is now updated when every activity starts and stops, and IsAllDataRequested only decides whether the processor is notified. This is applied to both the legacy and non-legacy callbacks.

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

The changes in this PR and its description were generated with Claude Code (Claude Opus 5.5).

Footnotes

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

Release the `SuppressInstrumentationScope` reference count when any activity stops, not only activities that are recorded.

Assisted-by: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-25IQGHJF.
@github-actions github-actions Bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Oct 16, 2026
Add PR number.

Assisted-by: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-25IQGHJF.
@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-16 18:44 UTC

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

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.

🟢 Approval recommended

Both callback paths are updated consistently, with targeted regression coverage and no identified blocking issues.

0 open findings

What changed in this PR

Fixes persistent instrumentation suppression after unrecorded activities stop in the tracing SDK.

Changes:

  • Updates suppression counts regardless of recording status in both callback paths.
  • Adds regression tests for unrecorded activities and nested suppression.
  • Documents the fix in the SDK changelog.

[!NOTE]
This review was generated with GitHub Copilot.

File Description
test/​OpenTelemetry.Tests/​Trace/​TracerProviderSdkTests.cs Adds suppression regression tests and simplifies an assertion.
src/​OpenTelemetry/​Trace/​TracerProviderSdk.cs Balances suppression counts for unrecorded activities.
src/​OpenTelemetry/​CHANGELOG.md Documents the suppression fix.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@martincostello
martincostello marked this pull request as ready for review October 16, 2026 16:44
@martincostello
martincostello requested a review from a team as a code owner October 16, 2026 16:44
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.39%. Comparing base (db3d907) to head (e372aa8).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7966   +/-   ##
=======================================
  Coverage   92.39%   92.39%           
=======================================
  Files         365      365           
  Lines       21185    21180    -5     
=======================================
- Hits        19573    19570    -3     
+ Misses       1612     1610    -2     
Flag Coverage Δ
unittests-Project-Experimental 92.51% <100.00%> (-0.01%) ⬇️
unittests-Project-Stable 92.51% <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/Trace/TracerProviderSdk.cs 97.65% <100.00%> (-0.05%) ⬇️

... and 3 files with indirect coverage changes

@martincostello
martincostello added this pull request to the merge queue Oct 16, 2026
@martincostello martincostello added this to the v1.20.1 milestone Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 16, 2026
@martincostello
martincostello added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@martincostello
martincostello added this pull request to the merge queue Oct 16, 2026
Merged via the queue into open-telemetry:main with commit a5b7adf Oct 16, 2026
80 checks passed
@martincostello
martincostello deleted the ANT-2026-25IQGHJF branch October 16, 2026 18:42
This was referenced Oct 21, 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.

3 participants