Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions src/OpenTelemetry.Instrumentation.AspNetCore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 8 and above supports
additional metrics, see [list of metrics produced](#list-of-metrics-produced) for
more details.

Expand All @@ -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 8 and newer versions, the instrumentation library automatically
enables all `built-in` metrics by default.

Note that the `AddAspNetCoreInstrumentation()` extension simplifies the process
Expand All @@ -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 8 and newer
versions.
<!-- This comment is to make sure the two notes above and below are not merged -->
> [!NOTE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/OpenTelemetry.Instrumentation.Http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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.
<!-- This comment is to make sure the two notes above and below are not merged -->
> [!NOTE]
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/Lock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/OpenTelemetry.Exporter.Geneva.Benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/OpenTelemetry.Exporter.Geneva.Tests/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Target only supported net targets for AspNetCore (net8+, net9+) -->
<!-- Target only supported net targets for AspNetCore (.NET 8+) -->
<TargetFrameworks>$(SupportedNetTargets)</TargetFrameworks>
<Description>Unit test project for OpenTelemetry .NET SDK ASP.NET Core telemetry enrichment.</Description>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void AddAspNetCoreInstrumentation_BadArgs()

#if NET
[Fact]
public async Task ValidateNet8MetricsAsync()
public async Task ValidateNetMetricsAsync()
{
var exportedItems = new List<Metric>();
this.meterProvider = Sdk.CreateMeterProviderBuilder()
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task ValidateNet8MetricsAsync()
}

[Fact]
public async Task ValidateNet8RateLimitingMetricsAsync()
public async Task ValidateNetRateLimitingMetricsAsync()
{
var exportedItems = new List<Metric>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using Xunit;

namespace RouteTests;

Expand All @@ -15,7 +16,7 @@ public static class RoutingTestCases
Converters = { new JsonStringEnumConverter() },
};

public static IEnumerable<object[]> GetTestCases()
public static TheoryData<TestCase> GetTestCases()
{
var assembly = Assembly.GetExecutingAssembly();
var input = JsonSerializer.Deserialize<TestCase[]>(
Expand All @@ -24,9 +25,9 @@ public static IEnumerable<object[]> GetTestCases()
return GetArgumentsFromTestCaseObject(input!);
}

private static List<object[]> GetArgumentsFromTestCaseObject(IEnumerable<TestCase> input)
private static TheoryData<TestCase> GetArgumentsFromTestCaseObject(IEnumerable<TestCase> input)
{
var result = new List<object[]>();
var result = new TheoryData<TestCase>();
var dotnetVersion = Environment.Version.Major;

foreach (var testCase in input)
Expand All @@ -37,7 +38,7 @@ private static List<object[]> GetArgumentsFromTestCaseObject(IEnumerable<TestCas
continue;
}

result.Add([testCase]);
result.Add(testCase);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
},
{
"name": "Action without parameter (MapGroup)",
"minimumDotnetVersion": 7,
"testApplicationScenario": "MinimalApi",
"httpMethod": "GET",
"path": "/MinimalApiUsingMapGroup",
Expand All @@ -203,7 +202,6 @@
},
{
"name": "Action with parameter (MapGroup)",
"minimumDotnetVersion": 7,
"testApplicationScenario": "MinimalApi",
"httpMethod": "GET",
"path": "/MinimalApiUsingMapGroup/123",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,14 @@
namespace RouteTests;

[Collection("AspNetCore")]
public class RoutingTests : IClassFixture<RoutingTestFixture>
public class RoutingTests(RoutingTestFixture fixture) : IClassFixture<RoutingTestFixture>
{
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<object[]> TestData => RoutingTestCases.GetTestCases();

[Theory]
[MemberData(nameof(TestData))]
[MemberData(nameof(RoutingTestCases.GetTestCases), MemberType = typeof(RoutingTestCases))]
public async Task TestHttpRoute_Traces(TestCase testCase)
{
List<Activity> exportedActivities = [];
Expand All @@ -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);
Expand Down Expand Up @@ -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<Metric> exportedMetrics = [];
Expand All @@ -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<Metric, bool>(x =>
x.Name is "http.server.request.duration" or "http.server.duration");
Expand Down Expand Up @@ -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<bool> TryWaitUntilAny<T>(ICollection<T> collection, Action flush, Func<T, bool>? filter = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Metric>();
var meterProvider = Sdk.CreateMeterProviderBuilder()
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading