Add DisableTelemetry support using OpenTelemetry OTEL_SDK_DISABLED#3084
Merged
rajkumar-rangaraj merged 5 commits intomainfrom Jan 24, 2026
Merged
Add DisableTelemetry support using OpenTelemetry OTEL_SDK_DISABLED#3084rajkumar-rangaraj merged 5 commits intomainfrom
rajkumar-rangaraj merged 5 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for disabling telemetry collection via the TelemetryConfiguration.DisableTelemetry property by leveraging OpenTelemetry SDK 1.15.0's OTEL_SDK_DISABLED environment variable.
Changes:
- Added
DisableTelemetryproperty support in non-DI scenarios by settingOTEL_SDK_DISABLEDenvironment variable inTelemetryConfiguration.Build() - Extended DI support to apply
IConfigureOptions<TelemetryConfiguration>callbacks in the TelemetryConfiguration factory - Implemented DI telemetry disabling by setting
OTEL_SDK_DISABLEDin IConfiguration via AzureMonitorExporterOptions Configure callback - Added tests for non-DI scenarios and updated documentation
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| BASE/src/Microsoft.ApplicationInsights/Extensibility/TelemetryConfiguration.cs | Sets OTEL_SDK_DISABLED environment variable when building SDK; removes CreateFromConfiguration method |
| BASE/src/Microsoft.ApplicationInsights/TelemetryClientExtensions.cs | Changes StartOperation to return null instead of throwing ArgumentNullException when activity is null |
| NETCORE/src/Shared/Extensions/ApplicationInsightsExtensions.cs | Updates TelemetryConfiguration factory to apply IConfigureOptions and IPostConfigureOptions callbacks |
| NETCORE/src/Microsoft.ApplicationInsights.WorkerService/ApplicationInsightsExtensions.cs | Sets OTEL_SDK_DISABLED in IConfiguration when DisableTelemetry is true |
| NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs | Sets OTEL_SDK_DISABLED in IConfiguration when DisableTelemetry is true |
| BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/TelemetryConfigurationOtelSdkDisabledTests.cs | Adds tests for DisableTelemetry in non-DI scenarios |
| docs/concepts.md | Documents DisableTelemetry usage for both non-DI and DI scenarios |
| CHANGELOG.md | Updates changelog with new feature entry |
| examples/AspNetCoreWebApp/Startup.cs | Adds commented example showing DisableTelemetry usage in DI |
| .publicApi/Microsoft.ApplicationInsights.dll/Stable/PublicAPI.Unshipped.txt | Removes CreateFromConfiguration method from public API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NETCORE/src/Microsoft.ApplicationInsights.WorkerService/ApplicationInsightsExtensions.cs
Show resolved
Hide resolved
...ORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs
Show resolved
Hide resolved
...ights.Test/Microsoft.ApplicationInsights.Tests/TelemetryConfigurationOtelSdkDisabledTests.cs
Show resolved
Hide resolved
BASE/src/Microsoft.ApplicationInsights/Extensibility/TelemetryConfiguration.cs
Show resolved
Hide resolved
...ights.Test/Microsoft.ApplicationInsights.Tests/TelemetryConfigurationOtelSdkDisabledTests.cs
Show resolved
Hide resolved
...ights.Test/Microsoft.ApplicationInsights.Tests/TelemetryConfigurationOtelSdkDisabledTests.cs
Show resolved
Hide resolved
harsimar
reviewed
Jan 23, 2026
harsimar
reviewed
Jan 23, 2026
harsimar
approved these changes
Jan 23, 2026
This was referenced Feb 1, 2026
Open
Closed
Open
This was referenced Feb 10, 2026
Closed
Merged
Closed
Merged
Closed
Closed
paulvanbrenk
added a commit
to tinytoolsllc/ai-patch-notes
that referenced
this pull request
Feb 15, 2026
Updated [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.4 to 8.0.0. <details> <summary>Release notes</summary> _Sourced from [coverlet.collector's releases](https://github.com/coverlet-coverage/coverlet/releases)._ ## 8.0.0 **Special Thanks:** A huge thank you to [@Bertk](https://github.com/Bertk) for driving the majority of the work in this release! 🎉 ### Fixed - Fix System.CommandLine 2.0 release is available [#1776](coverlet-coverage/coverlet#1776) - Fix Excluding From Coverage bad defaults from given example [#1764](coverlet-coverage/coverlet#1764) - Fix branchpoint exclusion for sdk 8.0.407 [#1741](coverlet-coverage/coverlet#1741) - Fix missing copyright information in NuGet [#1794](coverlet-coverage/coverlet#1794) - Fix bad default values in documentation [#1764](coverlet-coverage/coverlet#1764) by <https://github.com/cboudereau> ### Improvements - Coverlet MTP extension feature [#1788](coverlet-coverage/coverlet#1788) - Generate SBOM for nuget packages [#1752](coverlet-coverage/coverlet#1752) - Use multi targets projects for coverlet.collector, coverlet.msbuild.tasks packages [#1742](coverlet-coverage/coverlet#1742) - Use .NET 8.0 target framework for coverlet.core and remove Newtonsoft.Json [#1733](coverlet-coverage/coverlet#1733) - Use latest System.CommandLine version [#1660](coverlet-coverage/coverlet#1660) - Upgraded minimum required .NET SDK and runtime to .NET 8.0 LTS (Long Term Support) (**Breaking Change**) - Use [xunit.v3](https://xunit.net/docs/getting-started/v3/whats-new) for tests and example code [Diff between 6.0.4 and 8.0.0](coverlet-coverage/coverlet@v6.0.4...v8.0.0) Commits viewable in [compare view](coverlet-coverage/coverlet@v6.0.4...v8.0.0). </details> Updated [Microsoft.ApplicationInsights.WorkerService](https://github.com/Microsoft/ApplicationInsights-dotnet) from 2.23.0 to 3.0.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.ApplicationInsights.WorkerService's releases](https://github.com/Microsoft/ApplicationInsights-dotnet/releases)._ ## 3.0.0 - [Replaced `netstandard2.0` with `net8.0` target framework in `Microsoft.ApplicationInsights.NLogTarget` package.](microsoft/ApplicationInsights-dotnet#3102) ## 3.0.0-rc1 - [Removed `netstandard2.0` target framework from `Microsoft.ApplicationInsights`, `Microsoft.ApplicationInsights.AspNetCore`, and `Microsoft.ApplicationInsights.WorkerService` packages.](microsoft/ApplicationInsights-dotnet#3091) - [The JavaScript in `Microsoft.ApplicationInsights.AspNetCore` has been updated to version 10.](microsoft/ApplicationInsights-dotnet#3078) - [Centralized package version management](microsoft/ApplicationInsights-dotnet#3080) - [Update OpenTelemetry dependencies](microsoft/ApplicationInsights-dotnet#3080), [#3092](microsoft/ApplicationInsights-dotnet#3092) - OpenTelemetry 1.15.0 - OpenTelemetry.Instrumentation.AspNetCore 1.15.0 - OpenTelemetry.Instrumentation.AspNet 1.15.1 - OpenTelemetry.Instrumentation.Http 1.15.0 - OpenTelemetry.Instrumentation.SqlClient 1.15.0 - [Vendored OpenTelemetry.Resources.Azure resource detectors to NETCORE shared folder, replaced package with vendored implementation](microsoft/ApplicationInsights-dotnet#3095), [#3093](microsoft/ApplicationInsights-dotnet#3093) - [Added support to disable telemetry via TelemetryConfiguration.DisableTelemetry](microsoft/ApplicationInsights-dotnet#3084) - [Removed `EnabledAdaptiveSampling` and replaced with `TracesPerSecond` and `SamplingRatio`](microsoft/ApplicationInsights-dotnet#3085) - [Added `EnableTraceBasedLogsSampler` property to `ApplicationInsightsServiceOptions` for ASP.NET Core and WorkerService packages](microsoft/ApplicationInsights-dotnet#3088) - [Added support for `StorageDirectory` and `DisableOfflineStorage` from `TelemetryConfiguration` in DI scenarios](microsoft/ApplicationInsights-dotnet#3088) - [Update Azure.Monitor.OpenTelemetry.Exporter dependency to 1.6.0](microsoft/ApplicationInsights-dotnet#3094) ## 3.0.0-beta2 Added - Automatic configuration binding from "ApplicationInsights" section in appsettings.json for both AspNetCore and WorkerService packages with configuration precedence: environment variables > explicit configuration > appsettings.json - Added support for Entra ID (Azure Active Directory) authentication using Azure.Core.TokenCredential - Added Self Diagnostics feature - Updated the default sampler from Fixed Rate to Rate-Limited Sampling. - Update Azure Monitor Exporter to 1.6.0-beta.2 - Add comprehensive applicationinsights.config support - Add properties in TelemetryConfiguration to configure underlying exporter Bug fix - Fix TrackMetric(MetricTelemetry) unsupported telemetry type error ## 3.0.0-beta1 - The following Application Insights packages in this repo now use OpenTelemetry internally. OpenTelemetry is the industry standard for telemetry collection and provides better interoperability with other observability tools. - Microsoft.ApplicationInsights - Microsoft.ApplicationInsights.AspNetCore - Microsoft.ApplicationInsights.WorkerService - Microsoft.ApplicationInsights.Web - Microsoft.ApplicationInsights.NLogTarget - Classic APIs of the above packages are preserved; calls are translated to OpenTelemetry telemetry. - Other packages not listed above (such as certain auto-collectors and logging adapters that were published from this repo previously) will not have future versions published. See BreakingChanges.md for details. Commits viewable in [compare view](microsoft/ApplicationInsights-dotnet@2.23.0...v3.0.0). </details> Updated [Svix](https://github.com/svix/svix-webhooks) from 1.84.1 to 1.85.0. <details> <summary>Release notes</summary> _Sourced from [Svix's releases](https://github.com/svix/svix-webhooks/releases)._ ## 1.85.0 ## What's Changed * Server: Fix non-determinism with regards to overrides of specific header names * Server: Bump MSRV to 1.88.0 * Libs/Ruby: Return nil if payload is empty, instead of attempting to parse as JSON (thanks @donovanlopez) * Libs/Rust: Bump MSRV to 1.88.0 * CLI: Bump MSRV to 1.88.0 **Full Changelog**: svix/svix-webhooks@v1.84.1...v1.85.0 Commits viewable in [compare view](svix/svix-webhooks@v1.84.1...v1.85.0). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details>
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.
Summary
Adds support for disabling telemetry via
TelemetryConfiguration.DisableTelemetryproperty by leveraging OpenTelemetry SDK 1.15.0'sOTEL_SDK_DISABLEDenvironment variable.Changes
Core Implementation
DisableTelemetryistrue, setsOTEL_SDK_DISABLED=trueenvironment variable before creating the OpenTelemetry SDK, causing it to return no-op implementationsDI Support (AspNetCore/WorkerService)
AddTelemetryConfigAndClient()to applyIConfigureOptions<TelemetryConfiguration>andIPostConfigureOptions<TelemetryConfiguration>callbacks, enablingservices.Configure<TelemetryConfiguration>()patternTelemetryConfigurationinjection inAzureMonitorExporterOptions.Configureto setOTEL_SDK_DISABLEDin IConfiguration whenDisableTelemetryis trueTests
TelemetryConfigurationOtelSdkDisabledTestswith 2 tests validating the feature for non-DI scenarios[Collection("TelemetryClientTests")]to prevent parallel execution issues with environment variable manipulationDocumentation
docs/concepts.mdwith usage examples for both direct and DI scenariosCHANGELOG.mdUsage
Non-DI:
DI (ASP.NET Core / Worker Service):
Notes