Open altnp opened 1 year ago
1.19
Windows 11, Server 2020
.NET 4.6+
Spans for HttpWebRequest are not completed in .NET Framework 4.6+. Spans are open, and the APMLogger reads:
{HttpDiagnosticListenerFullFrameworkImpl} Called with key: `System.Net.Http.Desktop.HttpRequestOut.Start' {HttpDiagnosticListenerFullFrameworkImpl} Processing start event... Request URL: https://www.google.com/
but the corresponding System.Net.Http.Desktop.HttpRequestOut.Stop is never called to complete the span.
System.Net.Http.Desktop.HttpRequestOut.Stop
This seems to be because Microsofts's HttpHandlerDiagnosticListener never raises the RaiseResponseEvent for HttpWebRequest.
HttpHandlerDiagnosticListener
RaiseResponseEvent
Even worse, the open http span then breaks subsequent http request tracking (even if they are HttpClient).
Steps to reproduce the behavior:
Create a console app and manually create a transaction with:
Agent.Tracer.CaptureTransaction("Test", "Console", () => { var request = WebRequest.CreateHttp("https://www.google.com"); request.Method = "GET"; var response = (HttpWebResponse)request.GetResponse(); Console.WriteLine(response.StatusCode); var client = new HttpClient(); var response2 = client.GetAsync("https://www.google.com").Result; });
Thanks for reporting this @altnp, we will look into this issue at our earlier convenience.
APM Agent version
1.19
Environment
Windows 11, Server 2020
.NET 4.6+
Describe the bug
Spans for HttpWebRequest are not completed in .NET Framework 4.6+. Spans are open, and the APMLogger reads:
but the corresponding
System.Net.Http.Desktop.HttpRequestOut.Stop
is never called to complete the span.This seems to be because Microsofts's
HttpHandlerDiagnosticListener
never raises theRaiseResponseEvent
for HttpWebRequest.Even worse, the open http span then breaks subsequent http request tracking (even if they are HttpClient).
To Reproduce
Steps to reproduce the behavior:
Create a console app and manually create a transaction with:
Expected behavior
Actual behavior