-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add Graphite Web HTTP request timeout option #321
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.
Thanks!
I've just left you some suggestions to solve two problems:
- The type safety as reported by phpstan
- The fallback for configs without a timeout, so that the new default of 10 seconds applies to them as well
@nilmerg Thanks for the suggestions. I had tried to fix the type safety issues reported by PHPStan but couldn't understand why the following calls weren't triggering the same errors:
I applied the suggestions locally and PHPStan raised the same error with a slightly different expected type:
|
The problem is that the config section type has no idea of its contained properties and hence phpstan complains rightfully about the unsafe handling. The config might as well contain To fix this, I'd suggest to use this in
|
fd4c887
to
ced14d1
Compare
Extending the baseline isn't an option. |
PHPStan is not throwing type errors for the other config fields because they are being ignored via entries in the baseline: icingaweb2-module-graphite/phpstan-baseline.neon Lines 68 to 76 in 254ff35
As the |
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.
If you rebase, phpstan shouldn't complain anymore.
We've introduced phpstan to our CI toolstack just recently and didn't adjust most of what it complained about. Hence why the baselines are rather large at the moment. Though, adding additional entries to those isn't helpful in any way as it renders phpstan useless after all.
I've played around with generics just recently and now added them to Icinga Web's ConfigObject
. This allows us to define here what our config contains. I've did that now in the default branch and you don't have to do anything, other than rebasing. So please drop the changes in the baseline.
ced14d1
to
4ac8319
Compare
If the Graphite Web server is unreachable, all requests for frontend pages containing graphs hang until the backend HTTP request times out, resulting in a very poor UX. The Guzzle documentation states that the default behaviour is to wait indefinitely, however in our testing the cURL handler has an internal default of 30 seconds: https://docs.guzzlephp.org/en/stable/request-options.html#timeout This commit makes the HTTP request timeout configurable and sets a reasonable default of 10 seconds.
4ac8319
to
fc85e6c
Compare
Thanks for your help on this. I've removed the baseline changes and ensured that Guzzle isn't passed a null value for timeout. |
If the Graphite Web server is unreachable, all requests for frontend pages containing graphs hang until the backend HTTP request times out, resulting in a very poor UX.
The Guzzle documentation states that the default behaviour is to wait indefinitely, however in our testing the cURL handler has an internal default of 30 seconds:
https://docs.guzzlephp.org/en/stable/request-options.html#timeout
This commit makes the HTTP request timeout configurable and sets a reasonable default of 10 seconds.