getsentry / getsentry/sentry-dotnet

Improve the logic for detecting network availability issues

Open
#3,945 0 comments 0 reactions 0 assignees View on GitHub
.NET Improvement
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

See:
- https://github.com/getsentry/sentry-dotnet/pull/3938/files#r1945562033

https://github.com/getsentry/sentry-dotnet/blob/2529ab5602e3962ab45f06a087fcb8a69dd12f80/src/Sentry/Internal/Http/CachingTransport.cs#L303-L309

Some of the exception types we use to detect network availability issues are umbrella's for lots of potential root cause errors.

`HttpRequestException`, for example, has a StatusCode that could indicate any number of reasons why the request failed. Only a few of these would indicate network availability issues.

Similarly, [the SocketError enum](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socketerror?view=net-8.0#fields) indicates all kinds of different root causes for a socket error.

This is complicated by the fact that these more specific codes appear to depend on the operating system where the HttpClient is running... so we'd need different code for different operating systems (at the very least, Windows + Others... hopefully Unix and macOS do more or less the same thing).

This is unrelated to this PR btw - I just noticed it when trying to identify, more specifically, a broken pipe exception.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.