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

ASP.NET intrumentation failed on .NET framework #2833

Closed
muhaook opened this issue Aug 12, 2023 · 5 comments · Fixed by #2857 or #2868
Closed

ASP.NET intrumentation failed on .NET framework #2833

muhaook opened this issue Aug 12, 2023 · 5 comments · Fixed by #2857 or #2868
Assignees
Milestone

Comments

@muhaook
Copy link

muhaook commented Aug 12, 2023

Describe the bug
ASP.NET intrumentation failed sometimes on .NET framework.
I have 2 webapi ASP.NET applications. One is WebApiMySql80Netfx462; the other is WebApiMySql81Netfx462. I accessed the first application and saw the ASP.NET instrumentation succeeded. after that, when I tried to access the second application, I did not see any ASP.NET trace/span got collected. Looks like the second ASP.NET instrumentation failed. If I access the second web app in the first place, its traces/spans can be collected.

Attached please find logs:
logs_aspnet_instrumentation_failure.zip

Runtime environment (please complete the following information):

  • OpenTelemetry Automatic Instrumentation version: 1.0.0-rc.2
  • OS: Windows Server 2012 R2
  • .NET version: .NET Framework 4.6.2
@muhaook
Copy link
Author

muhaook commented Aug 14, 2023

web.configs.zip
Attached please find web.config files

@pjanotti pjanotti self-assigned this Aug 15, 2023
@pjanotti
Copy link
Contributor

pjanotti commented Aug 15, 2023

Some suspicions, but, not clear to me yet exactly what is the problem. The current top hypothesis is that the binding redirect for System.Runtime.CompilerServices.Unsafe of WebApiMySql80Netfx462 ends up loading a version lower than 6.0.0.0 that is needed for System.Diagnostics.DiagnosticSource to work. That said it doesn't makes sense with WebApiMySql80Netfx462 being correctly instrumented.

@muhaook could add/update the package reference to https://www.nuget.org/packages/System.Diagnostics.DiagnosticSource/7.0.2 and give it another try? Please, share the resulting web.config files and traces. Thanks!

@muhaook
Copy link
Author

muhaook commented Aug 15, 2023

Thanks @pjanotti for taking care of this issue

I am not sure if WebApiMySql80Netfx462 got correctly instrumented or not in the first place, but I did see related traces/spans collected on UI. So I assume the instrumentation worked.

I added the suggested package reference to project WebApiMySql80Netfx462 and it works - both web applications got instrumented as expected. Here is what I did to the sample source code:
image

Attached please find logs and web.config files:
log_and_web.configs.zip

That said, if customer hit similar issue, we can suggest them to add the suggested package reference, but they may have concern to add a package reference that they did not have to reference to explicitly.

@pjanotti
Copy link
Contributor

pjanotti commented Aug 15, 2023

Thanks @muhaook - I'm going to keep the issue open until I have a chance to look at the newer logs. Likely we need to at least to add something to troubleshooting.

@pjanotti pjanotti added this to the 1.0.0 milestone Aug 16, 2023
@pjanotti
Copy link
Contributor

SIG: troubleshoot note for GA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment