-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Disable the deprecation about delaying sending of events until shutdown #885
Disable the deprecation about delaying sending of events until shutdown #885
Conversation
… sending of events until shutdown
So in version 2.2 it sounds like we now have a flush() method, but it's actually not needed because now events are sent immediately? |
The |
I did some benchmarking of Sentry 1.x, 2.1 and 2.2 using the out-of-the-box configuration, with an unreachable sentry server (connection attempt just hangs forever or until a timeout is reached). The test script triggers four error events.
This doesn't seem great to me - the default HTTP client would ideally be more resilient to the sentry server being unavailable, network problems, etc. |
Could it be because of HTTP plug implementation ? Like this one https://twitter.com/jderusse/status/1115333801419399170 ? |
Yes presumably this is the bug re: 100% CPU usage. But the endless waiting is also IMO a regression from Sentry 1.x, since this would cause processes to be delayed indefinitely, as well as hogging memory and request slots. Could be resolved by setting a reasonable default timeout as 1.x had. |
No HTTP client that I know sets this timeout to something other than infinite and I think that the reason may be that any value may be too less or too much depending on a case-by-case basis, which I tend to agree. This does not change the fact that there is a bug in the implementation of the client we suggest to use, and since it has some other drawbacks too found in the past maybe we should decide to change it to something more stable like Guzzle. |
Yes the timeout should definitely be configurable case-by-case. I'm actually not sure how to configure it at present though. |
Since it depends on the HTTP client that you choose to use we cannot provide an option out-of-the-box that works for everything and I don't think that even if we could we should do it as it's an implementation detail of the client. The way to configure it is to set your own HTTP client in the builder and then configure it however you like |
Wouldn't it make sense to provide a way to access the default HTTP client provided by sentry/sdk and configure things like timeout? Or is that wishful thinking? |
I don't think that we should expose the HTTP client outside of the Sentry client as it's just an implementation detail needed to make requests and this library is not exposing APIs, so it makes no sense to access it from the outside. Exposing its options would mean leak somewhere details of this implementation imho... |
Yes it's an implementation leak given that folks can provide their own HTTP client (and it's currently a good idea since the default one seems to be buggy :), but at the same time, you want to have good developer experience with the out-of-the-box client. The setHttpProxy() method is an illustrative example.. analogous method would be setHttpTimeout(). |
In fact when those methods were added I disagreed, but Unified API had them in the specs and I had to accept it. I disagreed because I wanted to prevent arguments like yours: if you want |
Well if the timeout isn't configurable and the default is forever, then I'd say the recommended client is just not usable, because whenever you're sending an event if Sentry server is offline or slow to respond, your app will block indefinitely. Re: timeout Sentry SDK documentation says "The default is SDK specific but typically around 2 seconds." |
This PR fixes #884 by disabling the deprecation when the transport is initialized by Sentry itself (out-of-the-box setup)