MindscapeHQ / raygun4net

Raygun provider for .NET
https://raygun.com
MIT License
126 stars 93 forks source link

Throttling ability in returned RaygunClient, and question about singleton #425

Closed Plasma closed 8 months ago

Plasma commented 4 years ago

Hi,

We had a time where the AspnetCore middleware was capturing and sending 100s of requests/sec to your servers as each web request was hitting an exception.

I tried to find a way using the existing options to be able to throttle outgoing error reports (eg only allow 5 to be in-flight at any one moment) as some kind of bulkhead defense against this in the future.

Unfortunately it looks like thats not possible, as the middleware you offer won't let me intercept the actual sending of the report (I wish it was a virtual method SendReportAsync or something I could override the implementation of using RaygunClient.SendInBackground).

Would you consider updating the middleware so that we can override the method used to send the prepared error report (which allows us to not send it, too).

Separately, its not clear if RaygunClient is thread safe. Thanks!

phillip-haydon commented 8 months ago

v10.0.0 has been released, it includes background worker from v9 which limits the number of concurrent sends to avoid consuming too many threads/ports. It also treats RaygunClient as a singleton. I believe this addresses both issues raised.