getsentry / getsentry/sentry-dotnet

Improve `Proxy` experience of Sentry's `HttpClient`

Open
#4,118 0 comments 0 reactions 1 assignee Claimed by @Flash0ver View on GitHub
.NET Improvement
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

During a user feedback session we learned that the onboarding of configuring a `Proxy` for Sentry's `HttpClient` could be improved.

### Documentation
Perhaps we could add a code example to our docs.
Or add an entry to our Troubleshooting docs.
And/or review our `./samples/`.

### APIs
Additionally, we may add a new API to `SentryOptions`.
```diff
namespace Sentry;
public class SentryOptions
{
public IWebProxy? HttpProxy { get; set; }
+ public Uri? HttpProxyAddress { get; set; }
}
```

Or add an API to our "Bindable" options
```diff
public class BindableSentryOptions //or SentryLoggingOptions, or SentryAspNetCoreOptions
{
+ public Uri? HttpProxyAddress { get; set; }
}
```
and then configure the `SentryOptions.HttpProxy` property to `options.HttpProxy ??= new WebProxy(HttpProxyAddress);` if not already set manually.

#### Risks
- Maintenance
- Inconsistency with comparable SDKs
- Confusion about precedence
- new API only applies if
- `SentryOptions.HttpProxy` is not set
- `SentryOptions.SentryHttpClientFactory` is not set
- `Sentry.Transport` is not set
- Users may have the Address of the Proxy configured via the `Options` pattern already, so custom code needs to read this configuration

Alternatively we could think about adding something like
```csharp
class SentryAspNetCoreOptions/SentryLoggingOptions/(BindableSentryOptions)
{
// { "Sentry": { "HttpProxyAddressConfigurationKey": "Key:To:HttpProxyAddress" } }
public string? HttpProxyAddressConfigurationKey { get; set; }
}
```
but this isn't really an established `Configuration` pattern.

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.