Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the EnableAdaptiveSampling option from the .NET Core Application Insights integrations and replaces it with the more granular TracesPerSecond and SamplingRatio options, updating implementation, configuration, tests, and docs accordingly.
Changes:
- Remove
ApplicationInsightsServiceOptions.EnableAdaptiveSamplingfrom ASP.NET Core and WorkerService, including all test and config usages. - Introduce
TracesPerSecondandSamplingRatioonApplicationInsightsServiceOptions, validate their ranges, and wire them intoAzureMonitorExporterOptionsfor both ASP.NET Core and WorkerService. - Update configuration JSON files, integration fixtures, shared configuration tests, public API baselines, and documentation (README, WorkerService guide, breaking changes, changelog) to reflect the new sampling configuration model.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| NETCORE/test/WorkerIntegrationTests.Tests/WorkerHostFixture.cs | Ensures worker integration tests now force 100% telemetry via SamplingRatio = 1.0f instead of disabling adaptive sampling. |
| NETCORE/test/Shared/ConfigurationTests.cs | Adds/updates shared configuration tests to validate TracesPerSecond and SamplingRatio binding, default exporter sampling behavior, and ignoring invalid sampling values; also repurposes older adaptive-sampling tests. |
| NETCORE/test/Microsoft.ApplicationInsights.WorkerService.Tests/content/config-all-settings-true.json | Removes obsolete EnableAdaptiveSampling from WorkerService “all settings true” JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.WorkerService.Tests/content/config-all-settings-false.json | Removes obsolete EnableAdaptiveSampling from WorkerService “all settings false” JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.WorkerService.Tests/content/config-all-default.json | Removes obsolete EnableAdaptiveSampling from WorkerService default JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.WorkerService.Tests/ExtensionsTest.cs | Cleans up WorkerService extension tests by removing expectations around adaptive sampling processors and options. |
| NETCORE/test/Microsoft.ApplicationInsights.AspNetCore.Tests/content/config-all-settings-true.json | Removes obsolete EnableAdaptiveSampling from ASP.NET Core “all settings true” JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.AspNetCore.Tests/content/config-all-settings-false.json | Removes obsolete EnableAdaptiveSampling from ASP.NET Core “all settings false” JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.AspNetCore.Tests/content/config-all-default.json | Removes obsolete EnableAdaptiveSampling from ASP.NET Core default JSON config. |
| NETCORE/test/Microsoft.ApplicationInsights.AspNetCore.Tests/Extensions/ApplicationInsightsExtensionsTests/AddApplicationInsightsTelemetryTests.cs | Removes ASP.NET Core tests that asserted adaptive sampling processors and options, aligning tests with the new OpenTelemetry-based sampling model. |
| NETCORE/test/IntegrationTests.Tests/content/config-samplingratio.json | Adds integration test config with SamplingRatio set to 0.5 for validating sampling ratio config flow. |
| NETCORE/test/IntegrationTests.Tests/content/config-sampling-tracespersecond.json | Adds integration test config with TracesPerSecond set to 10.0 for validating rate-limited sampling config flow. |
| NETCORE/test/IntegrationTests.Tests/content/config-all-settings-true.json | Updates integration “all settings true” config to drop EnableAdaptiveSampling in favor of new defaults. |
| NETCORE/test/IntegrationTests.Tests/content/config-all-settings-false.json | Updates integration “all settings false” config to remove EnableAdaptiveSampling. |
| NETCORE/test/IntegrationTests.Tests/content/config-all-default.json | Updates integration default config to remove EnableAdaptiveSampling. |
| NETCORE/test/IntegrationTests.Tests/CustomWebApplicationFactory.cs | Forces integration web app tests to 100% telemetry by setting SamplingRatio = 1.0f instead of disabling adaptive sampling. |
| NETCORE/src/Shared/Extensions/ApplicationInsightsServiceOptions.cs | Removes EnableAdaptiveSampling and adds TracesPerSecond/SamplingRatio properties (with documentation) plus copies them in CopyPropertiesTo. |
| NETCORE/src/Microsoft.ApplicationInsights.WorkerService/ApplicationInsightsExtensions.cs | Wires WorkerService ApplicationInsightsServiceOptions to AzureMonitorExporterOptions, setting EnableLiveMetrics, respecting TracesPerSecond > 0, and applying valid SamplingRatio (0.0–1.0) while nulling TracesPerSecond when only SamplingRatio is set. |
| NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs | Mirrors the WorkerService sampling wiring for ASP.NET Core, removing the old EnableAdaptiveSampling logic and using TracesPerSecond/SamplingRatio to configure the exporter. |
| NETCORE/WorkerService.md | Updates WorkerService configuration example to remove EnableAdaptiveSampling, keeping QuickPulse as the primary example option. |
| NETCORE/Readme.md | Removes EnableAdaptiveSampling references and examples from ASP.NET Core documentation and migration guidance, aligning docs with the new sampling model. |
| CHANGELOG.md | Adds an unreleased note describing the removal of EnableAdaptiveSampling in favor of TracesPerSecond and SamplingRatio (with a minor naming/grammar typo noted). |
| BreakingChanges.md | Updates breaking changes documentation to mark EnableAdaptiveSampling as removed and documents new TracesPerSecond and SamplingRatio properties for both ASP.NET Core and WorkerService (with a small markdown formatting issue in one bullet). |
| .publicApi/Microsoft.ApplicationInsights.WorkerService.dll/Stable/PublicAPI.Unshipped.txt | Updates the WorkerService public API surface to remove EnableAdaptiveSampling and add TracesPerSecond/SamplingRatio accessors. |
| .publicApi/Microsoft.ApplicationInsights.AspNetCore.dll/Stable/PublicAPI.Unshipped.txt | Updates the ASP.NET Core public API surface similarly, removing EnableAdaptiveSampling and adding TracesPerSecond/SamplingRatio. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs
Outdated
Show resolved
Hide resolved
rajkumar-rangaraj
approved these changes
Jan 26, 2026
Member
rajkumar-rangaraj
left a comment
There was a problem hiding this comment.
Approved, left a minor suggestion for log.
rajkumar-rangaraj
approved these changes
Jan 26, 2026
...ORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs
Show resolved
Hide resolved
This was referenced Feb 1, 2026
Open
Open
This was referenced Feb 5, 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.
Removes EnableAdaptiveSampling & adds the tracespersecond/sampling ratio for aspnetcore/workerservice