Skip to content

[OpenTelemetry] Add AlwaysRecordSampler - #7695

Merged
martincostello merged 5 commits into
open-telemetry:mainfrom
martincostello:Add-AlwaysRecordSampler
Sep 9, 2026
Merged

martincostello merged 5 commits into
open-telemetry:mainfrom
martincostello:Add-AlwaysRecordSampler

Conversation

@martincostello

Copy link
Copy Markdown
Member

Changes

Add AlwaysRecordSampler, which is now stable (open-telemetry/opentelemetry-specification#4934), based on original proposal in #6732.

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)

Added `AlwaysRecordSampler` based on original proposal in open-telemetry#6732.

Co-Authored-By: Mahad Janjua <134644284+majanjua-amzn@users.noreply.github.com>
Comment thread src/OpenTelemetry/CHANGELOG.md Outdated
@github-actions github-actions Bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Aug 25, 2026
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.72%. Comparing base (e7c3757) to head (891e4e9).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs 91.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7695      +/-   ##
==========================================
- Coverage   91.76%   91.72%   -0.04%     
==========================================
  Files         336      337       +1     
  Lines       18302    18314      +12     
==========================================
+ Hits        16794    16798       +4     
- Misses       1508     1516       +8     
Flag Coverage Δ
unittests-Project-Experimental 91.77% <91.66%> (-0.10%) ⬇️
unittests-Project-Stable 91.80% <91.66%> (-0.05%) ⬇️

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

Files with missing lines Coverage Δ
...OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs 91.66% <91.66%> (ø)

... and 4 files with indirect coverage changes

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

Adds the stable AlwaysRecordSampler decorator to the tracing SDK.

Changes:

  • Converts Drop decisions to RecordOnly while preserving other results.
  • Adds unit tests, public API declarations, and a changelog entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs Implements the sampler decorator.
test/OpenTelemetry.Tests/Trace/AlwaysRecordSamplerTests.cs Tests construction and all decision mappings.
src/OpenTelemetry/.publicApi/Stable/PublicAPI.Unshipped.txt Registers the stable public API.
src/OpenTelemetry/CHANGELOG.md Documents the new sampler.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@martincostello
martincostello marked this pull request as ready for review August 25, 2026 13:42
@martincostello
martincostello requested a review from a team as a code owner August 25, 2026 13:42
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 25, 2026

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-10 17:04 UTC

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

@stevejgordon stevejgordon 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.

General comment. Should we add this to the samplers list in the docs too?

Comment thread src/OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs Outdated
Comment thread src/OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs Outdated
- Update list of samplers.
- Reword remarks.
- Explicit case statement.
@github-actions github-actions Bot added the documentation Documentation related label Aug 27, 2026
@martincostello martincostello added the keep-open Prevents issues and pull requests being closed as stale label Aug 29, 2026

@Kielek Kielek 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.

LGTM

Comment thread src/OpenTelemetry/Trace/Sampler/AlwaysRecordSampler.cs
@opentelemetry-pr-dashboard

This comment has been minimized.

@martincostello
martincostello added this pull request to the merge queue Sep 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 9, 2026
@martincostello
martincostello added this pull request to the merge queue Sep 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 9, 2026
@martincostello
martincostello added this pull request to the merge queue Sep 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 9, 2026
This was referenced Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants