From ac1dd7a84d43aeca81e7698d03a34556b8af3586 Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 16 Feb 2026 11:05:21 +0000 Subject: [PATCH 1/2] [Infra] Docs and tests updates for .NET 10 Cherry-pick changes from #3867: - Update documentation references to .NET 10. - Fix xunit analyzer warnings for untyped data. - "De-code" some documentation references to .NET versions. - Remove version numbers from some unit test names. --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .../README.md | 10 +++---- .../HttpHandlerDiagnosticListener.cs | 4 +-- .../README.md | 8 +++--- src/Shared/Lock.cs | 4 +-- .../README.md | 2 +- .../LogSerializationTests.cs | 2 +- .../Testing.md | 2 +- .../UnixUserEventsDataTransportTests.cs | 2 +- ...ensions.Enrichment.AspNetCore.Tests.csproj | 2 +- .../README.md | 2 +- .../MetricTests.cs | 4 +-- .../RouteTests/RoutingTestCases.cs | 9 ++++--- .../RouteTests/RoutingTestCases.json | 2 -- .../RouteTests/RoutingTests.cs | 26 ++++++------------- .../README.md | 2 +- .../HttpClientTests.Basic.cs | 2 +- .../HttpClientTests.cs | 4 +-- .../HttpWebRequestTests.cs | 2 +- 19 files changed, 40 insertions(+), 51 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 941b4e9192..810bf129a6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -83,7 +83,7 @@ body: - type: input attributes: label: Runtime Version - description: What .NET runtime version did you use? (e.g. `net462`, `net48`, `net8.0` etc. You can find this information from the `*.csproj` file) + description: What .NET runtime version did you use? (e.g. `net462`, `net48`, `net10.0` etc. You can find this information from the `*.csproj` file) validations: required: true diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/README.md b/src/OpenTelemetry.Instrumentation.AspNetCore/README.md index 4922c34bed..1da2640684 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/README.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/README.md @@ -116,7 +116,7 @@ public void ConfigureServices(IServiceCollection services) Following list of attributes are added by default on `http.server.request.duration` metric. See [http-metrics](https://github.com/open-telemetry/semantic-conventions/tree/v1.23.0/docs/http/http-metrics.md) -for more details about each individual attribute. `.NET8.0` and above supports +for more details about each individual attribute. .NET 10 and above supports additional metrics, see [list of metrics produced](#list-of-metrics-produced) for more details. @@ -129,21 +129,21 @@ more details. #### List of metrics produced -When the application targets `.NET6.0` or `.NET7.0`, the instrumentation emits +When the application targets .NET 6 or .NET 7, the instrumentation emits the following metric: | Name | Details | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `http.server.request.duration` | [Specification](https://github.com/open-telemetry/semantic-conventions/blob/release/v1.23.x/docs/http/http-metrics.md#metric-httpserverrequestduration) | -Starting from `.NET8.0`, metrics instrumentation is natively implemented, and +Starting from .NET 8, metrics instrumentation is natively implemented, and the ASP.NET Core library has incorporated support for [built-in metrics](https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics-aspnetcore) following the OpenTelemetry semantic conventions. The library includes additional metrics beyond those defined in the [specification](https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md), covering additional scenarios for ASP.NET Core users. When the application -targets `.NET8.0` and newer versions, the instrumentation library automatically +targets .NET 10 and newer versions, the instrumentation library automatically enables all `built-in` metrics by default. Note that the `AddAspNetCoreInstrumentation()` extension simplifies the process @@ -162,7 +162,7 @@ to achieve this. > [!NOTE] > There is no difference in features or emitted metrics when enabling metrics -using `AddMeter()` or `AddAspNetCoreInstrumentation()` on `.NET8.0` and newer +using `AddMeter()` or `AddAspNetCoreInstrumentation()` on .NET 10 and newer versions. > [!NOTE] diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs index 18794f671b..a24f201e4c 100644 --- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs @@ -307,8 +307,8 @@ static bool TryFetchException(object? payload, [NotNullWhen(true)] out Exception private static string? GetErrorType(Exception exc) { #if NET - // For net8.0 and above exception type can be found using HttpRequestError. - // https://learn.microsoft.com/dotnet/api/system.net.http.httprequesterror?view=net-8.0 + // For .NET 8+ exception type can be found using HttpRequestError. + // https://learn.microsoft.com/dotnet/api/system.net.http.httprequesterror if (exc is HttpRequestException httpRequestException) { return httpRequestException.HttpRequestError switch diff --git a/src/OpenTelemetry.Instrumentation.Http/README.md b/src/OpenTelemetry.Instrumentation.Http/README.md index ea3f429345..c629a0be61 100644 --- a/src/OpenTelemetry.Instrumentation.Http/README.md +++ b/src/OpenTelemetry.Instrumentation.Http/README.md @@ -126,7 +126,7 @@ to see how to enable this instrumentation in an ASP.NET application. Following list of attributes are added by default on `http.client.request.duration` metric. See [http-metrics](https://github.com/open-telemetry/semantic-conventions/tree/v1.23.0/docs/http/http-metrics.md) -for more details about each individual attribute. `.NET8.0` and above supports +for more details about each individual attribute. .NET 8 and above supports additional metrics, see [list of metrics produced](#list-of-metrics-produced) for more details. @@ -147,14 +147,14 @@ instrumentation emits the following metric: | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `http.client.request.duration` | [Specification](https://github.com/open-telemetry/semantic-conventions/blob/release/v1.23.x/docs/http/http-metrics.md#metric-httpclientrequestduration) | -Starting from `.NET8.0`, metrics instrumentation is natively implemented, and +Starting from .NET 8, metrics instrumentation is natively implemented, and the HttpClient library has incorporated support for [built-in metrics](https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics-system-net) following the OpenTelemetry semantic conventions. The library includes additional metrics beyond those defined in the [specification](https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md), covering additional scenarios for HttpClient users. When the application targets -`.NET8.0` and newer versions, the instrumentation library automatically enables +.NET 8 and newer versions, the instrumentation library automatically enables all `built-in` metrics by default. Note that the `AddHttpClientInstrumentation()` extension simplifies the process @@ -173,7 +173,7 @@ to achieve this. > [!NOTE] > There is no difference in features or emitted metrics when enabling metrics -using `AddMeter()` or `AddHttpClientInstrumentation()` on `.NET8.0` and newer +using `AddMeter()` or `AddHttpClientInstrumentation()` on .NET 8 and newer versions. > [!NOTE] diff --git a/src/Shared/Lock.cs b/src/Shared/Lock.cs index 794a639c38..a51d4eb4db 100644 --- a/src/Shared/Lock.cs +++ b/src/Shared/Lock.cs @@ -4,8 +4,8 @@ #if !NET9_0_OR_GREATER namespace OpenTelemetry; -// Note: .NET9 added the System.Threading.Lock class. The goal here is when -// compiling against .NET9+ code should use System.Threading.Lock class for +// Note: .NET 9 added the System.Threading.Lock class. The goal here is when +// compiling against .NET 9+ code should use System.Threading.Lock class for // better perf. Legacy code can use this class which will perform a classic // monitor-based lock against a reference of this class. This type is not in the // System.Threading namespace so that the compiler doesn't get confused when it diff --git a/test/OpenTelemetry.Exporter.Geneva.Benchmarks/README.md b/test/OpenTelemetry.Exporter.Geneva.Benchmarks/README.md index 0b3d8ca0fe..d3df141b3c 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Benchmarks/README.md +++ b/test/OpenTelemetry.Exporter.Geneva.Benchmarks/README.md @@ -4,7 +4,7 @@ Navigate to `./test/OpenTelemetry.Exporter.Geneva.Benchmarks` directory and run the following command: ```sh -dotnet run -c Release -f net8.0 -- -m +dotnet run -c Release -f net10.0 -- -m `` Then choose the benchmark class that you want to run by entering the required diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/LogSerializationTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/LogSerializationTests.cs index 4fdd00eab8..2a5ed40b44 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/LogSerializationTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/LogSerializationTests.cs @@ -15,7 +15,7 @@ public class LogSerializationTests { /* Run from the current directory: - dotnet test -f net8.0 --filter FullyQualifiedName~LogSerializationTests -l "console;verbosity=detailed" + dotnet test -f net10.0 --filter FullyQualifiedName~LogSerializationTests -l "console;verbosity=detailed" */ [Fact] public void SerializationTestForException() diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/Testing.md b/test/OpenTelemetry.Exporter.Geneva.Tests/Testing.md index 69dceabb0f..2b627f643f 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/Testing.md +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/Testing.md @@ -137,7 +137,7 @@ Go into `test/OpenTelemetry.Exporter.Geneva.Tests` folder and run the following command in one terminal. ```bash -sudo dotnet test --configuration Debug --framework net8.0 --filter SuccessfulUserEventsExport_Linux +sudo dotnet test --configuration Debug --framework net10.0 --filter SuccessfulUserEventsExport_Linux ``` In the other terminal, run the same commands in the above steps. See the diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/UnixUserEventsDataTransportTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/UnixUserEventsDataTransportTests.cs index 2d8eb3b303..10108c0d3b 100644 --- a/test/OpenTelemetry.Exporter.Geneva.Tests/UnixUserEventsDataTransportTests.cs +++ b/test/OpenTelemetry.Exporter.Geneva.Tests/UnixUserEventsDataTransportTests.cs @@ -26,7 +26,7 @@ public class UnixUserEventsDataTransportTests * these tests do). * * Command: - * sudo dotnet test --configuration Debug --framework net8.0 --filter CategoryName=Geneva:user_events + * sudo dotnet test --configuration Debug --framework net10.0 --filter CategoryName=Geneva:user_events * * How these tests work: * diff --git a/test/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests.csproj b/test/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests.csproj index 76d50f58e8..51212befcb 100644 --- a/test/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests.csproj +++ b/test/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests/OpenTelemetry.Extensions.Enrichment.AspNetCore.Tests.csproj @@ -1,6 +1,6 @@  - + $(SupportedNetTargets) Unit test project for OpenTelemetry .NET SDK ASP.NET Core telemetry enrichment. diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/README.md b/test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/README.md index 15065fb784..797799c290 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/README.md +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks/README.md @@ -4,7 +4,7 @@ Navigate to `./test/OpenTelemetry.Instrumentation.AspNetCore.Benchmarks` directo and run the following command: ```sh -dotnet run -c Release -f net8.0 -- -m +dotnet run -c Release -f net10.0 -- -m `` Then choose the benchmark class that you want to run by entering the required diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs index c3f80a9cee..0ea35508eb 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs @@ -40,7 +40,7 @@ public void AddAspNetCoreInstrumentation_BadArgs() #if NET [Fact] - public async Task ValidateNet8MetricsAsync() + public async Task ValidateNetMetricsAsync() { var exportedItems = new List(); this.meterProvider = Sdk.CreateMeterProviderBuilder() @@ -102,7 +102,7 @@ public async Task ValidateNet8MetricsAsync() } [Fact] - public async Task ValidateNet8RateLimitingMetricsAsync() + public async Task ValidateNetRateLimitingMetricsAsync() { var exportedItems = new List(); diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.cs index caa21cfb7d..09f25c2c51 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/RoutingTestCases.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; +using Xunit; namespace RouteTests; @@ -15,7 +16,7 @@ public static class RoutingTestCases Converters = { new JsonStringEnumConverter() }, }; - public static IEnumerable GetTestCases() + public static TheoryData GetTestCases() { var assembly = Assembly.GetExecutingAssembly(); var input = JsonSerializer.Deserialize( @@ -24,9 +25,9 @@ public static IEnumerable GetTestCases() return GetArgumentsFromTestCaseObject(input!); } - private static List GetArgumentsFromTestCaseObject(IEnumerable input) + private static TheoryData GetArgumentsFromTestCaseObject(IEnumerable input) { - var result = new List(); + var result = new TheoryData(); var dotnetVersion = Environment.Version.Major; foreach (var testCase in input) @@ -37,7 +38,7 @@ private static List GetArgumentsFromTestCaseObject(IEnumerable +public class RoutingTests(RoutingTestFixture fixture) : IClassFixture { private const string HttpStatusCode = "http.response.status_code"; private const string HttpMethod = "http.request.method"; private const string HttpRoute = "http.route"; - private readonly RoutingTestFixture fixture; - - public RoutingTests(RoutingTestFixture fixture) - { - this.fixture = fixture; - } - - public static IEnumerable TestData => RoutingTestCases.GetTestCases(); - [Theory] - [MemberData(nameof(TestData))] + [MemberData(nameof(RoutingTestCases.GetTestCases), MemberType = typeof(RoutingTestCases))] public async Task TestHttpRoute_Traces(TestCase testCase) { List exportedActivities = []; @@ -37,10 +28,9 @@ public async Task TestHttpRoute_Traces(TestCase testCase) .AddInMemoryExporter(exportedActivities) .Build()!; - await this.fixture.MakeRequest(testCase.TestApplicationScenario, testCase.Path); + await fixture.MakeRequest(testCase.TestApplicationScenario, testCase.Path); - Action flushAction = () => tracerProvider.ForceFlush(); - var result = await TryWaitUntilAny(exportedActivities, flushAction); + var result = await TryWaitUntilAny(exportedActivities, () => tracerProvider.ForceFlush()); Assert.True(result, "No activities were collected"); var activity = Assert.Single(exportedActivities); @@ -71,11 +61,11 @@ public async Task TestHttpRoute_Traces(TestCase testCase) RouteInfo = RouteInfo.Current, }; - this.fixture.AddActivityTestResult(testResult); + fixture.AddActivityTestResult(testResult); } [Theory] - [MemberData(nameof(TestData))] + [MemberData(nameof(RoutingTestCases.GetTestCases), MemberType = typeof(RoutingTestCases))] public async Task TestHttpRoute_Metrics(TestCase testCase) { List exportedMetrics = []; @@ -85,7 +75,7 @@ public async Task TestHttpRoute_Metrics(TestCase testCase) .AddInMemoryExporter(exportedMetrics) .Build()!; - await this.fixture.MakeRequest(testCase.TestApplicationScenario, testCase.Path); + await fixture.MakeRequest(testCase.TestApplicationScenario, testCase.Path); var filter = new Func(x => x.Name is "http.server.request.duration" or "http.server.duration"); @@ -120,7 +110,7 @@ public async Task TestHttpRoute_Metrics(TestCase testCase) RouteInfo = RouteInfo.Current, }; - this.fixture.AddMetricsTestResult(testResult); + fixture.AddMetricsTestResult(testResult); } private static async Task TryWaitUntilAny(ICollection collection, Action flush, Func? filter = null) diff --git a/test/OpenTelemetry.Instrumentation.Http.Benchmarks/README.md b/test/OpenTelemetry.Instrumentation.Http.Benchmarks/README.md index 51e5bad021..fe2c42345a 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Benchmarks/README.md +++ b/test/OpenTelemetry.Instrumentation.Http.Benchmarks/README.md @@ -4,7 +4,7 @@ Navigate to `./test/OpenTelemetry.Instrumentation.Http.Benchmarks` directory and run the following command: ```sh -dotnet run -c Release -f net8.0 -- -m +dotnet run -c Release -f net10.0 -- -m `` Then choose the benchmark class that you want to run by entering the required diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.cs b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.cs index 2d734284cb..468de55821 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.cs +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.cs @@ -430,7 +430,7 @@ public async Task HttpRequestMethodIsSetOnActivityAsPerSpec(string originalMetho if (expectedOriginalMethod is not null and not "CUSTOM") { // HACK: THIS IS A HACK TO MAKE THE TEST PASS. - // TODO: THIS CAN BE REMOVED AFTER RUNTIME PATCHES NET9. + // TODO: THIS CAN BE REMOVED AFTER RUNTIME PATCHES NET 9+. // Currently Runtime is not following the OTel Spec for Http Spans: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client // Currently "http.request.method_original" is not being set as expected. // Tracking issue: https://github.com/dotnet/runtime/issues/109847 diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.cs b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.cs index 9814ad95fd..527f786901 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.cs +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.cs @@ -118,7 +118,7 @@ public async Task CheckEnrichmentWhenSampling() #if NET [Theory] [MemberData(nameof(TestData))] - public async Task ValidateNet8MetricsAsync(HttpOutTestCase tc) + public async Task ValidateNetMetricsAsync(HttpOutTestCase tc) { var metrics = new List(); var meterProvider = Sdk.CreateMeterProviderBuilder() @@ -351,7 +351,7 @@ private static async Task HttpOutCallsAreCollectedSuccessfullyBodyAsync( #if NET9_0_OR_GREATER // HACK: THIS IS A HACK TO MAKE THE TEST PASS. - // TODO: THIS CAN BE REMOVED AFTER RUNTIME PATCHES NET9. + // TODO: THIS CAN BE REMOVED AFTER RUNTIME PATCHES NET 9+. // Currently Runtime is not following the OTel Spec for Http Spans: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client // Currently the URL Fragment Identifier (#fragment) isn't being recorded. // Tracking issue: https://github.com/dotnet/runtime/issues/109847 diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpWebRequestTests.cs b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpWebRequestTests.cs index aec989973e..3e427a0b10 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpWebRequestTests.cs +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpWebRequestTests.cs @@ -112,7 +112,7 @@ public void HttpOutCallsAreCollectedSuccessfully(HttpOutTestCase tc) #if NET9_0_OR_GREATER // TODO: NEED TO REVIEW THE SPEC - // NET9 does not record the URL Fragment Identifier. + // NET 9+ does not record the URL Fragment Identifier. if (value.EndsWith("#fragment", StringComparison.Ordinal)) { // remove fragment from expected value From 3417d7e4785551443b94530ba597c524930eaef3 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Mon, 16 Feb 2026 11:21:59 +0000 Subject: [PATCH 2/2] [AspNetCore] Update versions Update over-zealous version changes. --- src/OpenTelemetry.Instrumentation.AspNetCore/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/README.md b/src/OpenTelemetry.Instrumentation.AspNetCore/README.md index 1da2640684..94d4312334 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/README.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/README.md @@ -116,7 +116,7 @@ public void ConfigureServices(IServiceCollection services) Following list of attributes are added by default on `http.server.request.duration` metric. See [http-metrics](https://github.com/open-telemetry/semantic-conventions/tree/v1.23.0/docs/http/http-metrics.md) -for more details about each individual attribute. .NET 10 and above supports +for more details about each individual attribute. .NET 8 and above supports additional metrics, see [list of metrics produced](#list-of-metrics-produced) for more details. @@ -143,7 +143,7 @@ following the OpenTelemetry semantic conventions. The library includes additiona metrics beyond those defined in the [specification](https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md), covering additional scenarios for ASP.NET Core users. When the application -targets .NET 10 and newer versions, the instrumentation library automatically +targets .NET 8 and newer versions, the instrumentation library automatically enables all `built-in` metrics by default. Note that the `AddAspNetCoreInstrumentation()` extension simplifies the process @@ -162,7 +162,7 @@ to achieve this. > [!NOTE] > There is no difference in features or emitted metrics when enabling metrics -using `AddMeter()` or `AddAspNetCoreInstrumentation()` on .NET 10 and newer +using `AddMeter()` or `AddAspNetCoreInstrumentation()` on .NET 8 and newer versions. > [!NOTE]