-
-
Notifications
You must be signed in to change notification settings - Fork 450
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
Support http_connect_timeout and http_timeout options #1282
Support http_connect_timeout and http_timeout options #1282
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the explicit comments, this PR requires targeting develop, a changelog entry and some tests.
a411e29
to
9e22800
Compare
Thanks @Jean85 for the suggestions/comments. I've made most of them. I tried to do them for the |
I tried to write some tests by using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems fine to me, just a small comment and fixing PHPStan baseline is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me 👍 great work!
In the meantime, I've checked with @bruno-garcia about the options naming, and he said that there's no standard, just Java SDK having sub-optimal names:
https://github.com/getsentry/sentry-java/blob/01cda06a94805f9940229e07ec7f31747f70474c/sentry/src/main/java/io/sentry/SentryOptions.java
https://github.com/getsentry/sentry-java/blob/01cda06a94805f9940229e07ec7f31747f70474c/sentry/src/main/java/io/sentry/SentryOptions.java
For the CS issues, use |
This comment was marked as outdated.
This comment was marked as outdated.
Looks like this didn't make it into 3.4.0 - but hopefully could make it into 3.5.0? |
Sorry for the radio silence on this, we've decided to use relay to alleviate our concerns. I'm afraid I don't have the bandwidth to pick this up at the moment, any volunteers to see this through would be greatly appreciated 🙏 |
Sure, why not. I will try to find some time in the next days/weeks to finish the work. In the meanwhile, thank you @matthew-gill for having done most of it |
How can we support this PR to get it merged? |
…ase when using Symfony HTTP client
350c3b9
to
4f04648
Compare
I'm curious what is the rationale of having http_timeout and http_connect_timeout options when the underlying Symfony HTTP client used by the SDK has max_duration and timeout options, which have different meanings. Wouldn't just having the same options be easier to grok? |
The core SDK has no binding to any specific HTTP client, or at least we try to not have it... We provide some code to ease the intialization of the HTTP transport using some common clients, but this doesn't mean that we want to use them specifically besides that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed this privately with @ste93cry, but I'm still of the opinion that we should make these new options nullable and throw when we can't apply them, otherwise we could silently ignore them, and confuse the user.
So, I would change the check into something like:
if (
null !== $options->getHttpProxy()
|| null !== $options->getHttpConnectTimeout()
|| null !== $options->getHttpTimeout()
) {
throw new \RuntimeException('The "http_connect_timeout", "http_timeout" and "http_proxy" options are natively supported ony with "php-http/curl-client", "symfony/http-client" and "php-http/guzzle6-adapter"; either use one of them, or switch to build your HTTP transport manually.');
}
While it's true that we could potentially confuse the user, I think that documenting the fact that these options could not apply to all HTTP clients would be enough. Making them |
Well, I think we need a tie breaker here... @stayallive? @smeubank? @HazAT? |
I think that making them nullable makes the most sense to be honest, because:
|
I am with @stayallive. Let's just document what So I would say let's merge it. More importantly, for me would be the change |
If we don't want to throw the exception, it makes little sense to have those options
This is a breaking change, people don't expect a default to change between minor versions |
There is no need to change We do that separately and include that in a new major release of course instead of a minor. |
I didn't mean that we need to change |
Don't think we are, as @HazAT mentioned we are going to document how they work but not going to add the exception in that case the defaults can live in the options 👍 This is how the PR currently is, I don't think there is anything to do, good to merge? |
The http_connect_timeout and http_timeout options were added in getsentry/sentry-php#1282
* Document new timeout options The http_connect_timeout and http_timeout options were added in getsentry/sentry-php#1282 * Add commas for improved readability of prepositional phrase Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
I created this issue in the Symfony repo: getsentry/sentry-symfony#592
This PR modifies the
HttpClientFactory
to allow configuration of the http (connect) timeout values.If no option is set, it will use the default.
If I've missed the mark, feel free to reject - I'd just love to be able to do this in my app, if it's possible already please let me know, thanks!