[AzureMonitorExporter] Add OTEL_TRACES_SAMPLER support to Exporter and AspNetCore distro #52720
Merged
rajkumar-rangaraj merged 9 commits intoAzure:mainfrom Oct 3, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for configuring Azure Monitor sampling through OpenTelemetry environment variables OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG. The feature allows users to specify either Microsoft's rate-limited or fixed-percentage samplers through standard OpenTelemetry configuration patterns.
- Added support for
microsoft.rate_limitedandmicrosoft.fixed_percentagesampler types - Implemented configuration precedence: environment variables override IConfiguration values
- Added comprehensive unit tests for both exporter and AspNetCore distribution paths
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
DefaultAzureMonitorExporterOptionsTests.cs |
New test file validating sampler configuration for the exporter options |
AddAzureMonitorTraceExporterSamplerTests.cs |
New test file verifying sampler integration with TracerProviderBuilder |
EnvironmentVariableConstants.cs |
Added constants for the new OpenTelemetry sampler environment variables |
AzureMonitorExporterEventSource.cs |
Added logging events for invalid sampler configuration |
DefaultAzureMonitorExporterOptions.cs |
Implemented sampler configuration logic for the exporter |
AzureMonitorExporterExtensions.cs |
Updated extension methods to support default options configuration |
DefaultAzureMonitorOptionsSamplerTests.cs |
New test file for AspNetCore sampler configuration |
DefaultAzureMonitorOptions.cs |
Implemented sampler configuration logic for AspNetCore |
AzureMonitorAspNetCoreEventSource.cs |
Added logging events for AspNetCore sampler validation |
| Both CHANGELOG.md files | Documented the new sampler configuration feature |
harsimar
approved these changes
Oct 2, 2025
Member
harsimar
left a comment
There was a problem hiding this comment.
This looks ok for the most part, just a minor non-blocking comment
harsimar
approved these changes
Oct 3, 2025
This was referenced Oct 24, 2025
This was referenced Nov 24, 2025
Open
Closed
Closed
Closed
Open
Closed
Closed
Open
This was referenced Dec 1, 2025
Bump Azure.Extensions.AspNetCore.Configuration.Secrets from 1.3.2 to 1.4.0
jodavis/AdaptiveRemote#25
Closed
Closed
Closed
Open
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.
OTEL_TRACES_SAMPLER/OTEL_TRACES_SAMPLER_ARG(microsoft.rate_limited,microsoft.fixed_percentage) in:DefaultAzureMonitorExporterOptionsand directAddAzureMonitorTraceExporterpathDefaultAzureMonitorOptions(AspNetCore distro)TODO