-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Consider adding a telemetry event for failed HTTP connection attempts #110351
Comments
Tagging subscribers to this area: @dotnet/ncl |
We are reporting the same exceptions on the Lines 647 to 653 in efd5a63
Whether it's a "better way", depends on the use-case. Some may prefer to consume distributed traces, others may want |
Ah, thanks, I forgot about this one. An event could still be useful but I'm not as worried in that case.
Looks like we're inconsistent here rn, we do report the ConnectTimeout on H/3. Lines 280 to 289 in 05fa881
I could see it being useful if we did include info on whether the cancellation was due to ConnectTimeout / due to One difference that could matter is that we also exclude H/2 handshake failures here. |
So are you aware of a specific user scenario you wanted this to help with? If yes, does this mean they would be OK consuming distributed traces? |
Yes. I'm helping in an investigation where a service isn't establishing connections for some reason.
I'll try to find out, but it's likely that it only being available since 9.0 is going to be an issue. (whatever improvements we make here are unlikely to help in this particular investigation, but I'd like us to have a better experience in the future - if for no other reason so that investigating things is easier for ourselves) |
Ok, tentatively triaged this to 10.0 assuming it's easy to implement. We can always change the priority. |
With how requests are split from connections in
SocketsHttpHandler
, the user may not always see the errors that occurred during connection establishment (dns + tcp + tls + http/2 handshake).The errors may be swallowed if we already served the initiating request with a different connection, or if that request timed out.
There are therefore situations where you may have poor visibility into what's happening.
One way of gaining the info is to inject a custom
ConnectCallback
along the lines ofThis gives you visibility into failures when trying to connect, but not into TLS failures/timeouts.
It's possible to also perform the TLS handshake in the callback, but we don't always make it trivial (how do you pick the host, how do you handle ALPN, potential custom ssl settings, ...).
It seems rather simple for us to add an
EventSource
event toSystem.Net.Http
that just logs all such failures, corresponding toruntime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http1.cs
Lines 307 to 309 in 05fa881
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs
Lines 271 to 273 in 05fa881
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http3.cs
Lines 325 to 329 in 05fa881
Maybe something like
Does this seem reasonable @antonfirsov, maybe we have better ways of exposing such data now?
The text was updated successfully, but these errors were encountered: