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+ #3231

Closed

Conversation

Kielek
Copy link
Contributor

@Kielek Kielek commented Jan 16, 2024

Why

Fixes #3212
Handles changes from open-telemetry/opentelemetry-dotnet#3391

What

Fixes AspNetCore Instrumentation for traces for .NET7.

It is now producing Microsoft.AspNetCore as it should.
What is more OpenTelemetry.Instrumentation.AspNetCore and its dependencies is loaded from additional store. It has to be loaded with dedicated-compiled version for each .NET version.

Tests

Modified CI.

Checklist

  • CHANGELOG.md is updated.
  • [ ] Documentation is updated.
  • New features are covered by tests.

@Kielek
Copy link
Contributor Author

Kielek commented Jan 16, 2024

As a follow up for this PR we should revisit strategy for loading other OpenTelemetry.* libraries and moved all of them to additional store.
I think that we can do it in the next release as we are not aware about any other issues.

@Kielek Kielek changed the title Fix aspnetcore instrumentation Fix ASP.NET Core Traces Instrumentation for .NET7+ Jan 16, 2024
@Kielek Kielek force-pushed the fix-aspnetcore-instrumentation branch from 4bbc054 to e855afe Compare January 16, 2024 10:37
@Kielek Kielek force-pushed the fix-aspnetcore-instrumentation branch from e855afe to 7da059f Compare January 16, 2024 11:26
Copy link
Contributor

@pjanotti pjanotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 LGTM, one small Q about the lib/<tfm > for one assembly in the store for net7.0 apps.

@@ -37,7 +37,11 @@ public void SubmitTraces(string propagators)
return true;
});
Span? serverSpan = null;
#if NET7_0_OR_GREATER
collector.Expect("Microsoft.AspNetCore", span =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we solve this in a way that we can always use the same instrumentation source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not "our" decision. The difference comes from the (semi)native support for ASP.NET Core instrumentation in net7+ and from "OpenTelemetry.Instrumentation.AspNetCore" package.

I do not see possibility to have the same source for both versions. BTW same case is for http(client) instrumentation (already covered),

@@ -3,5 +3,6 @@
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenTelemetry.Instrumentation.AspNetCore has a dependency on web components like Microsoft.AspNetCore.App. When AdditionalDeps is applied to other .NET type applications, it may interfere with those applications. Therefore, it is not recommended to include web components in the store for auto-instrumentation purposes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see better idea to load dependecy targeted fo .NET7 in net7 runtime?
Based on what I see in store chnages, there is no new libraries included into it. I will double check it tommorow.

@github-actions github-actions bot requested a review from theletterf January 17, 2024 09:25
…ate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageVersion' items are: Microsoft.Extensions.Logging.Abstractions 8.0.0, Microsoft.Extensions.Logging.Abstractions 8.0.0; Microsoft.Extensions.Logging.Configuration 8.0.0, Microsoft.Extensions.
@Kielek
Copy link
Contributor Author

Kielek commented Feb 12, 2024

Handled by #3246

@Kielek Kielek closed this Feb 12, 2024
@Kielek Kielek deleted the fix-aspnetcore-instrumentation branch February 15, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants