Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ASP.NET Core Traces Instrumentation for .NET7+ #3246

Merged
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h
- `OpenTelemetry.ResourceDetectors.Container` from `1.0.0-beta.5` to `1.0.0-beta.6`.
- `OpenTelemetry.Instrumentation.Wcf` from `1.0.0-rc.14` to `1.0.0-rc.15`,
- .NET only, following packages updated
- `OpenTelemetry.Instrumentation.AspNetCore` from `1.7.0` to `1.7.1`,
- `OpenTelemetry.Instrumentation.EntityFrameworkCore` from `1.0.0-beta.9` to `1.0.0-beta.10`.
- .NET Framework only, following packages updated
- `OpenTelemetry.Instrumentation.AspNet` from `1.7.0-beta.1` to `1.7.0-beta.2`.
- `OpenTelemetry.Instrumentation.AspNet` from `1.7.0-beta.1` to `1.7.0-beta.2`.

### Deprecated

Expand All @@ -38,6 +39,9 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h

### Fixed

- Fix ASP.NET Core traces instrumentation for .NET7. It is now using native
support by `Microsoft.AspNetCore` instead of `OpenTelemetry.Instrumentation.AspNetCore`.

## [1.3.0](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v1.3.0)

- [Core components](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/VERSIONING.md#core-components):
Expand Down
1 change: 1 addition & 0 deletions build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ void RemoveFilesInNetFolderAvailableInAdditionalStore()
}
else if (folderRuntimeName == TargetFramework.NET7_0 || folderRuntimeName == TargetFramework.NET8_0)
{
depsJson.RollFrameworkForward(TargetFramework.NET6_0, TargetFramework.NET8_0, architectureStores);
depsJson.RollFrameworkForward(TargetFramework.NET7_0, TargetFramework.NET8_0, architectureStores);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ due to lack of stable semantic convention.
| ID | Instrumented library | Documentation | Supported versions | Instrumentation type | Status |
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `ASPNET` | ASP.NET Framework \[1\] **Not supported on .NET** | [ASP.NET metrics](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Instrumentation.AspNet-1.7.0-beta.1/src/OpenTelemetry.Instrumentation.AspNet/README.md#list-of-metrics-produced) | * | source & bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `ASPNETCORE` | ASP.NET Core \[2\] **Not supported on .NET Framework** | [ASP.NET Core metrics](https://github.com/open-telemetry/opentelemetry-dotnet/blob/Instrumentation.AspNetCore-1.7.0/src/OpenTelemetry.Instrumentation.AspNetCore/README.md#list-of-metrics-produced) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `ASPNETCORE` | ASP.NET Core \[2\] **Not supported on .NET Framework** | [ASP.NET Core metrics](https://github.com/open-telemetry/opentelemetry-dotnet/blob/Instrumentation.AspNetCore-1.7.1/src/OpenTelemetry.Instrumentation.AspNetCore/README.md#list-of-metrics-produced) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `HTTPCLIENT` | [System.Net.Http.HttpClient](https://docs.microsoft.com/dotnet/api/system.net.http.httpclient) and [System.Net.HttpWebRequest](https://docs.microsoft.com/dotnet/api/system.net.httpwebrequest) | [HttpClient metrics](https://github.com/open-telemetry/opentelemetry-dotnet/blob/Instrumentation.Http-1.7.0/src/OpenTelemetry.Instrumentation.Http/README.md#list-of-metrics-produced) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `NETRUNTIME` | [OpenTelemetry.Instrumentation.Runtime](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.Runtime) | [Runtime metrics](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Instrumentation.Runtime-1.7.0/src/OpenTelemetry.Instrumentation.Process/README.md#metrics) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `PROCESS` | [OpenTelemetry.Instrumentation.Process](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.Process) | [Process metrics](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Instrumentation.Process-0.5.0-beta.4/src/OpenTelemetry.Instrumentation.Process/README.md#metrics) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class MyPlugin
| OpenTelemetry.Exporter.ZipkinExporterOptions | OpenTelemetry.Exporter.Zipkin | 1.7.0 |
| OpenTelemetry.Exporter.OtlpExporterOptions | OpenTelemetry.Exporter.OpenTelemetryProtocol | 1.7.0 |
| OpenTelemetry.Instrumentation.AspNet.AspNetInstrumentationOptions | OpenTelemetry.Instrumentation.AspNet | 1.7.0-beta.2 |
| OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions | OpenTelemetry.Instrumentation.AspNetCore | 1.7.0 |
| OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions | OpenTelemetry.Instrumentation.AspNetCore | 1.7.1 |
| OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions | OpenTelemetry.Instrumentation.EntityFrameworkCore | 1.0.0-beta.10 |
| OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions | OpenTelemetry.Instrumentation.GrpcNetClient | 1.6.0-beta.3 |
| OpenTelemetry.Instrumentation.Http.HttpClientTraceInstrumentationOptions | OpenTelemetry.Instrumentation.Http | 1.7.0 |
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageVersion Include="OpenTelemetry.Exporter.Zipkin" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Propagators" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNet" Version="1.7.0-beta.2" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,15 @@ public static TracerProviderBuilder AddAspNetInstrumentation(TracerProviderBuild
public static TracerProviderBuilder AddAspNetCoreInstrumentation(TracerProviderBuilder builder, PluginManager pluginManager, LazyInstrumentationLoader lazyInstrumentationLoader)
{
DelayedInitialization.Traces.AddAspNetCore(lazyInstrumentationLoader, pluginManager);
return builder
.AddSource("OpenTelemetry.Instrumentation.AspNetCore")
.AddLegacySource("Microsoft.AspNetCore.Hosting.HttpRequestIn");

if (Environment.Version.Major == 6)
{
return builder
.AddSource("OpenTelemetry.Instrumentation.AspNetCore")
.AddLegacySource("Microsoft.AspNetCore.Hosting.HttpRequestIn");
}

return builder.AddSource("Microsoft.AspNetCore");
}

public static TracerProviderBuilder AddGraphQLInstrumentation(TracerProviderBuilder builder, PluginManager pluginManager, LazyInstrumentationLoader lazyInstrumentationLoader, TracerSettings tracerSettings)
Expand Down
4 changes: 4 additions & 0 deletions test/IntegrationTests/HttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public void SubmitTraces(string propagators)
return true;
});
Span? serverSpan = null;
#if NET7_0_OR_GREATER
rajkumar-rangaraj marked this conversation as resolved.
Show resolved Hide resolved
collector.Expect("Microsoft.AspNetCore", span =>
#else
collector.Expect("OpenTelemetry.Instrumentation.AspNetCore", span =>
#endif
{
serverSpan = span;
return true;
Expand Down
Loading